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

2012-03-09 Thread Zhou Peng
On Fri, Mar 9, 2012 at 3:29 PM, Osier Yang jy...@redhat.com wrote:
 Pushed with the attached diff squashed in. You are added
 in the contributors list now, please let me known if you'd
 like another name. Thanks for the patch!

It's ok.
Thank you.

-- 
Zhou Peng

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


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

2012-03-08 Thread Osier Yang

On 2012年03月07日 19:57, Zhou Peng wrote:

Sorry my git send-email failed to the list :-(

Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn

spice agent-mouse support

Usage:
graphics type='spice'
   mouse mode='client'|'server'/
graphics/



Pushed with the attached diff squashed in. You are added
in the contributors list now, please let me known if you'd
like another name. Thanks for the patch!

Regards,
Osier

diff --git a/AUTHORS b/AUTHORS
index 954fd1a..e4bd51d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -224,6 +224,7 @@ Patches have also been contributed by:
   Peter Robinson   pbrobin...@gmail.com
   Benjamin Camaben...@dolka.fr
   Duncan Rance libv...@dunquino.com
+  Peng Zhouailvpen...@gmail.com
 
   [send patches to get your name here]
 
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d8ced3a..bf0675e 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2851,6 +2851,7 @@ qemu-kvm -net nic,model=? /dev/null
 lt;image compression='auto_glz'/gt;
 lt;streaming mode='filter'/gt;
 lt;clipboard copypaste='no'/gt;
+lt;mouse mode='client'/gt;
   lt;/graphicsgt;/pre
 p
   Spice supports variable compression settings for audio,
@@ -2888,7 +2889,7 @@ qemu-kvm -net nic,model=? /dev/null
   setting it's codemodecode/ attribute to one of
   codeserver/code or codeclient/code ,
   span class=sincesince 0.9.11/span. If no mode is
-  specified, the spice default will be used (client mode).
+  specified, the qemu default will be used (client mode).
 /p
   /dd
   dtcoderdp/code/dt
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2238558..d7ec221 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -253,8 +253,6 @@ virDomainChrDefFree;
 virDomainChrDefNew;
 virDomainChrSourceDefCopy;
 virDomainChrSourceDefFree;
-virDomainGraphicsSpiceMouseModeTypeFromString;
-virDomainGraphicsSpiceMouseModeTypeToString;
 virDomainChrSpicevmcTypeFromString;
 virDomainChrSpicevmcTypeToString;
 virDomainChrTcpProtocolTypeFromString;
@@ -347,6 +345,8 @@ virDomainGraphicsSpiceImageCompressionTypeFromString;
 virDomainGraphicsSpiceImageCompressionTypeToString;
 virDomainGraphicsSpiceJpegCompressionTypeFromString;
 virDomainGraphicsSpiceJpegCompressionTypeToString;
+virDomainGraphicsSpiceMouseModeTypeFromString;
+virDomainGraphicsSpiceMouseModeTypeToString;
 virDomainGraphicsSpicePlaybackCompressionTypeFromString;
 virDomainGraphicsSpicePlaybackCompressionTypeToString;
 virDomainGraphicsSpiceStreamingModeTypeFromString;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
new file mode 100644
index 000..2c3ef06
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
@@ -0,0 +1,8 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device 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,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-spice-agentmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml
similarity index 100%
rename from tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml
rename to tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args
deleted file mode 100644
index 746c116..000
--- a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args
+++ /dev/null
@@ -1,9 +0,0 @@
-LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
-/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \
--monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device \
-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,\
-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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 0abc9cf..3cfd69c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c

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

2012-03-07 Thread Zhou Peng
Sorry my git send-email failed to the list :-(

Signed-off-by: Zhou Peng zhoup...@nfs.iscas.ac.cn

spice agent-mouse support

Usage:
graphics type='spice'
  mouse mode='client'|'server'/
graphics/


diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fcca94..b63f6a0 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2809,6 +2809,13 @@ qemu-kvm -net nic,model=? /dev/null
   to codeno/code, span class=sincesince
   0.9.3/span.
 /p
+p
+  Mouse mode is set by the codemousecode/ element,
+  setting it's codemodecode/ attribute to one of
+  codeserver/code or codeclient/code ,
+  span class=sincesince 0.9.11/span. If no mode is
+  specified, the spice default will be used (client mode).
+/p
   /dd
   dtcoderdp/code/dt
   dd
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..bb0df03 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1776,6 +1776,17 @@
 empty/
   /element
 /optional
+optional
+  element name=mouse
+attribute name=mode
+  choice
+valueserver/value
+valueclient/value
+  /choice
+/attribute
+empty/
+  /element
+/optional
   /interleave
 /group
 group
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..aa31fe6 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
   on,
   off);

+VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
+  VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
+  default,
+  server,
+  client);
+
 VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
   VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
   default,
