[libvirt] [PATCH v4 0/6] Add vmport feature

Hi, The QEMU machine vmport option allows to set the VMWare IO port emulation. This emulation is useful for absolute pointer input when the guest has vmware input drivers, and is enabled by default for kvm. However it is unnecessary for Spice-enabled VM, since the agent already handles absolute pointer and multi-monitors. Furthermore, it prevents Spice from switching to relative input since the regular ps/2 pointer driver is replaced by the vmware driver. It is thus advised to disable vmport when using a Spice VM. This will permit the Spice client to switch from absolute to relative pointer, as it may be required for certain games or applications. The following patch series allows to configure the vmport feature. v2: - use a feature instead of a domain attribute, suggested by D. Berrange v3: - use qmp query for caps instead of version v4: - use vesion check & qmp, add runtime check for machine kind Marc-André Lureau (6): docs: add domain vmport feature domain/conf: add VIR_DOMAIN_FEATURE_VMPORT qemu: add QEMU_CAPS_MACHINE_VMPORT_OPT qemu: add virQEMUCapsSupportsVmport qemu: add machine vmport argument tests: add machine-vmport-opt qemu test docs/formatdomain.html.in | 6 ++++ docs/schemas/domaincommon.rng | 9 ++++++ src/conf/domain_conf.c | 5 +++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 20 +++++++++++++ src/qemu/qemu_capabilities.h | 4 +++ src/qemu/qemu_command.c | 33 +++++++++------------- src/qemu/qemu_domain.c | 19 +++++++++++++ src/qemu/qemu_domain.h | 3 ++ .../qemuxml2argv-machine-vmport-opt.args | 6 ++++ .../qemuxml2argv-machine-vmport-opt.xml | 28 ++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 12 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml -- 2.1.0

A new feature that can be turned on or off. The QEMU machine vmport option allows to set the VMWare IO port emulation. This emulation is useful for absolute pointer input when the guest has vmware input drivers, and is enabled by default for kvm. However it is unnecessary for Spice-enabled VM, since the agent already handles absolute pointer and multi-monitors. Furthermore, it prevents Spice from switching to relative input since the regular ps/2 pointer driver is replaced by the vmware driver. It is thus advised to disable vmport when using a Spice VM. This will permit the Spice client to switch from absolute to relative pointer, as it may be required for certain games or applications. --- docs/formatdomain.html.in | 6 ++++++ docs/schemas/domaincommon.rng | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index e921749..ca5aa25 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1501,6 +1501,12 @@ performance monitoring unit for the guest. <span class="since">Since 1.2.12</span> </dd> + <dt><code>vmport</code></dt> + <dd>Depending on the <code>state</code> attribute (values <code>on</code>, + <code>off</code>, default <code>on</code>) enable or disable + the emulation of VMWare IO port, for vmmouse etc. + <span class="since">Since 1.2.15</span> + </dd> </dl> <h3><a name="elementsTime">Time keeping</a></h3> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 19461f5..439323d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4014,6 +4014,15 @@ <optional> <ref name="pmu"/> </optional> + <optional> + <element name="vmport"> + <optional> + <attribute name="state"> + <ref name="virOnOff"/> + </attribute> + </optional> + </element> + </optional> </interleave> </element> </optional> -- 2.1.0

