On Fri, Jun 19, 2009 at 07:05:23PM +0200, Daniel Veillard wrote: > On Fri, Jun 19, 2009 at 05:39:57PM +0100, Daniel P. Berrange wrote: > > On Thu, Jun 18, 2009 at 05:53:59PM +0000, David Lutterkort wrote: > > > > So the possible configs would appear as XML like > > > > 1. Physical NIC > > > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > > > 2. Physical NIC + bridge > > > > <interface type="bridge"> > > <name>br0</name> > > <bridge> > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > </bridge> > > </interface> > > > > 3. Physical NIC + bond > > > > <interface type="bond"> > > <name>bond0</name> > > <bond> > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > <interface type='ethernet'> > > <name>eth1</name> > > </interface> > > </bond> > > </interface> > > > > 4. Physical NIC + bond + bridge > > > > <interface type="bridge"> > > <name>br0</name> > > <bridge> > > <interface type="bond"> > > <name>bond0</name> > > <bond> > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > <interface type='ethernet'> > > <name>eth1</name> > > </interface> > > </bond> > > </interface> > > </bridge> > > </interface> > > > > 5. Physical NIC + 2 * vlan > > > > <interface type="ethernet"> > > <name>eth0</name> > > </interface> > > > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='ethernet'> > > <name>eth0</name> > > </inteface> > > </vlan> > > </inteface> > > > > <interface type="vlan"> > > <name>vlan48</name> > > <vlan tag='48'> > > <interface type='ethernet'> > > <name>eth0</name> > > </inteface> > > </vlan> > > </inteface> > > > > > > 6. Physical NIC + 2 * vlan + bridge > > > > <interface type="ethernet"> > > <name>eth0</name> > > </interface> > > > > <interface type='bridge'> > > <name>br42</name> > > <bridge> > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='ethernet'> > > <name>eth0</name> > > </inteface> > > </vlan> > > </inteface> > > </bridge> > > </interface> > > > > <interface type='bridge'> > > <name>br42</name> > > <bridge> > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='ethernet'> > > <name>eth0</name> > > </inteface> > > </vlan> > > </inteface> > > </bridge> > > </interface> > > > > > > 7. Physical NIC + bond + 2 * vlan > > > > <interface type="bond"> > > <name>bond0</name> > > <bond> > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > <interface type='ethernet'> > > <name>eth1</name> > > </interface> > > </bond> > > </interface> > > > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='bond'> > > <name>bond0</name> > > </inteface> > > </vlan> > > </inteface> > > > > <interface type="vlan"> > > <name>vlan48</name> > > <vlan tag='48'> > > <interface type='bond'> > > <name>bond0</name> > > </inteface> > > </vlan> > > </inteface> > > > > 8. Physical NIC + bond + 2 * vlan + bridge > > > > > > <interface type="bond"> > > <name>bond0</name> > > <bond> > > <interface type='ethernet'> > > <name>eth0</name> > > </interface> > > <interface type='ethernet'> > > <name>eth1</name> > > </interface> > > </bond> > > </interface> > > > > <interface type='bridge'> > > <name>br42</name> > > <bridge> > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='bond'> > > <name>bond0</name> > > </inteface> > > </vlan> > > </inteface> > > </bridge> > > </interface> > > > > <interface type='bridge'> > > <name>br42</name> > > <bridge> > > <interface type="vlan"> > > <name>vlan42</name> > > <vlan tag='42'> > > <interface type='bond'> > > <name>bond0</name> > > </inteface> > > </vlan> > > </inteface> > > </bridge> > > </interface> > > > > > > > > Of course, you could actually have a hybrid of 7/8, where some vlans > > where bridged, and others direct endpoints. That's trivally handled > > there of course. > > Hum, since an XML can only have one single root, I suggest to put a > wrapper around multiple definitions and if you call it <interfaces> > that looks a bit like my own proposal but more recursive. Sorry, I didn't explain this bit enough. In the last 4 cases where there are multiple <inteface> end-points, each of those example docs would correspond to a separate virInterfacePtr object. so there is no need for a <intefaces> wrapper around them all. eg in example 8, you would do import libvirt bondxml="<interface type='bond'> <name>bond0</name> <bond> <interface type='ethernet'> <name>eth0</name> </interface> <interface type='ethernet'> <name>eth1</name> </interface> </bond> </interface>" vlan1xml="<interface type='bridge'> <name>br42</name> <bridge> <interface type='vlan'> <name>vlan42</name> <vlan tag='42'> <interface type='bond'> <name>bond0</name> </inteface> </vlan> </inteface> </bridge> </interface>" vlan2xml="<interface type='bridge'> <name>br42</name> <bridge> <interface type='vlan'> <name>vlan42</name> <vlan tag='42'> <interface type='bond'> <name>bond0</name> </inteface> </vlan> </inteface> </bridge> </interface>" conn = libvirt.open("xen:///") bond = conn.defineInterface(bondxml) vlan1 = conn.defineInterface(vlan1xml) vlan2 = conn.defineInterface(vlan2xml) There is no need to define all 3 at once, since it is fine for 'bond' to exist at any time before vlan1/vlan2 come along. In fact it is critical, since you will likely add/remove vlans on the fly at any time Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list