Ansis Atteka | 1 Mar 2012 01:26

Re: [libvirt] [PATCH] Use the same MAC address that is defined in domain XML for attached-mac field.



On Sat, Feb 18, 2012 at 7:07 PM, Laine Stump <laine <at> laine.org> wrote:
On 02/17/2012 02:51 PM, Ansis Atteka wrote:
>
>
> On Fri, Feb 17, 2012 at 10:55 AM, Laine Stump <laine <at> laine.org
> <mailto:laine <at> laine.org>> wrote:
>
>     On 02/16/2012 06:49 PM, Ansis Atteka wrote:
>     > Currently libvirt sets the attached-mac to altered MAC address
>     that has
>     > first byte set to FE. This patch will change that behavior by
>     using the
>     > original (unaltered) MAC address from the domain XML
>     configuration file.
>
>     Maybe I didn't read thoroughly enough, but I don't see where it
>     changes
>     the behavior - in the cases where previously the first byte was set to
>     0xFE, now you send discourage=true, and in the cases where it didn't,
>     now you send discourage=false.
>
> "discourage" means whether bridge should be discouraged to use the
> newly added
> TAP device's MAC address. Libvirt does that by setting the first MAC
> address byte
> high enough.
>
> And here is how this patch works:
>
>  1. Now in virNetDevTapCreateInBridgePort() function we always pass
>     exactly the same MAC address that was defined in XML.
>  2. If "discourage" flag was set to true, then we create a copy of MAC
>     address and set its first byte to 0xFE
>  3. virNetDevSetMAC() function would use the MAC address that was
>     product of #2
>  4. while virNetDevOpenvswitchAddPort() function would use the
>     original MAC address that was passed in #1 (this code did not need
>     to be changed so most likely that was the reason why you did not
>     notice behavior changes)
>


