[Libvir] QEMU networking XML docs summary

Daniel P. Berrange berrange at redhat.com
Wed Mar 21 15:38:49 UTC 2007


On Fri, Mar 16, 2007 at 01:38:47PM +0000, Daniel P. Berrange wrote:
>   3. Bridge to to LAN
> 
>      Provides a bridge from the VM directly onto the LAN. This assumes there
>      is a bridge device on the host which has one or more of the hosts
>      physical NICs enslaved. The guest VM will have an associated tun device
>      created with a name of vnetN, which can also be overriden with the
>      <target> element. The tun device will be enslaved to the bridge. The
>      IP range / network configuration is whatever is used on the LAN. This
>      provides the guest VM full incoming & outgoing net access just like
>      a physical machine. Examples include
> 
>        <interface type='bridge'>
>          <source dev='br0'/>
>        </interface>

This was actually wrong & violating the schema - it should instead be
   
          <source bridge='br0'/>

>        <interface type='bridge'>
>          <source dev='br0'/>
>          <target dev='vnet7'/>
>          <mac address="11:22:33:44:55:66:/>
>        </interface>

Likewise  s/source dev=/source bridge=/

The impl in the qemud/conf.c was also wrong - the attached patch will fix
it to be compliant with the schema & Xen impl which is what tools like
virt-manager/virt-install were expecting.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
-------------- next part --------------
Index: qemud/conf.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/conf.c,v
retrieving revision 1.44
diff -u -p -r1.44 conf.c
--- qemud/conf.c	20 Mar 2007 16:50:42 -0000	1.44
+++ qemud/conf.c	21 Mar 2007 15:34:40 -0000
@@ -508,7 +508,7 @@ static struct qemud_vm_net_def *qemudPar
             } else if ((network == NULL) &&
                        (net->type == QEMUD_NET_BRIDGE) &&
                        (xmlStrEqual(cur->name, BAD_CAST "source"))) {
-                bridge = xmlGetProp(cur, BAD_CAST "dev");
+                bridge = xmlGetProp(cur, BAD_CAST "bridge");
             } else if ((network == NULL) &&
                        ((net->type == QEMUD_NET_SERVER) ||
                         (net->type == QEMUD_NET_CLIENT) ||
@@ -2549,7 +2549,7 @@ char *qemudGenerateXML(struct qemud_serv
             break;
 
         case QEMUD_NET_BRIDGE:
-            if (bufferVSprintf(buf, "      <source dev='%s'/>\n", net->dst.bridge.brname) < 0)
+            if (bufferVSprintf(buf, "      <source bridge='%s'/>\n", net->dst.bridge.brname) < 0)
                 goto no_memory;
             if (net->dst.bridge.ifname[0] != '\0') {
                 if (bufferVSprintf(buf, "      <target dev='%s'/>\n", net->dst.bridge.ifname) < 0)


More information about the libvir-list mailing list