From c6d0c8a702ca58df03f2be8a488455b1453ea31c Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Thu, 2 May 2013 06:43:37 +0200 Subject: [PATCH] fix : signal interrupt don't delete volume on full copy Currently we push newvolid to newvollist after qemu-img convert, so if signal interrupt occur during qemu-img convert, the newvollist is empty and we can't free the volume Instead, We need to push newvolid to newvollist just after volume creation Signed-off-by: Alexandre Derumier --- PVE/API2/Qemu.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index f524dfc5..6d02ded1 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1992,6 +1992,8 @@ __PACKAGE__->register_method({ if (!$param->{full} && PVE::Storage::volume_is_base($storecfg, $drive->{file})) { print "clone drive $opt ($drive->{file})\n"; $newvolid = PVE::Storage::vdisk_clone($storecfg, $drive->{file}, $newid); + push @$newvollist, $newvolid; + } else { my ($storeid, $volname) = PVE::Storage::parse_volume_id($drive->{file}); $storeid = $storage if $storage; @@ -2008,6 +2010,7 @@ __PACKAGE__->register_method({ print "copy drive $opt ($drive->{file})\n"; $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newid, $fmt, undef, ($size/1024)); + push @$newvollist, $newvolid; PVE::QemuServer::qemu_img_convert($drive->{file}, $newvolid, $size, $snapname); } @@ -2015,7 +2018,6 @@ __PACKAGE__->register_method({ my ($size) = PVE::Storage::volume_size_info($storecfg, $newvolid, 3); my $disk = { file => $newvolid, size => $size }; $newconf->{$opt} = PVE::QemuServer::print_drive($vmid, $disk); - push @$newvollist, $newvolid; PVE::QemuServer::update_config_nolock($newid, $newconf, 1); } -- 2.39.5