diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-09-01 14:19:14 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-09-01 15:31:37 +0300 |
commit | 33f8b71100b1cfcf893ef989e0eaebb380a3f9b7 (patch) | |
tree | 0678c5530790279912d489504dfa90d547c42c06 | |
parent | 337577a9a207ad2ab84a00c8d7e88b64f51099fe (diff) | |
download | ambient-run-33f8b71100b1cfcf893ef989e0eaebb380a3f9b7.tar.gz |
fix: writable virtual drives are writable
Sponsored-by: author
-rw-r--r-- | src/qemu.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qemu.rs b/src/qemu.rs index 98254bf..22b6864 100644 --- a/src/qemu.rs +++ b/src/qemu.rs @@ -78,10 +78,10 @@ impl Qemu { .with_ipflash(0, OVMF_FD, true) .with_ipflash(1, vars.to_str().unwrap(), false) .with_qcow2(image.to_str().unwrap()) - .with_raw(source_drive.filename()) - .with_raw(output_drive.filename()) - .with_raw(cache_drive.filename()) - .with_raw(deps_drive.filename()) + .with_raw(source_drive.filename(), true) + .with_raw(output_drive.filename(), false) + .with_raw(cache_drive.filename(), false) + .with_raw(deps_drive.filename(), true) .with_arg("-nodefaults"); let log = Self::create_file(&self.log)?; @@ -175,11 +175,12 @@ impl QemuArgs { self } - fn with_raw(mut self, path: &Path) -> Self { + fn with_raw(mut self, path: &Path, readonly: bool) -> Self { self.args.push("-drive".into()); self.args.push(format!( - "format=raw,if=virtio,file={},readonly=on", - path.display() + "format=raw,if=virtio,file={}{}", + path.display(), + if readonly { ",readonly=on" } else { "" }, )); self } |