From 64932aebff157d56f309d9156b2cf49ec29e830c Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 6 May 2017 17:00:20 +0200 Subject: [PATCH] PVE::QemuServer::create_disks - run code inside eval So that we can free allocated volumes ins something fails. Thi bug was introduced with commit ae57f6b352242fed69da851f15f976095d290833 --- PVE/API2/Qemu.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index f5ffb9bd..db1de34c 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -119,7 +119,8 @@ my $create_disks = sub { my $vollist = []; my $res = {}; - PVE::QemuServer::foreach_drive($settings, sub { + + my $code = sub { my ($ds, $disk) = @_; my $volid = $disk->{file}; @@ -190,7 +191,9 @@ my $create_disks = sub { $res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk); } - }); + }; + + eval { PVE::QemuServer::foreach_drive($settings, $code); }; # free allocated images on error if (my $err = $@) { -- 2.39.5