Re: [libvirt] [PATCHv3 2/2] conf: allow fuzz in XML with cur balloon > max

2012-03-31 Thread Zhou Peng
Thank you!
ACK patch serials

On Sat, Mar 31, 2012 at 11:33 PM, Eric Blake  wrote:
> Commit 1b1402b introduced a regression.  Since older libvirt versions
> would silently round memory up (until the previous patch), but populated
> current memory based on querying the guest, it was possible to have
> dumpxml show cur > max by the amount of the rounding.  For example, if
> a user requested 1048570 KiB memory (just shy of 1GiB), the qemu
> driver would actually run with 1048576 KiB, and libvirt 0.9.10 would
> output a current that was 6KiB larger than the maximum.  Situations
> where this could have an impact include, but are not limited to,
> migration from old to new libvirt, managedsave in old libvirt and
> start in new libvirt, snapshot creation in old libvirt and revert in
> new libvirt - without this patch, the new libvirt would reject the
> VM because of the rounding discrepancy.
>
> Fix things by adding a fuzz factor, and silently clamp current down to
> maximum in that case, rather than failing to reparse XML for an existing
> VM.  From a practical standpoint, this has no user impact: 'virsh
> dumpxml' will continue to query the running guest rather than rely on
> the incoming xml, which will see the currect current value, and even if
> clamping down occurs during parsing, it will be by at most the fuzz
> factor of a megabyte alignment, and rounded back up when passed back to
> the hypervisor.
>
> Meanwhile, we continue to reject cur > max if the difference is beyond
> the fuzz factor of nearest megabyte.  But this is not a real change in
> behavior, since with 0.9.10, even though the parser allowed it, later
> in the processing stream we would reject it at the qemu layer; so
> rejecting it in the parser just moves error detection to a nicer place.
>
> * src/conf/domain_conf.c (virDomainDefParseXML): Don't reject
> existing XML.
> Based on a report by Zhou Peng.
> ---
>
> v3: improve the commit message (no change to the code)
>
>  src/conf/domain_conf.c |   19 +++
>  1 files changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 7ea57b9..c800160 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7769,10 +7769,21 @@ static virDomainDefPtr 
> virDomainDefParseXML(virCapsPtr caps,
>         goto error;
>
>     if (def->mem.cur_balloon > def->mem.max_balloon) {
> -        virDomainReportError(VIR_ERR_XML_ERROR,
> -                             _("current memory '%lluk' exceeds maximum 
> '%lluk'"),
> -                             def->mem.cur_balloon, def->mem.max_balloon);
> -        goto error;
> +        /* Older libvirt could get into this situation due to
> +         * rounding; if the discrepancy is less than 1MiB, we silently
> +         * round down, otherwise we flag the issue.  */
> +        if (VIR_DIV_UP(def->mem.cur_balloon, 1024) >
> +            VIR_DIV_UP(def->mem.max_balloon, 1024)) {
> +            virDomainReportError(VIR_ERR_XML_ERROR,
> +                                 _("current memory '%lluk' exceeds "
> +                                   "maximum '%lluk'"),
> +                                 def->mem.cur_balloon, def->mem.max_balloon);
> +            goto error;
> +        } else {
> +            VIR_DEBUG("Truncating current %lluk to maximum %lluk",
> +                      def->mem.cur_balloon, def->mem.max_balloon);
> +            def->mem.cur_balloon = def->mem.max_balloon;
> +        }
>     } else if (def->mem.cur_balloon == 0) {
>         def->mem.cur_balloon = def->mem.max_balloon;
>     }
> --
> 1.7.7.6
>



-- 
Zhou Peng

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


Re: [libvirt] [PATCHv2 2/2] conf: allow fuzz in XML with cur balloon > max

2012-03-30 Thread Zhou Peng
Thanks for your patch serials.
I think they fix the true bug.

But I have a little doubt on the fuzz allowance, pls have a see
comment in line below.

On Fri, Mar 30, 2012 at 11:56 PM, Eric Blake  wrote:
>
> Commit 1b1402b introduced a regression.  Since older libvirt versions
> would silently round memory up (until the previous patch), but populated
> current memory based on querying the guest, it was possible to have
> current > maximum by the amount of the rounding.  Accept this fuzz
> factor, and silently clamp current down to maximum in that case,
> rather than failing to reparse XML for an existing VM.
>
> * src/conf/domain_conf.c (virDomainDefParseXML): Don't reject
> existing XML.
> Based on a report by Zhou Peng.
> ---
>  src/conf/domain_conf.c       |   19 +++
>  src/qemu/qemu_monitor_json.c |    2 +-
>  2 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4caef6f..7c95920 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7776,10 +7776,21 @@ static virDomainDefPtr 
> virDomainDefParseXML(virCapsPtr caps,
>         goto error;
>
>     if (def->mem.cur_balloon > def->mem.max_balloon) {
> -        virDomainReportError(VIR_ERR_XML_ERROR,
> -                             _("current memory '%lluk' exceeds maximum 
> '%lluk'"),
> -                             def->mem.cur_balloon, def->mem.max_balloon);
> -        goto error;
> +        /* Older libvirt could get into this situation due to
Do you mean to allow the scene:
* The checkpoint( thought invalid by old libvirt) produced by older libvirt
can be thought valid if restored by the patched newer libvirt?
But it will also allow a typo xml.
* Another scene may be live migration between old libvirt
and newer libvirt (pls correct me if err)

If so, I think these scene should be documented or commented here or
in the commit msg explicitly, otherwise this piece of code may confuse many
readers, because I don't think cur_balloon can exceed max_balloon
again after patched
(so if exceed must be typo xml).

> +         * rounding; if the discrepancy is less than 1MiB, we silently
> +         * round down, otherwise we flag the issue.  */
> +        if (VIR_DIV_UP(def->mem.cur_balloon, 1024) >
> +            VIR_DIV_UP(def->mem.max_balloon, 1024)) {
> +            virDomainReportError(VIR_ERR_XML_ERROR,
> +                                 _("current memory '%lluk' exceeds "
> +                                   "maximum '%lluk'"),
> +                                 def->mem.cur_balloon, def->mem.max_balloon);
> +            goto error;
> +        } else {
> +            VIR_DEBUG("Truncating current %lluk to maximum %lluk",
> +                      def->mem.cur_balloon, def->mem.max_balloon);
> +            def->mem.cur_balloon = def->mem.max_balloon;
> +        }
>     } else if (def->mem.cur_balloon == 0) {
>         def->mem.cur_balloon = def->mem.max_balloon;
>     }
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 7093e1d..6d66587 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -2022,7 +2022,7 @@ int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
>  {
>     int ret;
>     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon",
> -                                                     "U:value", ((unsigned 
> long long)newmem)*1024,
> +                                                     "U:value", 
> newmem*1024ULL,
>                                                      NULL);
>     virJSONValuePtr reply = NULL;
>     if (!cmd)
> --
> 1.7.1
>



--
Zhou Peng

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


[libvirt] [PATCH] libvirt:qemu: fix max_balloon less than cur_balloon

2012-03-30 Thread Zhou Peng
In qemuDomainGetXMLDesc, if cur_balloon is bigger than max_balloon,
max_balloon should be updated too, otherwise the currentMemory is
bigger than memory in dumped xml, which will produce invalid
checkpoint by virsh-save.

The bug appears like this below:
$virsh save vm-num foo.ckp
$virsh restore foo.ckp
error: XML error: current memory '824320k' exceeds maximum '824288k'

Signed-off-by: Zhou Peng 
---
 src/qemu/qemu_driver.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0d3b0bd..96d3219 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4485,7 +4485,13 @@ endjob:
 if (err < 0)
 goto cleanup;
 if (err > 0)
+{
 vm->def->mem.cur_balloon = balloon;
+if (balloon > vm->def->mem.max_balloon)
+{
+vm->def->mem.max_balloon = balloon;
+}
+}
 /* err == 0 indicates no balloon support, so ignore it */
 }
 }
-- 
1.7.7.6

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


[libvirt] [PATCH] libvirt:docs: fix typo

2012-03-22 Thread Zhou Peng
---
 docs/formatdomain.html.in |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 4edada3..3a504a1 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2903,8 +2903,8 @@ qemu-kvm -net nic,model=? /dev/null
   0.9.3.
 
 
-  Mouse mode is set by the mouse element,
-  setting it's mode attribute to one of
+  Mouse mode is set by the mouse element,
+  setting it's mode attribute to one of
   server or client ,
   since 0.9.11. If no mode is
   specified, the qemu default will be used (client mode).
-- 
1.7.7.6

--
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-09 Thread Zhou Peng
On Fri, Mar 9, 2012 at 3:29 PM, Osier Yang  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-07 Thread Zhou Peng
Sorry my git send-email failed to the list :-(

Signed-off-by: Zhou Peng 

spice agent-mouse support

Usage:

  



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 no, since
   0.9.3.
 
+
+  Mouse mode is set by the mouse element,
+  setting it's mode attribute to one of
+  server or client ,
+  since 0.9.11. If no mode is
+  specified, the spice default will be used (client mode).
+
   
   "rdp"
   
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 @@
 
   
 
+
+  
+
+  
+server
+client
+  
+
+
+  
+
   
 
 
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, "  \n",

virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
+if (def->data.spice.mousemode)
+virBufferAsprintf(buf, "  \n",
+
virDomainGraphicsSpiceMouseModeTypeToString(def->data.spice.mousemode));
 if (def->data.spice.copypaste)
 virBufferAsprintf(buf, "  \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 {
 VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
 VIR_DOMAIN_GRAPHICS_

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  wrote:
> On 2012年03月05日 16:17, Zhou Peng wrote:
>>
>> Signed-off-by: Zhou Peng
>>
>> spice agent-mouse support
>>
>> Usage:
>> 
>>   
>> 
>>
>> 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
>>                tono,since
>>                0.9.3.
>>              
>> +
>> +              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   element
without specifying  sub-element.
And IMO passing nothing is consistent and better with qemu
if no  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 themouse  element,
>> +              setting it'smode  attribute to one of
>> +server  orclient.
>
>
> Better to document since which release the element is introduced.
> e.g. 0.9.11
>
>
>> +
>>            
>>            "rdp"
>>            
>> 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 @@
>>                  
>>                
>>              
>> +
>> +
>> +
>> +
>> +server
>> +client
>> +
>> +
>> +
>> +
>> +
>>            
>>          
>>          
>> 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 ||
>

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

2012-03-05 Thread Zhou Peng
Signed-off-by: Zhou Peng 

spice agent-mouse support

Usage:

  


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 no, since
   0.9.3.
 
+
+  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 mouse element,
+  setting it's mode attribute to one of
+  server or client.
+
   
   "rdp"
   
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 @@
 
   
 
+
+  
+
+  
+server
+client
+  
+
+
+  
+
   
 
 
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, "  \n",

virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
+if (def->data.spice.mousemode)
+virBufferAsprintf(buf, "  \n",
+
virDomainGraphicsSpiceMouseModeTypeToString(def->data.spice.mousemode));
 if (def->data.spice.copypaste)
 virBufferAsprintf(buf, "  \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 {
 VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
 VIR_DOMAIN_GRAPHICS_

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  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  
>> wrote:
>> > On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
>> >> Signed-off-by: Zhou Peng 
>> >>
>> >> 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 @@
>> >>      
>> >>        > >> function='0x0'/>
>> >>      
>> >> -    > >> listen='127.0.0.1'>
>> >> +    > >> listen='127.0.0.1' agentmouse='off'>
>> >>        
>> >>      
>> >>      
>> >
>> > Rather than adding an attribute 'agentmouse' I think it'd be preferrable
>> > to use a sub-element:
>> >
>> >   
>> >
>> > 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
>> 
>>
>> How about this way pls:
>> 
>>      
>
> 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 Zhou Peng
On Thu, Mar 1, 2012 at 5:32 PM, Daniel P. Berrange  wrote:
> On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
>> Signed-off-by: Zhou Peng 
>>
>> 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 @@
>>      
>>        > function='0x0'/>
>>      
>> -    > listen='127.0.0.1'>
>> +    > listen='127.0.0.1' agentmouse='off'>
>>        
>>      
>>      
>
> Rather than adding an attribute 'agentmouse' I think it'd be preferrable
> to use a sub-element:
>
>   
>
> 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


How about this way pls:

 
 ...
 


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


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  wrote:
> On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
>> Signed-off-by: Zhou Peng 
>>
>> 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 @@
>>      
>>        > function='0x0'/>
>>      
>> -    > listen='127.0.0.1'>
>> +    > listen='127.0.0.1' agentmouse='off'>
>>        
>>      
>>      
>
> Rather than adding an attribute 'agentmouse' I think it'd be preferrable
> to use a sub-element:
>
>   
>
> 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


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

2012-02-29 Thread Zhou Peng
Signed-off-by: Zhou Peng 

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 @@
 
   
 
-    
+    
   
 
 

--
Zhou Peng
Signed-off-by: Zhou Peng 

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)
 virBuff