@@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 VIR_FREE(copypaste);

 def-data.spice.copypaste = copypasteVal;
+} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) {
+const char *mode = virXMLPropString(cur, mode);
+int modeVal;
+
+if (!mode) {
+virDomainReportError(VIR_ERR_XML_ERROR, %s,
+ _(spice mouse missing mode));
+goto error;
+}
+
+if ((modeVal =
virDomainGraphicsSpiceMouseModeTypeFromString(mode)) = 0) {
+virDomainReportError(VIR_ERR_XML_ERROR,
+ _(unknown mouse mode
value '%s'),
+ mode);
+VIR_FREE(mode);
+goto error;
+}
+VIR_FREE(mode);
+
+def-data.spice.mousemode = modeVal;
 }
 }
 cur = cur-next;
@@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 }
 if (!children  (def-data.spice.image || def-data.spice.jpeg ||
   def-data.spice.zlib || def-data.spice.playback ||
-  def-data.spice.streaming ||
def-data.spice.copypaste)) {
+  def-data.spice.streaming ||
def-data.spice.copypaste ||
+  def-data.spice.mousemode)) {
 virBufferAddLit(buf, \n);
 children = 1;
 }
@@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 if (def-data.spice.streaming)
 virBufferAsprintf(buf,   streaming mode='%s'/\n,

virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming));
+if (def-data.spice.mousemode)
+virBufferAsprintf(buf,   mouse mode='%s'/\n,
+
virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode));
 if (def-data.spice.copypaste)
 virBufferAsprintf(buf,   clipboard copypaste='%s'/\n,

virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..a9c118a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression {
 VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
 };

+enum virDomainGraphicsSpiceMouseMode {
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
+
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
+};
+
 enum 

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

2012-03-06 Thread Osier Yang

On 2012年03月05日 16:17, Zhou Peng wrote:

Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn

spice agent-mouse support

Usage:
graphics type='spice'
   mouse mode='client'|'server'/
graphics/

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fcca94..0adf859 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null
tocodeno/code,span class=sincesince
0.9.3/span.
  /p
+p
+  It can be specified whether client or server mouse mode
+  to use for spice. The default is client which enables
+  passing mouse events via Spice agent.


Not true from the codes, (no default value is set for mode). And
think above lines can be omitted. It's duplicate with below
somehow. Below is enough.


+  The mouse mode is set by thecodemousecode/  element,
+  setting it'scodemodecode/  attribute to one of
+codeserver/code  orcodeclient/code.


Better to document since which release the element is introduced.
e.g. span class=since0.9.11/span


+/p
/dd
dtcoderdp/code/dt
dd
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..bb0df03 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1776,6 +1776,17 @@
  empty/
/element
  /optional
+optional
+element name=mouse
+attribute name=mode
+choice
+valueserver/value
+valueclient/value
+/choice
+/attribute
+empty/
+/element
+/optional
/interleave
  /group
  group
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..b99e770 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
on,
off);

+VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
+  VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
+  default,
+  server,
+  client);
+
  VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
default,
@@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
  VIR_FREE(copypaste);

  def-data.spice.copypaste = copypasteVal;
+} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) {
+const char *mode = virXMLPropString(cur, mode);
+int modeVal;
+
+if (!mode) {
+virDomainReportError(VIR_ERR_XML_ERROR, %s,
+ _(spice mouse missing mode));
+goto error;
+}
+
+if ((modeVal =
+
virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) {
+virDomainReportError(VIR_ERR_INTERNAL_ERROR,


s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/


+ _(unknown mouse mode value
'%s'), mode);
+VIR_FREE(mode);
+goto error;
+}
+VIR_FREE(mode);
+
+def-data.spice.mousemode = modeVal;
  }
  }
  cur = cur-next;
