[pve-devel] [PATCH qemu-server 2/2] better cleanup logging for migration

Dominik Csapak d.csapak at proxmox.com
Tue Nov 27 11:32:18 CET 2018


if we migrate a vm we call cleanup but the logging looks like:

Starting cleanup for 101
trying to acquire lock...
 OK
Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist

with this patch it looks like this:

Starting cleanup for 101
trying to acquire lock...
 OK
Configuration file 'nodes/pve-ceph-01/qemu-server/101.conf' does not exist
Config for 101 not found, possibly migrated
Finished cleanup for 101

it makes it more clear that the cleanup correctly does nothing,
and gives a hint that it got migrated

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
maybe the $@ if $@ warn is too much?

 PVE/CLI/qm.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index eceb9b3..f99dce0 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -757,7 +757,12 @@ __PACKAGE__->register_method({
 	warn "Starting cleanup for $vmid\n";
 
 	PVE::QemuConfig->lock_config($vmid, sub {
-	    my $conf = PVE::QemuConfig->load_config ($vmid);
+	    my $conf = eval { PVE::QemuConfig->load_config ($vmid) };
+	    if (!$conf) {
+		warn $@ if $@;
+		warn "Config for $vmid not found, possibly migrated\n";
+		return;
+	    }
 	    my $pid = PVE::QemuServer::check_running ($vmid);
 	    die "vm still running\n" if $pid;
 
-- 
2.11.0





More information about the pve-devel mailing list