code cleanup
This commit is contained in:
@ -427,11 +427,13 @@ sub alloc_image {
|
||||
|
||||
die "disk image '$path' already exists\n" if -e $path;
|
||||
|
||||
my $options = "";
|
||||
$options = "-o preallocation=metadata" if $fmt eq 'qcow2';
|
||||
my $cmd = ['/usr/bin/qemu-img', 'create'];
|
||||
|
||||
run_command("/usr/bin/qemu-img create $options -f $fmt '$path' ${size}K",
|
||||
errmsg => "unable to create image");
|
||||
push @$cmd, '-o', 'preallocation=metadata' if $fmt eq 'qcow2';
|
||||
|
||||
push @$cmd, '-f', $fmt, $path, "${size}K";
|
||||
|
||||
run_command($cmd, errmsg => "unable to create image");
|
||||
|
||||
return "$vmid/$name";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user