Right. That's what I missed - all I saw was every occurrence of creating
a temporary mac address with 0xFE in the first byte replaced with adding
"discourage=true" to the args. I didn't notice that
virNetDevOpenvswitchAddPort() takes the macaddr (while
virNetDevBridgeAddPort() doesn't).

But that means that the tap device has been created with an
0xFE-initiated MAC address, and then you attach to the bridge using the
unmodified address. Is the issue that the mac address used during the
attach needs to match the MAC address that will be in the traffic? Do
connections to an openvswitch bridge have an implied MAC filter on them,
such that only that MAC address gets through?

(Also, the only time discourage is false is for libvirt's virtual
network bridges. I'm wondering if they could also use the modified MAC
address for the tap devices - if that was the case we could just always
create the temporary MAC address in virNetDevTapCreateInBridgePort()
(and always set the tap device's mac to that).)
We could get rid of the "discourage" argument if we would pass
virDomainNetDefPtr instead of virNetDevVPortProfilePtr structure to
virNetDevOpenvswitchAddPort() function. This approach would
also eliminate the need to pass MAC address at all to the
virNetDevOpenvswitchAddPort() function making both
APIs for Linux Bridge and OVS bridge more simpler and
similar (and this could eventually lead to abstracted bridge API).

But this would not solve the issue for Domain UUID which we also
would like to set from virNetDevOpenvswitchAddPort() function.
So what about adding pointer in virDomainNetDefPtr structure
to virDomainDefPtr structure?

If you guys are ok with what I am proposing here then I could send
my updated patches for review (one for attached-mac and another
for vm-uuid).


Let's let this sit over the weekend and see if anyone else has a
brilliant idea/insight.

>
>     Is this a precursor to something else? Does openvswitch maybe not need
>     this extremely high MAC address?
>
>
>
>
>     > ---
>     >  src/network/bridge_driver.c |    2 +-
>     >  src/qemu/qemu_command.c     |    5 +----
>     >  src/uml/uml_conf.c          |    5 +----
>     >  src/util/virnetdevtap.c     |   11 ++++++++++-
>     >  src/util/virnetdevtap.h     |    1 +
>     >  5 files changed, 14 insertions(+), 10 deletions(-)
>     >
>     > diff --git a/src/network/bridge_driver.c
>     b/src/network/bridge_driver.c
>     > index 8575d3e..3e1e031 100644
>     > --- a/src/network/bridge_driver.c
>     > +++ b/src/network/bridge_driver.c
>     > <at> <at> -1766,7 +1766,7 <at> <at> networkStartNetworkVirtual(struct
>     network_driver *driver,
>     >          }
>     >          if (virNetDevTapCreateInBridgePort(network->def->bridge,
>     >                                             &macTapIfName,
>     network->def->mac,
>     > -                                           0, false, NULL,
>     NULL) < 0) {
>     > +                                           false, 0, false,
>     NULL, NULL) < 0) {
>     >              VIR_FREE(macTapIfName);
>     >              goto err0;
>     >          }
>     > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>     > index 5a34504..671054c 100644
>     > --- a/src/qemu/qemu_command.c
>     > +++ b/src/qemu/qemu_command.c
>     > <at> <at> -180,7 +180,6 <at> <at> qemuNetworkIfaceConnect(virDomainDefPtr def,
>     >      int tapfd = -1;
>     >      int vnet_hdr = 0;
>     >      bool template_ifname = false;
>     > -    unsigned char tapmac[VIR_MAC_BUFLEN];
>     >      int actualType = virDomainNetGetActualType(net);
>     >
>     >      if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
>     > <at> <at> -244,9 +243,7 <at> <at> qemuNetworkIfaceConnect(virDomainDefPtr def,
>     >          net->model && STREQ(net->model, "virtio"))
>     >          vnet_hdr = 1;
>     >
>     > -    memcpy(tapmac, net->mac, VIR_MAC_BUFLEN);
>     > -    tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev
>     MAC */
>     > -    err = virNetDevTapCreateInBridgePort(brname, &net->ifname,
>     tapmac,
>     > +    err = virNetDevTapCreateInBridgePort(brname, &net->ifname,
>     net->mac, true,
>     >                                           vnet_hdr, true, &tapfd,
>     >
>     virDomainNetGetActualVirtPortProfile(net));
>     >      virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd >= 0);
>     > diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
>     > index dbbbfda..c7b29a0 100644
>     > --- a/src/uml/uml_conf.c
>     > +++ b/src/uml/uml_conf.c
>     > <at> <at> -127,7 +127,6 <at> <at> umlConnectTapDevice(virConnectPtr conn,
>     >                      const char *bridge)
>     >  {
>     >      bool template_ifname = false;
>     > -    unsigned char tapmac[VIR_MAC_BUFLEN];
>     >
>     >      if (!net->ifname ||
>     >          STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
>     > <at> <at> -139,9 +138,7 <at> <at> umlConnectTapDevice(virConnectPtr conn,
>     >          template_ifname = true;
>     >      }
>     >
>     > -    memcpy(tapmac, net->mac, VIR_MAC_BUFLEN);
>     > -    tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev
>     MAC */
>     > -    if (virNetDevTapCreateInBridgePort(bridge, &net->ifname,
>     tapmac,
>     > +    if (virNetDevTapCreateInBridgePort(bridge, &net->ifname,
>     net->mac, true,
>     >                                         0, true, NULL,
>     >
>     virDomainNetGetActualVirtPortProfile(net)) < 0) {
>     >          if (template_ifname)
>     > diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
>     > index 0fce08d..868ba57 100644
>     > --- a/src/util/virnetdevtap.c
>     > +++ b/src/util/virnetdevtap.c
>     > <at> <at> -22,6 +22,7 <at> <at>
>     >
>     >  #include <config.h>
>     >
>     > +#include "virmacaddr.h"
>     >  #include "virnetdevtap.h"
>     >  #include "virnetdev.h"
>     >  #include "virnetdevbridge.h"
>     > <at> <at> -248,6 +249,7 <at> <at> int virNetDevTapDelete(const char *ifname
>     ATTRIBUTE_UNUSED)
>     >   * <at> brname: the bridge name
>     >   * <at> ifname: the interface name (or name template)
>     >   * <at> macaddr: desired MAC address (VIR_MAC_BUFLEN long)
>     > + * <at> discourage: whether bridge should be discouraged from using
>     macaddr
>     >   * <at> vnet_hdr: whether to try enabling IFF_VNET_HDR
>     >   * <at> tapfd: file descriptor return value for the new tap device
>     >   * <at> virtPortProfile: bridge/port specific configuration
>     > <at> <at> -265,11 +267,14 <at> <at> int virNetDevTapDelete(const char *ifname
>     ATTRIBUTE_UNUSED)
>     >  int virNetDevTapCreateInBridgePort(const char *brname,
>     >                                     char **ifname,
>     >                                     const unsigned char *macaddr,
>     > +                                   bool discourage,
>     >                                     int vnet_hdr,
>     >                                     bool up,
>     >                                     int *tapfd,
>     >                                     virNetDevVPortProfilePtr
>     virtPortProfile)
>     >  {
>     > +    unsigned char tapmac[VIR_MAC_BUFLEN];
>     > +
>     >      if (virNetDevTapCreate(ifname, vnet_hdr, tapfd) < 0)
>     >          return -1;
>     >
>     > <at> <at> -279,7 +284,11 <at> <at> int virNetDevTapCreateInBridgePort(const
>     char *brname,
>     >       * seeing the kernel allocate random MAC for the TAP
>     >       * device before we set our static MAC.
>     >       */
>     > -    if (virNetDevSetMAC(*ifname, macaddr) < 0)
>     > +    memcpy(tapmac, macaddr, VIR_MAC_BUFLEN);
>     > +    if (discourage)
>     > +        tapmac[0] = 0xFE; /* Discourage bridge from using TAP
>     dev MAC */
>     > +
>     > +    if (virNetDevSetMAC(*ifname, tapmac) < 0)
>     >          goto error;
>     >
>     >      /* We need to set the interface MTU before adding it
>     > diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
>     > index 918f3dc..fc50e22 100644
>     > --- a/src/util/virnetdevtap.h
>     > +++ b/src/util/virnetdevtap.h
>     > <at> <at> -37,6 +37,7 <at> <at> int virNetDevTapDelete(const char *ifname)
>     >  int virNetDevTapCreateInBridgePort(const char *brname,
>     >                                     char **ifname,
>     >                                     const unsigned char *macaddr,
>     > +                                   bool discourage,
>     >                                     int vnet_hdr,
>     >                                     bool up,
>     >                                     int *tapfd,
>
>     --
>     libvir-list mailing list
>     libvir-list <at> redhat.com <mailto:libvir-list <at> redhat.com>
>     https://www.redhat.com/mailman/listinfo/libvir-list

<div>
<br><br><div class="gmail_quote">On Sat, Feb 18, 2012 at 7:07 PM, Laine Stump <span dir="ltr">&lt;<a href="mailto:laine <at> laine.org">laine <at> laine.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote">
<div class="im">On 02/17/2012 02:51 PM, Ansis Atteka wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Fri, Feb 17, 2012 at 10:55 AM, Laine Stump &lt;<a href="mailto:laine <at> laine.org">laine <at> laine.org</a><br>
</div>
<div class="im">&gt; &lt;mailto:<a href="mailto:laine <at> laine.org">laine <at> laine.org</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt; &nbsp; &nbsp; On 02/16/2012 06:49 PM, Ansis Atteka wrote:<br>
&gt; &nbsp; &nbsp; &gt; Currently libvirt sets the attached-mac to altered MAC address<br>
&gt; &nbsp; &nbsp; that has<br>
&gt; &nbsp; &nbsp; &gt; first byte set to FE. This patch will change that behavior by<br>
&gt; &nbsp; &nbsp; using the<br>
&gt; &nbsp; &nbsp; &gt; original (unaltered) MAC address from the domain XML<br>
&gt; &nbsp; &nbsp; configuration file.<br>
&gt;<br>
&gt; &nbsp; &nbsp; Maybe I didn't read thoroughly enough, but I don't see where it<br>
&gt; &nbsp; &nbsp; changes<br>
&gt; &nbsp; &nbsp; the behavior - in the cases where previously the first byte was set to<br>
&gt; &nbsp; &nbsp; 0xFE, now you send discourage=true, and in the cases where it didn't,<br>
&gt; &nbsp; &nbsp; now you send discourage=false.<br>
&gt;<br>
&gt; "discourage" means whether bridge should be discouraged to use the<br>
&gt; newly added<br>
&gt; TAP device's MAC address. Libvirt does that by setting the first MAC<br>
&gt; address byte<br>
&gt; high enough.<br>
&gt;<br>
&gt; And here is how this patch works:<br>
&gt;<br>
</div>&gt; &nbsp;1. Now in virNetDevTapCreateInBridgePort() function we always pass<br><div class="im">&gt; &nbsp; &nbsp; exactly the same MAC address that was defined in XML.<br>
</div>&gt; &nbsp;2. If "discourage" flag was set to true, then we create a copy of MAC<br><div class="im">&gt; &nbsp; &nbsp; address and set its first byte to 0xFE<br>
</div>&gt; &nbsp;3. virNetDevSetMAC() function would use the MAC address that was<br>
&gt; &nbsp; &nbsp; product of #2<br>
&gt; &nbsp;4. while virNetDevOpenvswitchAddPort() function would use the<br><div class="im">&gt; &nbsp; &nbsp; original MAC address that was passed in #1 (this code did not need<br>
&gt; &nbsp; &nbsp; to be changed so most likely that was the reason why you did not<br>
&gt; &nbsp; &nbsp; notice behavior changes)<br>
&gt;<br><br><br>
</div>Right. That's what I missed - all I saw was every occurrence of creating<br>
a temporary mac address with 0xFE in the first byte replaced with adding<br>
"discourage=true" to the args. I didn't notice that<br>
virNetDevOpenvswitchAddPort() takes the macaddr (while<br>
virNetDevBridgeAddPort() doesn't).<br><br>
But that means that the tap device has been created with an<br>
0xFE-initiated MAC address, and then you attach to the bridge using the<br>
unmodified address. Is the issue that the mac address used during the<br>
attach needs to match the MAC address that will be in the traffic? Do<br>
connections to an openvswitch bridge have an implied MAC filter on them,<br>
such that only that MAC address gets through?<br><br>
(Also, the only time discourage is false is for libvirt's virtual<br>
network bridges. I'm wondering if they could also use the modified MAC<br>
address for the tap devices - if that was the case we could just always<br>
create the temporary MAC address in virNetDevTapCreateInBridgePort()<br>
(and always set the tap device's mac to that).)<br>
</blockquote>
<div>We could get rid of the "discourage" argument if we would pass</div>
<div>virDomainNetDefPtr instead of&nbsp;virNetDevVPortProfilePtr structure to</div>
<div>virNetDevOpenvswitchAddPort() function. This approach&nbsp;would</div>
<div>also&nbsp;eliminate the need to pass MAC address at all&nbsp;to the</div>
<div>virNetDevOpenvswitchAddPort() function making&nbsp;both</div>
<div>APIs for Linux&nbsp;Bridge and&nbsp;OVS bridge more&nbsp;simpler and</div>
<div>similar (and this could eventually lead to abstracted bridge API).</div>
<div><br></div>
<div>But this would not solve the issue for Domain UUID which we also</div>
<div>would like to set from&nbsp;virNetDevOpenvswitchAddPort()&nbsp;function.</div>
<div>So what about adding pointer in virDomainNetDefPtr&nbsp;structure</div>
<div>to&nbsp;virDomainDefPtr structure?</div>
<div><br></div>
<div>If you guys are ok with what I am proposing here then I could send</div>
<div>my updated&nbsp;patches for review (one for attached-mac and another</div>
<div>for&nbsp;vm-uuid).</div>
<div><br></div>
<blockquote class="gmail_quote">
<br>
Let's let this sit over the weekend and see if anyone else has a<br>
brilliant idea/insight.<br><div><div class="h5">
<br>
&gt;<br>
&gt; &nbsp; &nbsp; Is this a precursor to something else? Does openvswitch maybe not need<br>
&gt; &nbsp; &nbsp; this extremely high MAC address?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &gt; ---<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;src/network/bridge_driver.c | &nbsp; &nbsp;2 +-<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;src/qemu/qemu_command.c &nbsp; &nbsp; | &nbsp; &nbsp;5 +----<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;src/uml/uml_conf.c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp;5 +----<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;src/util/virnetdevtap.c &nbsp; &nbsp; | &nbsp; 11 ++++++++++-<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;src/util/virnetdevtap.h &nbsp; &nbsp; | &nbsp; &nbsp;1 +<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;5 files changed, 14 insertions(+), 10 deletions(-)<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; diff --git a/src/network/bridge_driver.c<br>
&gt; &nbsp; &nbsp; b/src/network/bridge_driver.c<br>
&gt; &nbsp; &nbsp; &gt; index 8575d3e..3e1e031 100644<br>
&gt; &nbsp; &nbsp; &gt; --- a/src/network/bridge_driver.c<br>
&gt; &nbsp; &nbsp; &gt; +++ b/src/network/bridge_driver.c<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -1766,7 +1766,7  <at>  <at>  networkStartNetworkVirtual(struct<br>
&gt; &nbsp; &nbsp; network_driver *driver,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (virNetDevTapCreateInBridgePort(network-&gt;def-&gt;bridge,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;macTapIfName,<br>
&gt; &nbsp; &nbsp; network-&gt;def-&gt;mac,<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, false, NULL,<br>
&gt; &nbsp; &nbsp; NULL) &lt; 0) {<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false, 0, false,<br>
&gt; &nbsp; &nbsp; NULL, NULL) &lt; 0) {<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;VIR_FREE(macTapIfName);<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto err0;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; &nbsp; &nbsp; &gt; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c<br>
&gt; &nbsp; &nbsp; &gt; index 5a34504..671054c 100644<br>
&gt; &nbsp; &nbsp; &gt; --- a/src/qemu/qemu_command.c<br>
&gt; &nbsp; &nbsp; &gt; +++ b/src/qemu/qemu_command.c<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -180,7 +180,6  <at>  <at>  qemuNetworkIfaceConnect(virDomainDefPtr def,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;int tapfd = -1;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;int vnet_hdr = 0;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;bool template_ifname = false;<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;unsigned char tapmac[VIR_MAC_BUFLEN];<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;int actualType = virDomainNetGetActualType(net);<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -244,9 +243,7  <at>  <at>  qemuNetworkIfaceConnect(virDomainDefPtr def,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;net-&gt;model &amp;&amp; STREQ(net-&gt;model, "virtio"))<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vnet_hdr = 1;<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;memcpy(tapmac, net-&gt;mac, VIR_MAC_BUFLEN);<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev<br>
&gt; &nbsp; &nbsp; MAC */<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;err = virNetDevTapCreateInBridgePort(brname, &amp;net-&gt;ifname,<br>
&gt; &nbsp; &nbsp; tapmac,<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;err = virNetDevTapCreateInBridgePort(brname, &amp;net-&gt;ifname,<br>
&gt; &nbsp; &nbsp; net-&gt;mac, true,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vnet_hdr, true, &amp;tapfd,<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; virDomainNetGetActualVirtPortProfile(net));<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd &gt;= 0);<br>
&gt; &nbsp; &nbsp; &gt; diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c<br>
&gt; &nbsp; &nbsp; &gt; index dbbbfda..c7b29a0 100644<br>
&gt; &nbsp; &nbsp; &gt; --- a/src/uml/uml_conf.c<br>
&gt; &nbsp; &nbsp; &gt; +++ b/src/uml/uml_conf.c<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -127,7 +127,6  <at>  <at>  umlConnectTapDevice(virConnectPtr conn,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;const char *bridge)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;{<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;bool template_ifname = false;<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;unsigned char tapmac[VIR_MAC_BUFLEN];<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;if (!net-&gt;ifname ||<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;STRPREFIX(net-&gt;ifname, VIR_NET_GENERATED_PREFIX) ||<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -139,9 +138,7  <at>  <at>  umlConnectTapDevice(virConnectPtr conn,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;template_ifname = true;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;}<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;memcpy(tapmac, net-&gt;mac, VIR_MAC_BUFLEN);<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;tapmac[0] = 0xFE; /* Discourage bridge from using TAP dev<br>
&gt; &nbsp; &nbsp; MAC */<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;if (virNetDevTapCreateInBridgePort(bridge, &amp;net-&gt;ifname,<br>
&gt; &nbsp; &nbsp; tapmac,<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;if (virNetDevTapCreateInBridgePort(bridge, &amp;net-&gt;ifname,<br>
&gt; &nbsp; &nbsp; net-&gt;mac, true,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, true, NULL,<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; virDomainNetGetActualVirtPortProfile(net)) &lt; 0) {<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (template_ifname)<br>
&gt; &nbsp; &nbsp; &gt; diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c<br>
&gt; &nbsp; &nbsp; &gt; index 0fce08d..868ba57 100644<br>
&gt; &nbsp; &nbsp; &gt; --- a/src/util/virnetdevtap.c<br>
&gt; &nbsp; &nbsp; &gt; +++ b/src/util/virnetdevtap.c<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -22,6 +22,7  <at>  <at> <br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;#include &lt;config.h&gt;<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; +#include "virmacaddr.h"<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;#include "virnetdevtap.h"<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;#include "virnetdev.h"<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;#include "virnetdevbridge.h"<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -248,6 +249,7  <at>  <at>  int virNetDevTapDelete(const char *ifname<br>
&gt; &nbsp; &nbsp; ATTRIBUTE_UNUSED)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> brname: the bridge name<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> ifname: the interface name (or name template)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> macaddr: desired MAC address (VIR_MAC_BUFLEN long)<br>
&gt; &nbsp; &nbsp; &gt; + *  <at> discourage: whether bridge should be discouraged from using<br>
&gt; &nbsp; &nbsp; macaddr<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> vnet_hdr: whether to try enabling IFF_VNET_HDR<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> tapfd: file descriptor return value for the new tap device<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; *  <at> virtPortProfile: bridge/port specific configuration<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -265,11 +267,14  <at>  <at>  int virNetDevTapDelete(const char *ifname<br>
&gt; &nbsp; &nbsp; ATTRIBUTE_UNUSED)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;int virNetDevTapCreateInBridgePort(const char *brname,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char **ifname,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const unsigned char *macaddr,<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool discourage,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int vnet_hdr,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool up,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int *tapfd,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; virNetDevVPortProfilePtr<br>
&gt; &nbsp; &nbsp; virtPortProfile)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;{<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;unsigned char tapmac[VIR_MAC_BUFLEN];<br>
&gt; &nbsp; &nbsp; &gt; +<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;if (virNetDevTapCreate(ifname, vnet_hdr, tapfd) &lt; 0)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return -1;<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -279,7 +284,11  <at>  <at>  int virNetDevTapCreateInBridgePort(const<br>
&gt; &nbsp; &nbsp; char *brname,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; * seeing the kernel allocate random MAC for the TAP<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; * device before we set our static MAC.<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; */<br>
&gt; &nbsp; &nbsp; &gt; - &nbsp; &nbsp;if (virNetDevSetMAC(*ifname, macaddr) &lt; 0)<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;memcpy(tapmac, macaddr, VIR_MAC_BUFLEN);<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;if (discourage)<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp;tapmac[0] = 0xFE; /* Discourage bridge from using TAP<br>
&gt; &nbsp; &nbsp; dev MAC */<br>
&gt; &nbsp; &nbsp; &gt; +<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp;if (virNetDevSetMAC(*ifname, tapmac) &lt; 0)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto error;<br>
&gt; &nbsp; &nbsp; &gt;<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp;/* We need to set the interface MTU before adding it<br>
&gt; &nbsp; &nbsp; &gt; diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h<br>
&gt; &nbsp; &nbsp; &gt; index 918f3dc..fc50e22 100644<br>
&gt; &nbsp; &nbsp; &gt; --- a/src/util/virnetdevtap.h<br>
&gt; &nbsp; &nbsp; &gt; +++ b/src/util/virnetdevtap.h<br>
&gt; &nbsp; &nbsp; &gt;  <at>  <at>  -37,6 +37,7  <at>  <at>  int virNetDevTapDelete(const char *ifname)<br>
&gt; &nbsp; &nbsp; &gt; &nbsp;int virNetDevTapCreateInBridgePort(const char *brname,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char **ifname,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const unsigned char *macaddr,<br>
&gt; &nbsp; &nbsp; &gt; + &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool discourage,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int vnet_hdr,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool up,<br>
&gt; &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int *tapfd,<br>
&gt;<br>
&gt; &nbsp; &nbsp; --<br>
&gt; &nbsp; &nbsp; libvir-list mailing list<br>
</div></div>&gt; &nbsp; &nbsp; <a href="mailto:libvir-list <at> redhat.com">libvir-list <at> redhat.com</a> &lt;mailto:<a href="mailto:libvir-list <at> redhat.com">libvir-list <at> redhat.com</a>&gt;<br>
&gt; &nbsp; &nbsp; <a href="https://www.redhat.com/mailman/listinfo/libvir-list" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br><div class="HOEnZb"><div class="h5">&gt;<br>
&gt;<br><br>
--<br>
libvir-list mailing list<br><a href="mailto:libvir-list <at> redhat.com">libvir-list <at> redhat.com</a><br><a href="https://www.redhat.com/mailman/listinfo/libvir-list" target="_blank">https://www.redhat.com/mailman/listinfo/libvir-list</a><br>
</div></div>
</blockquote>
</div>
<br>
</div>
Daniel Veillard | 1 Mar 2012 04:14
Picon
Favicon
Gravatar

[libvirt] Important, switch of server for libvirt.org

  I learned yesterday that the lab hosting libvirt.org would
have power cut off for the week-end due to electical maintainance.
I took the opportunity to switch the server to a new box,
and just made the switch to the DNS, it may take up to 8 hours
to propagate though.
  I cut ssh access to the old server 194.199.20.115 and reactivated
all services on the new box 176.31.99.103 . For read only access
nobody should notice the switch, only commiters should notice that
and hopefully they are all sleeping right now :-)

  Grab me on IRC or by email if you notice somethings which doesn't
work right (the search is not setup yet and I need to reaactivate
various crons, but nearly everything should just work (TM))

Daniel

--

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel <at> veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

Zhou Peng | 1 Mar 2012 04:54
Picon

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

Signed-off-by: Zhou Peng <zhoupeng <at> 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
 <at>  <at>  -852,6 +852,7  <at>  <at>  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;
 <at>  <at>  -5543,6 +5544,8  <at>  <at>  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,
 <at>  <at>  -11364,6 +11367,10  <at>  <at>  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
 <at>  <at>  -1072,6 +1072,7  <at>  <at>  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
 <at>  <at>  -5391,6 +5391,10  <at>  <at>  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
 <at>  <at>  -5,5 +5,5  <at>  <at>  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
 <at>  <at>  -23,7 +23,7  <at>  <at> 
     <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
Signed-off-by: Zhou Peng <zhoupeng <at> 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
 <at>  <at>  -852,6 +852,7  <at>  <at>  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;
 <at>  <at>  -5543,6 +5544,8  <at>  <at>  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,
 <at>  <at>  -11364,6 +11367,10  <at>  <at>  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
 <at>  <at>  -1072,6 +1072,7  <at>  <at>  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
 <at>  <at>  -5391,6 +5391,10  <at>  <at>  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
 <at>  <at>  -5,5 +5,5  <at>  <at>  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
 <at>  <at>  -23,7 +23,7  <at>  <at> 
     <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
Zeeshan Ali (Khattak | 1 Mar 2012 04:56
Picon

[libvirt] [libvirt-glib] Remove now redundant 'path' property

From: "Zeeshan Ali (Khattak)" <zeeshanak <at> gnome.org>

Remove now redundant 'path' property from GVirDomainDevice subclasses.
These classes now have access to their configurations, from which they
can easily get the path (among other properties) internally.
---
 libvirt-gobject/libvirt-gobject-domain-disk.c      |   84 ++++---------------
 libvirt-gobject/libvirt-gobject-domain-interface.c |   85 ++++---------------
 2 files changed, 36 insertions(+), 133 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-domain-disk.c b/libvirt-gobject/libvirt-gobject-domain-disk.c
index fb7672e..0a1493a 100644
--- a/libvirt-gobject/libvirt-gobject-domain-disk.c
+++ b/libvirt-gobject/libvirt-gobject-domain-disk.c
 <at>  <at>  -36,73 +36,25  <at>  <at> 

 struct _GVirDomainDiskPrivate
 {
-    gchar *path;
+    gboolean unused;
 };

 G_DEFINE_TYPE(GVirDomainDisk, gvir_domain_disk, GVIR_TYPE_DOMAIN_DEVICE);

-enum {
-    PROP_0,
-    PROP_PATH,
-};
-
 #define GVIR_DOMAIN_DISK_ERROR gvir_domain_disk_error_quark()

-
 static GQuark
 gvir_domain_disk_error_quark(void)
 {
     return g_quark_from_static_string("gvir-domain-disk");
 }

-static void gvir_domain_disk_get_property(GObject *object,
-                                          guint prop_id,
-                                          GValue *value,
-                                          GParamSpec *pspec)
-{
-    GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
-    GVirDomainDiskPrivate *priv = self->priv;
-
-    switch (prop_id) {
-    case PROP_PATH:
-        g_value_set_string(value, priv->path);
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-    }
-}
-
-
-static void gvir_domain_disk_set_property(GObject *object,
-                                          guint prop_id,
-                                          const GValue *value,
-                                          GParamSpec *pspec)
-{
-    GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
-    GVirDomainDiskPrivate *priv = self->priv;
-
-    switch (prop_id) {
-    case PROP_PATH:
-        g_free(priv->path);
-        priv->path = g_value_dup_string(value);
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-    }
-}
-
-
 static void gvir_domain_disk_finalize(GObject *object)
 {
     GVirDomainDisk *self = GVIR_DOMAIN_DISK(object);
-    GVirDomainDiskPrivate *priv = self->priv;

     g_debug("Finalize GVirDomainDisk=%p", self);

-    g_free(priv->path);
-
     G_OBJECT_CLASS(gvir_domain_disk_parent_class)->finalize(object);
 }

 <at>  <at>  -111,19 +63,6  <at>  <at>  static void gvir_domain_disk_class_init(GVirDomainDiskClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS (klass);

     object_class->finalize = gvir_domain_disk_finalize;
-    object_class->get_property = gvir_domain_disk_get_property;
-    object_class->set_property = gvir_domain_disk_set_property;
-
-    g_object_class_install_property(object_class,
-                                    PROP_PATH,
-                                    g_param_spec_string("path",
-                                                        "Path",
-                                                        "The disk path",
-                                                        NULL,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY |
-                                                        G_PARAM_STATIC_STRINGS));
-
     g_type_class_add_private(klass, sizeof(GVirDomainDiskPrivate));
 }

 <at>  <at>  -151,6 +90,15  <at>  <at>  gvir_domain_disk_stats_free(GVirDomainDiskStats *stats)
 G_DEFINE_BOXED_TYPE(GVirDomainDiskStats, gvir_domain_disk_stats,
                     gvir_domain_disk_stats_copy, gvir_domain_disk_stats_free)

+static gchar *gvir_domain_disk_get_path(GVirDomainDisk *self)
+{
+    GVirConfigDomainDevice *config;
+
+    config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
+
+    return gvir_config_domain_disk_get_target_dev (GVIR_CONFIG_DOMAIN_DISK (config));
+}
+
 /**
  * gvir_domain_disk_get_stats:
  *  <at> self: the domain disk
 <at>  <at>  -166,15 +114,15  <at>  <at>  GVirDomainDiskStats *gvir_domain_disk_get_stats(GVirDomainDisk *self,
GError **e
 {
     GVirDomainDiskStats *ret = NULL;
     virDomainBlockStatsStruct stats;
-    GVirDomainDiskPrivate *priv;
     virDomainPtr handle;
+    gchar *path;

     g_return_val_if_fail(GVIR_IS_DOMAIN_DISK(self), NULL);

-    priv = self->priv;
     handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
+    path = gvir_domain_disk_get_path (self);

-    if (virDomainBlockStats(handle, priv->path, &stats, sizeof (stats)) < 0) {
+    if (virDomainBlockStats(handle, path, &stats, sizeof (stats)) < 0) {
         gvir_set_error_literal(err, GVIR_DOMAIN_DISK_ERROR,
                                0,
                                "Unable to get domain disk stats");
 <at>  <at>  -190,6 +138,7  <at>  <at>  GVirDomainDiskStats *gvir_domain_disk_get_stats(GVirDomainDisk *self, GError **e

 end:
     virDomainFree(handle);
+    g_free(path);
     return ret;
 }

 <at>  <at>  -211,13 +160,15  <at>  <at>  gboolean gvir_domain_disk_resize(GVirDomainDisk *self,
 {
     gboolean ret = FALSE;
     virDomainPtr handle;
+    gchar *path;

     g_return_val_if_fail(GVIR_IS_DOMAIN_DISK(self), FALSE);
     g_return_val_if_fail(err == NULL || *err != NULL, FALSE);

     handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
+    path = gvir_domain_disk_get_path (self);

-    if (virDomainBlockResize(handle, self->priv->path, size, flags) < 0) {
+    if (virDomainBlockResize(handle, path, size, flags) < 0) {
         gvir_set_error_literal(err, GVIR_DOMAIN_DISK_ERROR,
                                0,
                                "Failed to resize domain disk");
 <at>  <at>  -228,5 +179,6  <at>  <at>  gboolean gvir_domain_disk_resize(GVirDomainDisk *self,

 end:
     virDomainFree(handle);
+    g_free(path);
     return ret;
 }
diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 0917e03..0a9bde0 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
 <at>  <at>  -36,73 +36,25  <at>  <at> 

 struct _GVirDomainInterfacePrivate
 {
-    gchar *path;
+    gboolean unused;
 };

 G_DEFINE_TYPE(GVirDomainInterface, gvir_domain_interface, GVIR_TYPE_DOMAIN_DEVICE);

-enum {
-    PROP_0,
-    PROP_PATH,
-};
-
 #define GVIR_DOMAIN_INTERFACE_ERROR gvir_domain_interface_error_quark()

-
 static GQuark
 gvir_domain_interface_error_quark(void)
 {
     return g_quark_from_static_string("gvir-domain-interface");
 }

-static void gvir_domain_interface_get_property(GObject *object,
-                                               guint prop_id,
-                                               GValue *value,
-                                               GParamSpec *pspec)
-{
-    GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
-    GVirDomainInterfacePrivate *priv = self->priv;
-
-    switch (prop_id) {
-    case PROP_PATH:
-        g_value_set_string(value, priv->path);
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-    }
-}
-
-
-static void gvir_domain_interface_set_property(GObject *object,
-                                          guint prop_id,
-                                          const GValue *value,
-                                          GParamSpec *pspec)
-{
-    GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
-    GVirDomainInterfacePrivate *priv = self->priv;
-
-    switch (prop_id) {
-    case PROP_PATH:
-        g_free(priv->path);
-        priv->path = g_value_dup_string(value);
-        break;
-
-    default:
-        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
-    }
-}
-
-
 static void gvir_domain_interface_finalize(GObject *object)
 {
     GVirDomainInterface *self = GVIR_DOMAIN_INTERFACE(object);
-    GVirDomainInterfacePrivate *priv = self->priv;

     g_debug("Finalize GVirDomainInterface=%p", self);

-    g_free(priv->path);
-
     G_OBJECT_CLASS(gvir_domain_interface_parent_class)->finalize(object);
 }

 <at>  <at>  -111,19 +63,6  <at>  <at>  static void gvir_domain_interface_class_init(GVirDomainInterfaceClass *klass)
     GObjectClass *object_class = G_OBJECT_CLASS (klass);

     object_class->finalize = gvir_domain_interface_finalize;
-    object_class->get_property = gvir_domain_interface_get_property;
-    object_class->set_property = gvir_domain_interface_set_property;
-
-    g_object_class_install_property(object_class,
-                                    PROP_PATH,
-                                    g_param_spec_string("path",
-                                                        "Path",
-                                                        "The interface path",
-                                                        NULL,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY |
-                                                        G_PARAM_STATIC_STRINGS));
-
     g_type_class_add_private(klass, sizeof(GVirDomainInterfacePrivate));
 }

 <at>  <at>  -140,17 +79,28  <at>  <at>  gvir_domain_interface_stats_copy(GVirDomainInterfaceStats *stats)
     return g_slice_dup(GVirDomainInterfaceStats, stats);
 }

-
 static void
 gvir_domain_interface_stats_free(GVirDomainInterfaceStats *stats)
 {
     g_slice_free(GVirDomainInterfaceStats, stats);
 }

-
 G_DEFINE_BOXED_TYPE(GVirDomainInterfaceStats, gvir_domain_interface_stats,
                     gvir_domain_interface_stats_copy, gvir_domain_interface_stats_free)

+static gchar *gvir_domain_interface_get_path(GVirDomainInterface *self)
+{
+    GVirConfigDomainDevice *config;
+    gchar *path = NULL;
+
+    config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
+    path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
+
+    g_object_unref (config);
+
+    return path;
+}
+
 /**
  * gvir_domain_interface_get_stats:
  *  <at> self: the domain interface
 <at>  <at>  -166,15 +116,15  <at>  <at>  GVirDomainInterfaceStats
*gvir_domain_interface_get_stats(GVirDomainInterface *s
 {
     GVirDomainInterfaceStats *ret = NULL;
     virDomainInterfaceStatsStruct stats;
-    GVirDomainInterfacePrivate *priv;
     virDomainPtr handle;
+    gchar *path;

     g_return_val_if_fail(GVIR_IS_DOMAIN_INTERFACE(self), NULL);

-    priv = self->priv;
     handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
+    path = gvir_domain_interface_get_path (self);

-    if (virDomainInterfaceStats(handle, priv->path, &stats, sizeof (stats)) < 0) {
+    if (virDomainInterfaceStats(handle, path, &stats, sizeof (stats)) < 0) {
         gvir_set_error_literal(err, GVIR_DOMAIN_INTERFACE_ERROR,
                                0,
                                "Unable to get domain interface stats");
 <at>  <at>  -193,5 +143,6  <at>  <at>  GVirDomainInterfaceStats
*gvir_domain_interface_get_stats(GVirDomainInterface *s

 end:
     virDomainFree(handle);
+    g_free(path);
     return ret;
 }
--

-- 
1.7.7.6

Zeeshan Ali (Khattak | 1 Mar 2012 04:57
Picon

[libvirt] [libvirt-glib] RFC: Empty statistics for user-mode interfaces

From: "Zeeshan Ali (Khattak)" <zeeshanak <at> gnome.org>

One of the limitations of user-mode networking of libvirt is that you
can't get statistics for it (not yet, at least). Instead of erroring-out
in that case, simply return empty statistics result and spit a debug
message.

I will merge this into my 'Remove now redundant 'path' property' patch
once someone tells me that this makes sense. :)
---
 libvirt-gobject/libvirt-gobject-domain-interface.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
index 0a9bde0..4436466 100644
--- a/libvirt-gobject/libvirt-gobject-domain-interface.c
+++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
 <at>  <at>  -94,7 +94,11  <at>  <at>  static gchar *gvir_domain_interface_get_path(GVirDomainInterface *self)
     gchar *path = NULL;

     config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
-    path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
+    if (GVIR_CONFIG_IS_DOMAIN_INTERFACE_USER(self))
+        /* FIXME: One of the limitations of user-mode networking of libvirt */
+        g_debug("Statistics gathering for user-mode network not yet supported");
+    else
+        path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));

     g_object_unref (config);

 <at>  <at>  -123,6 +127,10  <at>  <at>  GVirDomainInterfaceStats
*gvir_domain_interface_get_stats(GVirDomainInterface *s

     handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
     path = gvir_domain_interface_get_path (self);
+    if (path == NULL) {
+        ret = g_slice_new0(GVirDomainInterfaceStats);
+        goto end;
+    }

     if (virDomainInterfaceStats(handle, path, &stats, sizeof (stats)) < 0) {
         gvir_set_error_literal(err, GVIR_DOMAIN_INTERFACE_ERROR,
--

-- 
1.7.7.6

Osier Yang | 1 Mar 2012 06:53
Picon
Favicon
Gravatar

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

On 03/01/2012 11:54 AM, Zhou Peng wrote:
> Signed-off-by: Zhou Peng<zhoupeng <at> 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
>  <at>  <at>  -852,6 +852,7  <at>  <at>  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;
>  <at>  <at>  -5543,6 +5544,8  <at>  <at>  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,
>  <at>  <at>  -11364,6 +11367,10  <at>  <at>  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
>  <at>  <at>  -1072,6 +1072,7  <at>  <at>  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
>  <at>  <at>  -5391,6 +5391,10  <at>  <at>  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
>  <at>  <at>  -5,5 +5,5  <at>  <at>  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
>  <at>  <at>  -23,7 +23,7  <at>  <at> 
>       <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

Christophe Fergeau | 1 Mar 2012 09:40
Picon
Favicon

Re: [libvirt] [libvirt-glib 1/6] Getters for GVirConfigDomainInterface attributes

On Wed, Feb 29, 2012 at 11:22:52PM +0200, Zeeshan Ali (Khattak) wrote:
> Turns out that i copy&pasted the "device" from the corresponding
> setter.

I realized yesterday that you probably got "device" from the setter and
that I should have checked if the attribute name was correct there... I
just checked both libvirt documentation and its source code, and "dev" is
the correct name.

Christophe
On Wed, Feb 29, 2012 at 11:22:52PM +0200, Zeeshan Ali (Khattak) wrote:
> Turns out that i copy&pasted the "device" from the corresponding
> setter.

I realized yesterday that you probably got "device" from the setter and
that I should have checked if the attribute name was correct there... I
just checked both libvirt documentation and its source code, and "dev" is
the correct name.

Christophe
Daniel P. Berrange | 1 Mar 2012 10:27
Picon
Favicon

Re: [libvirt] Important, switch of server for libvirt.org

On Thu, Mar 01, 2012 at 11:14:07AM +0800, Daniel Veillard wrote:
>   I learned yesterday that the lab hosting libvirt.org would
> have power cut off for the week-end due to electical maintainance.
> I took the opportunity to switch the server to a new box,
> and just made the switch to the DNS, it may take up to 8 hours
> to propagate though.
>   I cut ssh access to the old server 194.199.20.115 and reactivated
> all services on the new box 176.31.99.103 . For read only access
> nobody should notice the switch, only commiters should notice that
> and hopefully they are all sleeping right now :-)
> 
>   Grab me on IRC or by email if you notice somethings which doesn't
> work right (the search is not setup yet and I need to reaactivate
> various crons, but nearly everything should just work (TM))

Everything looks to be working fine, including my gitorious
auto-sync cron job.

Regards,
Daniel
--

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

Daniel P. Berrange | 1 Mar 2012 10:32
Picon
Favicon

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

On Thu, Mar 01, 2012 at 11:54:30AM +0800, Zhou Peng wrote:
> Signed-off-by: Zhou Peng <zhoupeng <at> 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
>  <at>  <at>  -23,7 +23,7  <at>  <at> 
>      <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 :|

Daniel P. Berrange | 1 Mar 2012 10:32
Picon
Favicon

Re: [libvirt] [libvirt-glib] RFC: Empty statistics for user-mode interfaces

On Thu, Mar 01, 2012 at 05:57:24AM +0200, Zeeshan Ali (Khattak) wrote:
> From: "Zeeshan Ali (Khattak)" <zeeshanak <at> gnome.org>
> 
> One of the limitations of user-mode networking of libvirt is that you
> can't get statistics for it (not yet, at least). Instead of erroring-out
> in that case, simply return empty statistics result and spit a debug
> message.
> 
> I will merge this into my 'Remove now redundant 'path' property' patch
> once someone tells me that this makes sense. :)
> ---
>  libvirt-gobject/libvirt-gobject-domain-interface.c |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/libvirt-gobject/libvirt-gobject-domain-interface.c b/libvirt-gobject/libvirt-gobject-domain-interface.c
> index 0a9bde0..4436466 100644
> --- a/libvirt-gobject/libvirt-gobject-domain-interface.c
> +++ b/libvirt-gobject/libvirt-gobject-domain-interface.c
>  <at>  <at>  -94,7 +94,11  <at>  <at>  static gchar *gvir_domain_interface_get_path(GVirDomainInterface *self)
>      gchar *path = NULL;
>  
>      config = gvir_domain_device_get_config(GVIR_DOMAIN_DEVICE(self));
> -    path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
> +    if (GVIR_CONFIG_IS_DOMAIN_INTERFACE_USER(self))
> +        /* FIXME: One of the limitations of user-mode networking of libvirt */
> +        g_debug("Statistics gathering for user-mode network not yet supported");
> +    else
> +        path = gvir_config_domain_interface_get_ifname(GVIR_CONFIG_DOMAIN_INTERFACE (config));
>  
>      g_object_unref (config);
>  
>  <at>  <at>  -123,6 +127,10  <at>  <at>  GVirDomainInterfaceStats
*gvir_domain_interface_get_stats(GVirDomainInterface *s
>  
>      handle = gvir_domain_device_get_domain_handle(GVIR_DOMAIN_DEVICE(self));
>      path = gvir_domain_interface_get_path (self);
> +    if (path == NULL) {
> +        ret = g_slice_new0(GVirDomainInterfaceStats);
> +        goto end;
> +    }
>  
>      if (virDomainInterfaceStats(handle, path, &stats, sizeof (stats)) < 0) {
>          gvir_set_error_literal(err, GVIR_DOMAIN_INTERFACE_ERROR,

ACK

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 :|


Gmane