[pve-devel] [PATCH qemu-server v2 4/5] use qmeventd to execute qm cleanup

Dominik Csapak d.csapak at proxmox.com
Wed Oct 17 14:31:22 CEST 2018


we use the second qmp socket for qmeventd to monitor it and
let it execute 'qm cleanup' on shutdown of the vm

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* check for qemu 2.12 instead of 3.0
 PVE/QemuServer.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 933f54f..2667946 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5056,6 +5056,13 @@ sub vm_start {
 		    property => "guest-stats-polling-interval",
 		    value => 2) if (!defined($conf->{balloon}) || $conf->{balloon});
 
+	# start cleanup daemon
+	if (qemu_machine_feature_enabled ($forcemachine, kvm_user_version(), 2, 12)) {
+	    my $monitorcmd = ['/usr/sbin/qmeventd', qmp_socket($vmid, 0, 'event')];
+	    my $cleanupcmd = ['/usr/sbin/qm', 'cleanup', $vmid];
+	    push @$monitorcmd, @$cleanupcmd;
+	    run_command($monitorcmd);
+	}
     });
 }
 
-- 
2.11.0





More information about the pve-devel mailing list