@@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
  }
  if (!children  (def-data.spice.image || def-data.spice.jpeg ||
def-data.spice.zlib || def-data.spice.playback ||
-  def-data.spice.streaming ||
def-data.spice.copypaste)) {
+  def-data.spice.streaming ||
def-data.spice.copypaste ||
+  def-data.spice.mousemode)) {
  virBufferAddLit(buf, \n);
  children = 1;
  }
@@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
  if (def-data.spice.streaming)
  virBufferAsprintf(buf, streaming mode='%s'/\n,

virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming));
+if (def-data.spice.mousemode)
+virBufferAsprintf(buf, mouse mode='%s'/\n,
+
virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode));
  if (def-data.spice.copypaste)
  virBufferAsprintf(buf, clipboard copypaste='%s'/\n,

virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..a9c118a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression {
  VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
  };

+enum virDomainGraphicsSpiceMouseMode {
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
+

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

2012-03-06 Thread Zhou Peng
On Tue, Mar 6, 2012 at 10:08 PM, Osier Yang jy...@redhat.com wrote:
 On 2012年03月05日 16:17, Zhou Peng wrote:

 Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn

 spice agent-mouse support

 Usage:
 graphics type='spice'
   mouse mode='client'|'server'/
 graphics/

 diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
 index 6fcca94..0adf859 100644
 --- a/docs/formatdomain.html.in
 +++ b/docs/formatdomain.html.in
 @@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null
                tocodeno/code,span class=sincesince
                0.9.3/span.
              /p
 +p
 +              It can be specified whether client or server mouse mode
 +              to use for spice. The default is client which enables
 +              passing mouse events via Spice agent.


 Not true from the codes, (no default value is set for mode). And
It's qemu spice's default. That is, if mouse mode is not specified in qemu argv.
Here it's equal to  graphics type='spice' element
without specifying mouse mode=xx/ sub-element.
And IMO passing nothing is consistent and better with qemu
if no mouse sub-elem in vm-xml.

 think above lines can be omitted. It's duplicate with below
 somehow. Below is enough.


 +              The mouse mode is set by thecodemousecode/  element,
 +              setting it'scodemodecode/  attribute to one of
 +codeserver/code  orcodeclient/code.


 Better to document since which release the element is introduced.
 e.g. span class=since0.9.11/span


 +/p
            /dd
            dtcoderdp/code/dt
            dd
 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
 index 3908733..bb0df03 100644
 --- a/docs/schemas/domaincommon.rng
 +++ b/docs/schemas/domaincommon.rng
 @@ -1776,6 +1776,17 @@
                  empty/
                /element
              /optional
 +optional
 +element name=mouse
 +attribute name=mode
 +choice
 +valueserver/value
 +valueclient/value
 +/choice
 +/attribute
 +empty/
 +/element
 +/optional
            /interleave
          /group
          group
 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
 index f9654f1..b99e770 100644
 --- a/src/conf/domain_conf.c
 +++ b/src/conf/domain_conf.c
 @@ -460,6 +460,12 @@
 VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
                on,
                off);

 +VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
 +              VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
 +              default,
 +              server,
 +              client);
 +
  VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
                VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
                default,
 @@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
                      VIR_FREE(copypaste);

                      def-data.spice.copypaste = copypasteVal;
 +                } else if (xmlStrEqual(cur-name, BAD_CAST mouse)) {
 +                    const char *mode = virXMLPropString(cur, mode);
 +                    int modeVal;
 +
 +                    if (!mode) {
 +                        virDomainReportError(VIR_ERR_XML_ERROR, %s,
 +                                             _(spice mouse missing
 mode));
 +                        goto error;
 +                    }
 +
 +                    if ((modeVal =
 +
 virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) {
 +                            virDomainReportError(VIR_ERR_INTERNAL_ERROR,


 s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/

 +                                         _(unknown mouse mode value
 '%s'), mode);
 +                        VIR_FREE(mode);
 +                        goto error;
 +                    }
 +                    VIR_FREE(mode);
 +
 +                    def-data.spice.mousemode = modeVal;
                  }
              }
              cur = cur-next;
 @@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
          }
          if (!children  (def-data.spice.image || def-data.spice.jpeg
 ||

                            def-data.spice.zlib ||
 def-data.spice.playback ||
 -                          def-data.spice.streaming ||
 def-data.spice.copypaste)) {
 +                          def-data.spice.streaming ||
 def-data.spice.copypaste ||
 +                          def-data.spice.mousemode)) {
              virBufferAddLit(buf, \n);
              children = 1;
          }
 @@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
          if (def-data.spice.streaming)
              virBufferAsprintf(buf, streaming mode='%s'/\n,


 virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming));
 +        if (def-data.spice.mousemode)
 +            virBufferAsprintf(buf, mouse mode='%s'/\n,
 +
 virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode));
          if (def-data.spice.copypaste)
              virBufferAsprintf(buf, clipboard copypaste='%s'/\n,


 virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste));
 diff 

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

