Clean up left-over fleecing images before the guest is migrated to a
different node and they'd really become orphaned.

Suggested-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---

Changes in v4:
* order before loading the configuration for migration

 PVE/QemuMigrate.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 6591f3f7..32eeade2 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -177,6 +177,13 @@ sub prepare {
 
     my $storecfg = $self->{storecfg} = PVE::Storage::config();
 
+    # updates the configuration, so ordered before saving the configuration in 
$self
+    eval {
+       PVE::QemuConfig::cleanup_fleecing_images(
+           $vmid, $storecfg, sub { $self->log($_[0], $_[1]); });
+    };
+    $self->log('warn', "attempt to clean up left-over fleecing images failed - 
$@") if $@;
+
     # test if VM exists
     my $conf = $self->{vmconf} = PVE::QemuConfig->load_config($vmid);
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to