[pve-devel] [PATCH qemu-server] fix #1131: activate volume before copying efidisk

Dominik Csapak d.csapak at proxmox.com
Thu Oct 6 11:56:00 CEST 2016


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 at proxmox.com>
---
 PVE/API2/Qemu.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 482b8cd..21fbebb 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -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;
-- 
2.1.4





More information about the pve-devel mailing list