2012-03-06 Thread Osier Yang

On 03/07/2012 10:02 AM, Zhou Peng wrote:

On Tue, Mar 6, 2012 at 10:08 PM, Osier Yangjy...@redhat.com  wrote:

On 2012年03月05日 16:17, Zhou Peng wrote:


Signed-off-by: Zhou Pengzhoup...@nfs.iscas.ac.cn

spice agent-mouse support

Usage:
graphics type='spice'
   mouse mode='client'|'server'/
graphics/

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fcca94..0adf859 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null
tocodeno/code,span class=sincesince
0.9.3/span.
  /p
+p
+  It can be specified whether client or server mouse mode
+  to use for spice. The default is client which enables
+  passing mouse events via Spice agent.



Not true from the codes, (no default value is set for mode). And

It's qemu spice's default. That is, if mouse mode is not specified in qemu argv.
Here it's equal tographics type='spice'  element
without specifyingmouse mode=xx/  sub-element.
And IMO passing nothing is consistent and better with qemu
if nomouse  sub-elem in vm-xml.


The new introduced XML will make sense for all hypervisor
drivers, (Note that libvirt is a general lib for kinds of
hypervisor drivers), so you should declare it's only for
qemu if really wants to ducument it. E.g.

snip
If no rom bar is specified, the qemu default will be used
(older versions of qemu used a default of off, while newer
qemus have a default of on).
/snip





think above lines can be omitted. It's duplicate with below
somehow. Below is enough.



+  The mouse mode is set by thecodemousecode/element,
+  setting it'scodemodecode/attribute to one of
+codeserver/codeorcodeclient/code.



Better to document since which release the element is introduced.
e.g.span class=since0.9.11/span



+/p
/dd
dtcoderdp/code/dt
dd
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..bb0df03 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1776,6 +1776,17 @@
  empty/
/element
  /optional
+optional
+element name=mouse
+attribute name=mode
+choice
+valueserver/value
+valueclient/value
+/choice
+/attribute
+empty/
+/element
+/optional
/interleave
  /group
  group
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..b99e770 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -460,6 +460,12 @@
VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
on,
off);

+VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
+  VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
+  default,
+  server,
+  client);
+
  VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
default,
@@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
  VIR_FREE(copypaste);

  def-data.spice.copypaste = copypasteVal;
+} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) {
+const char *mode = virXMLPropString(cur, mode);
+int modeVal;
+
+if (!mode) {
+virDomainReportError(VIR_ERR_XML_ERROR, %s,
+ _(spice mouse missing
mode));
+goto error;
+}
+
+if ((modeVal =
+
virDomainGraphicsSpiceMouseModeTypeFromString(mode))= 0) {
+virDomainReportError(VIR_ERR_INTERNAL_ERROR,



s/VIR_ERR_INTERNAL_ERROR/VIR_ERR_XML_ERROR/


+ _(unknown mouse mode value
'%s'), mode);
+VIR_FREE(mode);
+goto error;
+}
+VIR_FREE(mode);
+
+def-data.spice.mousemode = modeVal;
  }
  }
  cur = cur-next;
@@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
  }
  if (!children(def-data.spice.image || def-data.spice.jpeg
||

def-data.spice.zlib ||
def-data.spice.playback ||
-  def-data.spice.streaming ||
def-data.spice.copypaste)) {
+  def-data.spice.streaming ||
def-data.spice.copypaste ||
+  def-data.spice.mousemode)) {
  virBufferAddLit(buf, \n);
  children = 1;
  }
@@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
  if (def-data.spice.streaming)
  virBufferAsprintf(buf, streaming mode='%s'/\n,


virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming));
+if 

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

2012-03-05 Thread Zhou Peng
Signed-off-by: Zhou Peng zhoup...@nfs.iscas.ac.cn

spice agent-mouse support

Usage:
graphics type='spice'
  mouse mode='client'|'server'/
