Prevent shrinking attempts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -406,6 +406,10 @@ impl DiskFileInfo {
|
|||||||
|
|
||||||
/// Resize disk
|
/// Resize disk
|
||||||
pub fn resize(&self, new_size: FileSize) -> anyhow::Result<()> {
|
pub fn resize(&self, new_size: FileSize) -> anyhow::Result<()> {
|
||||||
|
if new_size <= self.virtual_size().unwrap_or(new_size) {
|
||||||
|
anyhow::bail!("Shrinking disk image file is not supported!");
|
||||||
|
}
|
||||||
|
|
||||||
let mut cmd = Command::new(constants::PROGRAM_QEMU_IMAGE);
|
let mut cmd = Command::new(constants::PROGRAM_QEMU_IMAGE);
|
||||||
cmd.arg("resize")
|
cmd.arg("resize")
|
||||||
.arg("-f")
|
.arg("-f")
|
||||||
|
Reference in New Issue
Block a user