[pve-devel] [PATCH qemu-server v2 1/5] add second qmp socket with qemu 2.12

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


we will use this for the qmeventd, but we have to limit this
to qemu 2.12, because we cannot add this during a live migration

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* new in v1
* now checks for 2.12 instead of 3.0
 PVE/QemuServer.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 56d3043..933f54f 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3200,6 +3200,11 @@ sub config_to_command {
     push @$cmd, '-chardev', "socket,id=qmp,path=$qmpsocket,server,nowait";
     push @$cmd, '-mon', "chardev=qmp,mode=control";
 
+    if (qemu_machine_feature_enabled($machine_type, $kvmver, 2, 12)) {
+	my $eventsocket = qmp_socket($vmid, 0, 'event');
+	push @$cmd, '-chardev', "socket,id=qmp-event,path=$eventsocket,server,nowait";
+	push @$cmd, '-mon', "chardev=qmp-event,mode=control";
+    }
 
     push @$cmd, '-pidfile' , pidfile_name($vmid);
 
@@ -3690,9 +3695,10 @@ sub spice_port {
 }
 
 sub qmp_socket {
-    my ($vmid, $qga) = @_;
+    my ($vmid, $qga, $name) = @_;
     my $sockettype = $qga ? 'qga' : 'qmp';
-    return "${var_run_tmpdir}/$vmid.$sockettype";
+    my $ext = $name ? '-'.$name : '';
+    return "${var_run_tmpdir}/$vmid$ext.$sockettype";
 }
 
 sub pidfile_name {
-- 
2.11.0





More information about the pve-devel mailing list