graphics/

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fcca94..0adf859 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null
   to codeno/code, span class=sincesince
   0.9.3/span.
 /p
+p
+  It can be specified whether client or server mouse mode
+  to use for spice. The default is client which enables
+  passing mouse events via Spice agent.
+  The mouse mode is set by the codemousecode/ element,
+  setting it's codemodecode/ attribute to one of
+  codeserver/code or codeclient/code.
+/p
   /dd
   dtcoderdp/code/dt
   dd
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..bb0df03 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1776,6 +1776,17 @@
 empty/
   /element
 /optional
+optional
+  element name=mouse
+attribute name=mode
+  choice
+valueserver/value
+valueclient/value
+  /choice
+/attribute
+empty/
+  /element
+/optional
   /interleave
 /group
 group
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..b99e770 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
   on,
   off);

+VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
+  VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
+  default,
+  server,
+  client);
+
 VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
   VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
   default,
@@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 VIR_FREE(copypaste);

 def-data.spice.copypaste = copypasteVal;
+} else if (xmlStrEqual(cur-name, BAD_CAST mouse)) {
+const char *mode = virXMLPropString(cur, mode);
+int modeVal;
+
+if (!mode) {
+virDomainReportError(VIR_ERR_XML_ERROR, %s,
+ _(spice mouse missing mode));
+goto error;
+}
+
+if ((modeVal =
+
virDomainGraphicsSpiceMouseModeTypeFromString(mode)) = 0) {
+virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _(unknown mouse mode value
'%s'), mode);
+VIR_FREE(mode);
+goto error;
+}
+VIR_FREE(mode);
+
+def-data.spice.mousemode = modeVal;
 }
 }
 cur = cur-next;
@@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 }
 if (!children  (def-data.spice.image || def-data.spice.jpeg ||
   def-data.spice.zlib || def-data.spice.playback ||
-  def-data.spice.streaming ||
def-data.spice.copypaste)) {
+  def-data.spice.streaming ||
def-data.spice.copypaste ||
+  def-data.spice.mousemode)) {
 virBufferAddLit(buf, \n);
 children = 1;
 }
@@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
 if (def-data.spice.streaming)
 virBufferAsprintf(buf,   streaming mode='%s'/\n,

virDomainGraphicsSpiceStreamingModeTypeToString(def-data.spice.streaming));
+if (def-data.spice.mousemode)
+virBufferAsprintf(buf,   mouse mode='%s'/\n,
+
virDomainGraphicsSpiceMouseModeTypeToString(def-data.spice.mousemode));
 if (def-data.spice.copypaste)
 virBufferAsprintf(buf,   clipboard copypaste='%s'/\n,

virDomainGraphicsSpiceClipboardCopypasteTypeToString(def-data.spice.copypaste));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..a9c118a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression {
 VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
 };

+enum virDomainGraphicsSpiceMouseMode {
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
+
+VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
+};
+
 enum virDomainGraphicsSpiceStreamingMode {
 

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

2012-03-02 Thread Daniel P. Berrange
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 berra...@redhat.com 
 wrote:
  On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
  Signed-off-by: Zhou Peng zhoup...@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='0x' 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 :|

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

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

2012-03-02 Thread Zhou Peng
On Fri, Mar 2, 2012 at 5:58 PM, Daniel P. Berrange berra...@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 berra...@redhat.com 
 wrote:
  On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
  Signed-off-by: Zhou Peng zhoup...@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='0x' 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

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


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

2012-03-01 Thread Daniel P. Berrange
On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
 Signed-off-by: Zhou Peng zhoup...@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='0x' 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 :|

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


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

2012-03-01 Thread Zhou Peng
On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange berra...@redhat.com wrote:
 On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
 Signed-off-by: Zhou Peng zhoup...@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='0x' 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

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


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

2012-03-01 Thread Zhou Peng
On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange berra...@redhat.com wrote:
 On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
 Signed-off-by: Zhou Peng zhoup...@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='0x' 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

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


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

2012-02-29 Thread Zhou Peng
Signed-off-by: Zhou Peng zhoup...@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='0x' 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
Signed-off-by: Zhou Peng zhoup...@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',
+

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

2012-02-29 Thread Osier Yang

On 03/01/2012 11:54 AM, Zhou Peng wrote:

Signed-off-by: Zhou Pengzhoup...@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='0x' 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

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