On 03/01/2012 11:54 AM, Zhou Peng wrote:
Signed-off-by: Zhou Peng<zhoupeng(a)nfs.iscas.ac.cn>
spice agent-mouse support
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..79d5ac9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -852,6 +852,7 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
break;
case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
+ VIR_FREE(def->data.spice.agentmouse);
VIR_FREE(def->data.spice.keymap);
virDomainGraphicsAuthDefClear(&def->data.spice.auth);
break;
@@ -5543,6 +5544,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
VIR_FREE(autoport);
}
+ def->data.spice.agentmouse = virXMLPropString(node, "agentmouse");
+
def->data.spice.keymap = virXMLPropString(node, "keymap");
if (virDomainGraphicsAuthDefParseXML(node,&def->data.spice.auth,
@@ -11364,6 +11367,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (listenAddr)
virBufferAsprintf(buf, " listen='%s'", listenAddr);
+ if (def->data.spice.agentmouse)
+ virBufferEscapeString(buf, " agentmouse='%s'",
+ def->data.spice.agentmouse);
+
if (def->data.spice.keymap)
virBufferEscapeString(buf, " keymap='%s'",
def->data.spice.keymap);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..e55995c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1072,6 +1072,7 @@ struct _virDomainGraphicsDef {
struct {
int port;
int tlsPort;
+ char *agentmouse;
char *keymap;
virDomainGraphicsAuthDef auth;
unsigned int autoport :1;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01adf0d..531ecbe 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5391,6 +5391,10 @@ qemuBuildCommandLine(virConnectPtr conn,
VIR_FREE(netAddr);
+ if (def->graphics[0]->data.spice.agentmouse)
+ virBufferAsprintf(&opt, ",agent-mouse=%s",
+ def->graphics[0]->data.spice.agentmouse);
+
/* In the password case we set it via monitor command, to avoid
* making it visible on CLI, so there's no use of password=XXX
* in this bit of the code */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
index 681f7c2..746c116 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.args
@@ -5,5 +5,5 @@ virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa -hda \
/dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent -device \
virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0\
,name=com.redhat.spice.0 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
-x509-dir=/etc/pki/libvirt-spice,tls-channel=main -device \
+agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main -device \
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
index 6505b55..266a4ed 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-spicevmc.xml
@@ -23,7 +23,7 @@
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x0a'
function='0x0'/>
</controller>
-<graphics type='spice' port='5903' tlsPort='5904'
autoport='no'
listen='127.0.0.1'>
+<graphics type='spice' port='5903' tlsPort='5904'
autoport='no'
listen='127.0.0.1' agentmouse='off'>
<channel name='main' mode='secure'/>
</graphics>
<channel type='spicevmc'>
--
Zhou Peng
Docmentation && XML schema is necessay, you have to update
docs/formatdomain.html.in and docs/schemas/domaincommon.rng.
Aslo you have to make sure the value for "agentmouse" is
valid ("on|off").
And the new test only tests "agentmouse=off", there should
be one for "agentmount=on" too.
If qemu didn't always support "agentmouse", you have to detect
if qemu supports it, and error out if it's not supported.
Commit 5edfcaae6f7ebb could serve as an example for you.
Osier