fix #1131: activate volume before copying efidisk

before copying the efidisk image to a storage,
we first have to activate the volume

also, add the -n flag to qemu-img convert (prevents
creation of the target volume)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2016-10-06 11:56:00 +02:00 committed by Dietmar Maurer
parent e22b5f22a5
commit 02daf96a15

View File

@ -137,9 +137,12 @@ my $create_disks = sub {
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
my $qemufmt = PVE::QemuServer::qemu_img_format($scfg, $volname);
my $path = PVE::Storage::path($storecfg, $volid);
my $efidiskcmd = ['/usr/bin/qemu-img', 'convert', '-f', 'raw', '-O', $qemufmt];
my $efidiskcmd = ['/usr/bin/qemu-img', 'convert', '-n', '-f', 'raw', '-O', $qemufmt];
push @$efidiskcmd, $ovmfvars;
push @$efidiskcmd, $path;
PVE::Storage::activate_volumes($storecfg, [$volid]);
eval { PVE::Tools::run_command($efidiskcmd); };
my $err = $@;
die "Copying of EFI Vars image failed: $err" if $err;