--- src/conf/domain_conf.c | 5 ++++- src/conf/domain_conf.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 479b4c2..1467cd3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -140,7 +140,8 @@ VIR_ENUM_IMPL(virDomainFeature, VIR_DOMAIN_FEATURE_LAST, "kvm", "pvspinlock", "capabilities", - "pmu") + "pmu", + "vmport") VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, VIR_DOMAIN_CAPABILITIES_POLICY_LAST, "default", @@ -14323,6 +14324,7 @@ virDomainDefParseXML(xmlDocPtr xml, case VIR_DOMAIN_FEATURE_PMU: case VIR_DOMAIN_FEATURE_PVSPINLOCK: + case VIR_DOMAIN_FEATURE_VMPORT: node = ctxt->node; ctxt->node = nodes[i]; if ((tmp = virXPathString("string(./@state)", ctxt))) { @@ -20863,6 +20865,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, case VIR_DOMAIN_FEATURE_PMU: case VIR_DOMAIN_FEATURE_PVSPINLOCK: + case VIR_DOMAIN_FEATURE_VMPORT: switch ((virTristateSwitch) def->features[i]) { case VIR_TRISTATE_SWITCH_LAST: case VIR_TRISTATE_SWITCH_ABSENT: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 25d3ee6..21cbd0f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1649,6 +1649,7 @@ typedef enum { VIR_DOMAIN_FEATURE_PVSPINLOCK, VIR_DOMAIN_FEATURE_CAPABILITIES, VIR_DOMAIN_FEATURE_PMU, + VIR_DOMAIN_FEATURE_VMPORT, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; -- 2.1.0

Set the capability based on qmp query, or qemu version. The qmp query includes vmport with 2.2, but no longer with 2.3. It lists only non-machine specific capabilities, so check the qemu version too until a machine-specific query is supported. --- src/qemu/qemu_capabilities.c | 7 +++++++ src/qemu/qemu_capabilities.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 01ed1e2..ca26855 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -279,6 +279,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "qxl.vgamem_mb", "qxl-vga.vgamem_mb", "pc-dimm", + + "machine-vmport-opt", /* 185 */ ); @@ -2509,6 +2511,7 @@ struct virQEMUCapsCommandLineProps { static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = { { "machine", "mem-merge", QEMU_CAPS_MEM_MERGE }, + { "machine", "vmport", QEMU_CAPS_MACHINE_VMPORT_OPT }, { "drive", "discard", QEMU_CAPS_DRIVE_DISCARD }, { "realtime", "mlock", QEMU_CAPS_MLOCK }, { "boot-opts", "strict", QEMU_CAPS_BOOT_STRICT }, @@ -3255,6 +3258,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, if (qemuCaps->version >= 1006000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + /* vmport option is supported v2.2.0 onwards */ + if (qemuCaps->version >= 2002000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT); + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; if (virQEMUCapsProbeQMPEvents(qemuCaps, mon) < 0) diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index c7b1ac7..48c8f96 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -224,6 +224,7 @@ typedef enum { QEMU_CAPS_QXL_VGAMEM = 182, /* -device qxl.vgamem_mb */ QEMU_CAPS_QXL_VGA_VGAMEM = 183, /* -device qxl-vga.vgamem_mb */ QEMU_CAPS_DEVICE_PC_DIMM = 184, /* pc-dimm device */ + QEMU_CAPS_MACHINE_VMPORT_OPT = 185, /* -machine xxx,vmport=on/off/auto */ QEMU_CAPS_LAST, /* this must always be the last item */ } virQEMUCapsFlags; -- 2.1.0

The vmport machine argument works with pc machine kind, not with xen for example. --- src/qemu/qemu_capabilities.c | 13 +++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_command.c | 19 ------------------- src/qemu/qemu_domain.c | 19 +++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 5 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ca26855..607b6d5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3725,6 +3725,19 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def, bool +virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, + const virDomainDef *def) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT)) + return false; + + return qemuDomainMachineIsI440FX(def) || + qemuDomainMachineIsQ35(def) || + STREQ(def->os.machine, "isapc"); +} + + +bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps, const char *canonical_machine) { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 48c8f96..81557b7 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -263,6 +263,9 @@ bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps, bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, virDomainDefPtr def); +bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, + const virDomainDef *def); + char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps); const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 29b876e..f25a75f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1954,25 +1954,6 @@ qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def, } -static bool -qemuDomainMachineIsQ35(virDomainDefPtr def) -{ - return (STRPREFIX(def->os.machine, "pc-q35") || - STREQ(def->os.machine, "q35")); -} - - -static bool -qemuDomainMachineIsI440FX(virDomainDefPtr def) -{ - return (STREQ(def->os.machine, "pc") || - STRPREFIX(def->os.machine, "pc-0.") || - STRPREFIX(def->os.machine, "pc-1.") || - STRPREFIX(def->os.machine, "pc-i440") || - STRPREFIX(def->os.machine, "rhel")); -} - - static int qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def, virQEMUCapsPtr qemuCaps, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1368386..506c0af 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3082,3 +3082,22 @@ qemuDomainSupportsBlockJobs(virDomainObjPtr vm, return 0; } + + +bool +qemuDomainMachineIsQ35(const virDomainDef *def) +{ + return (STRPREFIX(def->os.machine, "pc-q35") || + STREQ(def->os.machine, "q35")); +} + + +bool +qemuDomainMachineIsI440FX(const virDomainDef *def) +{ + return (STREQ(def->os.machine, "pc") || + STRPREFIX(def->os.machine, "pc-0.") || + STRPREFIX(def->os.machine, "pc-1.") || + STRPREFIX(def->os.machine, "pc-i440") || + STRPREFIX(def->os.machine, "rhel")); +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 6bea7c7..d68e41b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -431,4 +431,7 @@ void qemuDomObjEndAPI(virDomainObjPtr *vm); int qemuDomainAlignMemorySizes(virDomainDefPtr def); void qemuDomainMemoryDeviceAlignSize(virDomainMemoryDefPtr mem); +bool qemuDomainMachineIsQ35(const virDomainDef *def); +bool qemuDomainMachineIsI440FX(const virDomainDef *def); + #endif /* __QEMU_DOMAIN_H__ */ -- 2.1.0

On Tue, Apr 21, 2015 at 01:57:39PM +0200, Marc-André Lureau wrote:
The vmport machine argument works with pc machine kind, not with xen for example. --- src/qemu/qemu_capabilities.c | 13 +++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_command.c | 19 ------------------- src/qemu/qemu_domain.c | 19 +++++++++++++++++++ src/qemu/qemu_domain.h | 3 +++ 5 files changed, 38 insertions(+), 19 deletions(-)
This one's not directly applicable, but trivial enough that it doesn't cause any problems. I'd rather move the domain functions in another patch, though. That way it's clearly separated.
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ca26855..607b6d5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3725,6 +3725,19 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
bool +virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, + const virDomainDef *def) +{ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT)) + return false; + + return qemuDomainMachineIsI440FX(def) || + qemuDomainMachineIsQ35(def) || + STREQ(def->os.machine, "isapc"); +} + + +bool virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps, const char *canonical_machine) { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 48c8f96..81557b7 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -263,6 +263,9 @@ bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps, bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps, virDomainDefPtr def);
+bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps, + const virDomainDef *def); + char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps);
const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 29b876e..f25a75f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1954,25 +1954,6 @@ qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def, }
-static bool -qemuDomainMachineIsQ35(virDomainDefPtr def) -{ - return (STRPREFIX(def->os.machine, "pc-q35") || - STREQ(def->os.machine, "q35")); -} - - -static bool -qemuDomainMachineIsI440FX(virDomainDefPtr def) -{ - return (STREQ(def->os.machine, "pc") || - STRPREFIX(def->os.machine, "pc-0.") || - STRPREFIX(def->os.machine, "pc-1.") || - STRPREFIX(def->os.machine, "pc-i440") || - STRPREFIX(def->os.machine, "rhel")); -} - - static int qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def, virQEMUCapsPtr qemuCaps, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1368386..506c0af 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3082,3 +3082,22 @@ qemuDomainSupportsBlockJobs(virDomainObjPtr vm,
return 0; } + + +bool +qemuDomainMachineIsQ35(const virDomainDef *def) +{ + return (STRPREFIX(def->os.machine, "pc-q35") || + STREQ(def->os.machine, "q35")); +} + + +bool +qemuDomainMachineIsI440FX(const virDomainDef *def) +{ + return (STREQ(def->os.machine, "pc") || + STRPREFIX(def->os.machine, "pc-0.") || + STRPREFIX(def->os.machine, "pc-1.") || + STRPREFIX(def->os.machine, "pc-i440") || + STRPREFIX(def->os.machine, "rhel")); +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 6bea7c7..d68e41b 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -431,4 +431,7 @@ void qemuDomObjEndAPI(virDomainObjPtr *vm); int qemuDomainAlignMemorySizes(virDomainDefPtr def); void qemuDomainMemoryDeviceAlignSize(virDomainMemoryDefPtr mem);
+bool qemuDomainMachineIsQ35(const virDomainDef *def); +bool qemuDomainMachineIsI440FX(const virDomainDef *def); + #endif /* __QEMU_DOMAIN_H__ */ -- 2.1.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Fill qemu command line vmport argument as required. --- src/qemu/qemu_command.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f25a75f..7304d90 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7294,6 +7294,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd, obsoleteAccel = true; } else { virBuffer buf = VIR_BUFFER_INITIALIZER; + virTristateSwitch vmport = def->features[VIR_DOMAIN_FEATURE_VMPORT]; virCommandAddArg(cmd, "-machine"); virBufferAdd(&buf, def->os.machine, -1); @@ -7311,6 +7312,19 @@ qemuBuildMachineArgStr(virCommandPtr cmd, if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT)) virBufferAddLit(&buf, ",usb=off"); + if (vmport) { + if (!virQEMUCapsSupportsVmport(qemuCaps, def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vmport is not available " + "with this QEMU binary")); + virBufferFreeAndReset(&buf); + return -1; + } + + virBufferAsprintf(&buf, ",vmport=%s", + virTristateSwitchTypeToString(vmport)); + } + if (def->mem.dump_core) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", -- 2.1.0

Check that the vmport feature is correctly used in qemu commande line. --- .../qemuxml2argv-machine-vmport-opt.args | 6 +++++ .../qemuxml2argv-machine-vmport-opt.xml | 28 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args new file mode 100644 index 0000000..ea1a11f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-S -machine pc,accel=tcg,vmport=off -m 214 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /dev/HostVG/QEMUGuest1 -net none -serial \ +none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml new file mode 100644 index 0000000..671d3a9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <vmport state='off'/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index acd6126..299d0af 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -607,6 +607,8 @@ mymain(void) DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT); DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_USB_OPT); + DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_VMPORT_OPT); DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT); DO_TEST("boot-cdrom", NONE); DO_TEST("boot-network", NONE); -- 2.1.0

