From 4e659fcac6fea9c7767e41b014ceecffedbfedca Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Mon, 27 Jan 2025 12:29:22 +0100 Subject: [PATCH] migration: attempt to clean up potential left-over fleecing images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Fiona Ebner Link: https://lore.proxmox.com/20250127112923.31703-16-f.ebner@proxmox.com --- PVE/QemuMigrate.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 625fd1f7..f02360ad 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);