[libvirt] [Patch]: spice agent-mouse support

Signed-off-by: Zhou Peng <zhoupeng@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

On 03/01/2012 11:54 AM, Zhou Peng wrote:
Signed-off-by: Zhou Peng<zhoupeng@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

On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
spice agent-mouse support
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'>
Rather than adding an attribute 'agentmouse' I think it'd be preferrable to use a sub-element: <agent mouse='on|off'/> that way if we have more configuration related to the agent we have a nice place to put it 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 :|

On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
spice agent-mouse support
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'>
Rather than adding an attribute 'agentmouse' I think it'd be preferrable to use a sub-element:
<agent mouse='on|off'/>
that way if we have more configuration related to the agent we have a nice place to put it
Thanks for your review. Based on qemu's argv, agent-mouse is used as one of -spice option's arg, which specifys spice to use agent, but doesn't describe agent itself. It' consistent with qemu's argv. And there is no separated agent like option for qemu argv. I think, If there is separated agent like option for qemu in the future, we can add agent sub-element directly to describe the agent itself, which does't conflict. -- Zhou Peng

On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
spice agent-mouse support
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'>
Rather than adding an attribute 'agentmouse' I think it'd be preferrable to use a sub-element:
<agent mouse='on|off'/>
that way if we have more configuration related to the agent we have a nice place to put it I take note of the implemented clipboard sub-element.. spice clipboard use agent too to implement copypaste like agentmouse. I realize your idea to separate is great in the long run and agree with you to use another sub-emement to describe, But I'm sorry I still don't agree with you to use <agent mouse='on|off'/>
How about this way pls: <graphics type='spice' > <mouse mode='client|server'> ... <clipboard copypaste='yes|no'/> </graphics> Refering to qemu-spice's implement: There are two mouse modes at the moment that is SPICE_MOUSE_MODE_SERVER and SPICE_MOUSE_MODE_CLIENT Currently 'agent-mouse=on' equal to 'SPICE_MOUSE_MODE_CLIENT' 'agent-mouse=off' equal to 'SPICE_MOUSE_MODE_SERVER' -- Zhou Peng

On Fri, Mar 02, 2012 at 09:06:20AM +0800, Zhou Peng wrote:
On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
spice agent-mouse support
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'>
Rather than adding an attribute 'agentmouse' I think it'd be preferrable to use a sub-element:
<agent mouse='on|off'/>
that way if we have more configuration related to the agent we have a nice place to put it I take note of the implemented clipboard sub-element.. spice clipboard use agent too to implement copypaste like agentmouse. I realize your idea to separate is great in the long run and agree with you to use another sub-emement to describe, But I'm sorry I still don't agree with you to use <agent mouse='on|off'/>
How about this way pls: <graphics type='spice' > <mouse mode='client|server'>
Yes this looks fine to me.
... <clipboard copypaste='yes|no'/> </graphics>
Refering to qemu-spice's implement: There are two mouse modes at the moment that is SPICE_MOUSE_MODE_SERVER and SPICE_MOUSE_MODE_CLIENT Currently 'agent-mouse=on' equal to 'SPICE_MOUSE_MODE_CLIENT' 'agent-mouse=off' equal to 'SPICE_MOUSE_MODE_SERVER'
Yes, your idea makes sense in this context 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 :|

On Fri, Mar 2, 2012 at 5:58 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Fri, Mar 02, 2012 at 09:06:20AM +0800, Zhou Peng wrote:
On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange <berrange@redhat.com> wrote:
On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>
spice agent-mouse support
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'>
Rather than adding an attribute 'agentmouse' I think it'd be preferrable to use a sub-element:
<agent mouse='on|off'/>
that way if we have more configuration related to the agent we have a nice place to put it I take note of the implemented clipboard sub-element.. spice clipboard use agent too to implement copypaste like agentmouse. I realize your idea to separate is great in the long run and agree with you to use another sub-emement to describe, But I'm sorry I still don't agree with you to use <agent mouse='on|off'/>
How about this way pls: <graphics type='spice' > <mouse mode='client|server'>
Yes this looks fine to me.
OK, I will resend a new version patch after this weekend. Thanks Daniel. -- Zhou Peng
participants (3)
-
Daniel P. Berrange
-
Osier Yang
-
Zhou Peng