On Tue, Apr 21, 2015 at 01:57:41PM +0200, Marc-André Lureau wrote:
Check that the vmport feature is correctly used in qemu commande line. --- .../qemuxml2argv-machine-vmport-opt.args | 6 +++++ .../qemuxml2argv-machine-vmport-opt.xml | 28 ++++++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 3 files changed, 36 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml
It would be nice if the different machine type had a failing test as well, but that's not a hard requisite from my side.
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args new file mode 100644 index 0000000..ea1a11f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-S -machine pc,accel=tcg,vmport=off -m 214 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /dev/HostVG/QEMUGuest1 -net none -serial \ +none -parallel none diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml new file mode 100644 index 0000000..671d3a9 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml @@ -0,0 +1,28 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>219100</memory> + <currentMemory unit='KiB'>219100</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <vmport state='off'/> + </features> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='block' device='disk'> + <source dev='/dev/HostVG/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index acd6126..299d0af 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -607,6 +607,8 @@ mymain(void) DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT); DO_TEST("machine-usb-opt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_USB_OPT); + DO_TEST("machine-vmport-opt", QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_VMPORT_OPT); DO_TEST("kvm", QEMU_CAPS_MACHINE_OPT); DO_TEST("boot-cdrom", NONE); DO_TEST("boot-network", NONE); -- 2.1.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

