diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index fcfd1cdaa3..611fab00da 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -328,6 +328,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"device-tray-moved-event",
"nec-usb-xhci-ports",
"virtio-scsi-pci.iothread",
+ "name-guest",
);
@@ -2667,6 +2668,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
{ "spice", "gl", QEMU_CAPS_SPICE_GL },
{ "chardev", "logfile", QEMU_CAPS_CHARDEV_LOGFILE },
{ "name", "debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS },
+ { "name", "guest", QEMU_CAPS_NAME_GUEST },
};
static int
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e7d0a605c7..9145f2d2ba 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -359,6 +359,7 @@ typedef enum {
QEMU_CAPS_DEVICE_TRAY_MOVED, /* DEVICE_TRAY_MOVED event */
QEMU_CAPS_NEC_USB_XHCI_PORTS, /* -device nec-usb-xhci.p3 ports setting */
QEMU_CAPS_VIRTIO_SCSI_IOTHREAD, /* virtio-scsi-{pci,ccw}.iothread */
+ QEMU_CAPS_NAME_GUEST, /* -name guest= */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7b54242d48..f786462c6b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6869,6 +6869,10 @@ qemuBuildNameCommandLine(virCommandPtr cmd,
virCommandAddArg(cmd, "-name");
+ /* The 'guest' option let's us handle a name with '=' embedded in it */
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_GUEST))
+ virBufferAddLit(&buf, "guest=");
+
qemuBufferEscapeComma(&buf, def->name);
if (cfg->setProcessName &&
diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
index 4663e192bc..2428aff5cf 100644
--- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml
@@ -168,6 +168,7 @@
+
2001001
0
diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
index a8df7e1c41..68ea0de0f0 100644
--- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml
@@ -181,6 +181,7 @@
+
2004000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
index 216017377e..73f0147f93 100644
--- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml
@@ -182,6 +182,7 @@
+
2004000
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
index f4e6db1bf9..362ec1c796 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml
@@ -158,6 +158,7 @@
+
2005094
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
index f4d60d1981..21380491d7 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml
@@ -158,6 +158,7 @@
+
2005094
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
index 96a02a55dd..1d5d67043f 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml
@@ -152,6 +152,7 @@
+
2005094
0
diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
index 9024d63882..5970d190a3 100644
--- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml
@@ -187,6 +187,7 @@
+
2005050
0
diff --git a/tests/qemucaps2xmldata/all_1.6.0-1.caps b/tests/qemucaps2xmldata/all_1.6.0-1.caps
index 1484c79177..d39d0bebbf 100644
--- a/tests/qemucaps2xmldata/all_1.6.0-1.caps
+++ b/tests/qemucaps2xmldata/all_1.6.0-1.caps
@@ -125,4 +125,5 @@
+
diff --git a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
index 8bd8a18dbc..5a0372c917 100644
--- a/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
+++ b/tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.caps
@@ -124,4 +124,5 @@
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
index b50b8c4afb..b59706c2e2 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args
@@ -5,16 +5,16 @@ USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
/usr/bin/qemu \
--name foo,,bar,debug-threads=on \
+-name guest=foo=1,,bar=2,debug-threads=on \
-S \
--object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo,,\
-bar/master-key.aes \
+-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo=1,,\
+bar=2/master-key.aes \
-M pc \
-m 214 \
-smp 1 \
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
-nodefaults \
--chardev socket,id=charmonitor,path=/tmp/lib/domain--1-foo,,bar/monitor.sock,\
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-foo=1,,bar=2/monitor.sock,\
server,nowait \
-mon chardev=charmonitor,id=monitor,mode=readline \
-no-acpi \
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
index e263553e07..5e8c7476fe 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.xml
@@ -1,5 +1,5 @@
- foo,bar
+ foo=1,bar=2
c7a5fdbd-edaf-9455-926a-d65c16db1809
219100
219100
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 99f2b335c0..bac12c3d8a 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1903,7 +1903,8 @@ mymain(void)
NONE);
DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS,
- QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC);
+ QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC,
+ QEMU_CAPS_NAME_GUEST);
DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);