libvirt-ovasの配置vlanの問題を見直します。

7729 ワード

原文:http://blog.scottlowe.org/2012/11/12/libvirt-ovs-integration-revisited/
A few days ago,I posted an articale about using VLANs with Open v Switch(OVS)and libvirt.In that article,I stated that libvirt 1.0.0 was needd.Unifortunally(or maybe fortunally?),I was wrong.The libvirt-OVS integration works in earlier versions,too.
In my earlier OVS-libvirt post、I supplied this snippet of XML to define a libvirt network that You could use with OVS:
123455678910 1112121141 51718192022324

          
          
          
          
<network>
<name>ovs-network</name>
<forward mode='bridge'/>
<bridge name='ovsbr0'/>
<virtualport type='openvswitch'/>
<portgroup name='vlan-01' default='yes'>
</portgroup>
<portgroup name='vlan-02'>
<vlan>
<tag id='2'/>
</vlan>
</portgroup>
<portgroup name='vlan-03'>
<vlan>
<tag id='3'/>
</vlan>
</portgroup>
<portgroup name='vlan-all'>
<vlan trunk='yes'>
<tag id='2'/>
<tag id='3'/>
</vlan>
</portgroup>
</network>
view raw libvirt-xml-ov hosted with❤ by  GitHub
You would use that libvirt network definition in conjunction with a domain configration like this:
1234

          
          
          
          
<interface type='network'>
<mac address='11:22:33:44:55:66'/>
<source network='ovs-network' portgroup='vlan-02'/>
</interface>
view raw doman-libvirt-xml-ovas hosted with❤ by  GitHub
I just tested this on Ubuntu 12.04.1 with libvirt 0.0.2、and it workd just fine. I think the problems I experienced in my earlier testing related to incorect XML configrations.Some other write-up s of the libvirt-OVS integration seem to imply thyou need to use the  profileid parameter to link the domann XML configration and the network XML configration、but my testing seems to show that the real link is the portgroup name.
I haven’t yet tested this on earlier versions of libvirt、but I can confirm that it works with Ubuntu 12.04 using manaled compled versions of libvirt 0.0.2 and libvirt 1.0.0.
If anyone has any additional information to share,please speak up in the comments.