ping On Tue, Apr 21, 2015 at 1:57 PM, Marc-André Lureau < marcandre.lureau@gmail.com> wrote:
Hi,
The QEMU machine vmport option allows to set the VMWare IO port emulation. This emulation is useful for absolute pointer input when the guest has vmware input drivers, and is enabled by default for kvm.
However it is unnecessary for Spice-enabled VM, since the agent already handles absolute pointer and multi-monitors. Furthermore, it prevents Spice from switching to relative input since the regular ps/2 pointer driver is replaced by the vmware driver. It is thus advised to disable vmport when using a Spice VM. This will permit the Spice client to switch from absolute to relative pointer, as it may be required for certain games or applications.
The following patch series allows to configure the vmport feature.
v2: - use a feature instead of a domain attribute, suggested by D. Berrange v3: - use qmp query for caps instead of version v4: - use vesion check & qmp, add runtime check for machine kind
Marc-André Lureau (6): docs: add domain vmport feature domain/conf: add VIR_DOMAIN_FEATURE_VMPORT qemu: add QEMU_CAPS_MACHINE_VMPORT_OPT qemu: add virQEMUCapsSupportsVmport qemu: add machine vmport argument tests: add machine-vmport-opt qemu test
docs/formatdomain.html.in | 6 ++++ docs/schemas/domaincommon.rng | 9 ++++++ src/conf/domain_conf.c | 5 +++- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 20 +++++++++++++ src/qemu/qemu_capabilities.h | 4 +++ src/qemu/qemu_command.c | 33 +++++++++------------- src/qemu/qemu_domain.c | 19 +++++++++++++ src/qemu/qemu_domain.h | 3 ++ .../qemuxml2argv-machine-vmport-opt.args | 6 ++++ .../qemuxml2argv-machine-vmport-opt.xml | 28 ++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 12 files changed, 116 insertions(+), 20 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml
-- 2.1.0
-- Marc-André Lureau

