Re: [libvirt] [PATCH] RFC: Add domain vmport attribute

2015-03-24 Thread Marc-André Lureau
Hi

On Mon, Mar 23, 2015 at 11:42 PM, Daniel P. Berrange
berra...@redhat.com wrote:
 I think we'd normally place this kind of attribute in the
 features/features block rather than here. eg see the
 toggle for turning on/off hyper-v emulation.

Are you suggesting this: vmport state=on/off/? and if it's not
there it would use the default behaviour.


-- 
Marc-André Lureau

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] RFC: Add domain vmport attribute

2015-03-23 Thread Marc-André Lureau
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.
---

PS: the patch could be split in domain+docs+qemu+test

docs/formatdomain.html.in  |  7 +-
 docs/schemas/domaincommon.rng  |  8 +++
 src/conf/domain_conf.c |  9 
 src/conf/domain_conf.h |  1 +
 src/qemu/qemu_capabilities.c   |  6 ++
 src/qemu/qemu_capabilities.h   |  1 +
 src/qemu/qemu_command.c| 13 +++
 .../qemuxml2argv-machine-vmport-opt.args   |  6 ++
 .../qemuxml2argv-machine-vmport-opt.xml| 25 ++
 tests/qemuxml2argvtest.c   |  2 ++
 10 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index be35c82..51d74d1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -124,7 +124,12 @@
 and codemachine/code referring to the machine
 type. The a href=formatcaps.htmlCapabilities XML/a
 provides details on allowed values for
-these. span class=sinceSince 0.0.1/span/dd
+these. span class=sinceSince 0.0.1/span
+The optional codevmport/code attribute (accepted values
+are codeyes/code and codeno/code), sets the
+emulation of VMWare IO port, for vmmouse etc. span
+class=sinceSince 1.2.14/span
+  /dd
   dtcodeloader/code/dt
   ddThe optional codeloader/code tag refers to a firmware blob
 used to assist the domain creation process. It is used by Xen
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index ebd9299..da3c8c0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -339,6 +339,14 @@
   ref name=hvmaarch64/
 /choice
   /optional
+  optional
+attribute name=vmport
+  choice
+valueyes/value
+valueno/value
+  /choice
+/attribute
+  /optional
   valuehvm/value
 /element
   /define
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ae7d8df..d12598b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14218,6 +14218,15 @@ virDomainDefParseXML(xmlDocPtr xml,
 goto error;
 }
 
+tmp = virXPathString(string(./os/type[1]/@vmport), ctxt);
+if (tmp 
+(def-os.vmport = virTristateBoolTypeFromString(tmp)) = 0) {
+virReportError(VIR_ERR_OS_TYPE,
+   _(unknown vmport value: %s), tmp);
+goto error;
+}
+VIR_FREE(tmp);
+
 /*
  * Booting options for different OS types
  *
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9d314fa..4cc2ff7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1767,6 +1767,7 @@ struct _virDomainOSDef {
 char *bootloader;
 char *bootloaderArgs;
 int smbios_mode;
+int vmport; /* enum virTristateBool */
 
 virDomainBIOSDef bios;
 };
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ccf22f0..f5481d3 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 */
 );
 
 
@@ -3239,6 +3241,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
 if (qemuCaps-version = 1003000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT);
 
+/* vmport option is supported v2.2.0 onwards */
+if (qemuCaps-version = 2002000)
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
+
 /* WebSockets were introduced between 1.3.0 and 1.3.1 */
 if (qemuCaps-version = 1003001)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_WEBSOCKET);
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 

Re: [libvirt] [PATCH] RFC: Add domain vmport attribute

2015-03-23 Thread Daniel P. Berrange
On Mon, Mar 23, 2015 at 05:32:30PM +0100, Marc-André Lureau wrote:
 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.


 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml 
 b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml
 new file mode 100644
 index 000..ee796f6
 --- /dev/null
 +++ b/tests/qemuxml2argvdata/qemuxml2argv-machine-vmport-opt.xml
 @@ -0,0 +1,25 @@
 +domain type='qemu'
 +  nameQEMUGuest1/name
 +  uuidc7a5fdbd-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' vmport='no'hvm/type
 +boot dev='hd'/
 +  /os

I think we'd normally place this kind of attribute in the
features/features block rather than here. eg see the
toggle for turning on/off hyper-v emulation.


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list