On Tue, Apr 21, 2015 at 01:57:35PM +0200, Marc-André Lureau wrote:
Hi,
The QEMU machine vmport option allows to set the VMWare IO port emulation. This emulation is useful for absolute pointer input when the guest has vmware input drivers, and is enabled by default for kvm.
However it is unnecessary for Spice-enabled VM, since the agent already handles absolute pointer and multi-monitors. Furthermore, it prevents Spice from switching to relative input since the regular ps/2 pointer driver is replaced by the vmware driver. It is thus advised to disable vmport when using a Spice VM. This will permit the Spice client to switch from absolute to relative pointer, as it may be required for certain games or applications.
The following patch series allows to configure the vmport feature.
v2: - use a feature instead of a domain attribute, suggested by D. Berrange v3: - use qmp query for caps instead of version v4: - use vesion check & qmp, add runtime check for machine kind
ACK series with two things to consider mentioned in-line (not hard requirements, but it would be nice to have).

Hi Martin On Mon, Apr 27, 2015 at 4:20 PM, Martin Kletzander <mkletzan@redhat.com> wrote:
ACK series with two things to consider mentioned in-line (not hard requirements, but it would be nice to have).
It seems we missed 1.2.15, so I updated doc comment about version availability, and I addressed your comments too. I guess I'll re-send it after the freeze.. -- Marc-André Lureau

On Tue, Apr 28, 2015 at 11:28:38AM +0200, Marc-André Lureau wrote:
Hi Martin
On Mon, Apr 27, 2015 at 4:20 PM, Martin Kletzander <mkletzan@redhat.com> wrote:
ACK series with two things to consider mentioned in-line (not hard requirements, but it would be nice to have).
It seems we missed 1.2.15, so I updated doc comment about version availability, and I addressed your comments too. I guess I'll re-send it after the freeze..
I thought I've made it in, and we could say this was already sent before, but if you're not in a rush for this, It would be nice to push it after the release. No need to resend, though.
participants (2)
-
Marc-André Lureau
-
Martin Kletzander