[PATCH 0/3] support VLan for virtual network based on 8021q kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Support VLan for virtual network based on 8021q kernel module other than ovs backend.
Insert vlan-device into the datapath of the network traffic:
(outside of host) <--> physical_interface <--> vlan-dev(with VLAN-Tag) <--> bridge <--> guests
Then VLAN-Tag will be applied to the guest's network traffic.
The VLan network acts as real layer-2 switch which provides 'access' port to guest.

1. Create VLan network by setting mode='vlan' on the forward element, for example:
  ...
  <network>
    <name>vlan10</name>
    <forward mode="vlan" dev="eth0"/>
    <vlan>
      <tag id="10"/>
    </vlan>
  </network>
  ...
  The mode attribute of <forward> should be 'vlan' (this patch added).
  The dev attribute of <forward> specifies a physical interface
which forwards traffice between this VLan-network and outside.
  The id attribue of the vlan tag indicates VLAN-Tag. Both vlan element
and tag element should be unique in this xml.

  A guest connects to this VLan network by setting its xml like this:
  <interface type='network'>
    <source network='vlan10'/>
  </interface>

2. We can enable dhcp for VLan network according to the current way, for example:
  ...
  <network>
    ...
    <ip address="192.168.126.2" netmask="255.255.255.0">
      <dhcp>
        <range start="192.168.126.120" end="192.168.126.129"/>
      </dhcp>
    </ip>
  </network>
  ...

3. This can help to build Cross-Host VLan network for guests. We can simplify
the work to implement vlan-net of management app (e.g. OpenStack).

  1) Distribute the xml of VLan network to all hosts, then 'virsh net-create ...' on each host locally.
  2) Makesure the outside switch's port linked to the physical interface (specified by the dev of <forward>) is 'trunk' mode.
  3) For each VLan network, ONLY one host can 'net-create' network with ip and dhcp element to avoid dhcp conflict.


Shi Lei (3):
  add functions: load(verify) 8021q module, create/destroy vlan-dev
  support new forward mode of vlan for virtual network
  fix other functions to add VIR_NETWORK_FORWARD_VLAN

 configure.ac                |   5 +-
 src/conf/domain_conf.c      |   1 +
 src/conf/network_conf.c     |  12 ++-
 src/conf/network_conf.h     |   1 +
 src/conf/virnetworkobj.c    |   1 +
 src/libvirt_private.syms    |   4 +
 src/network/bridge_driver.c |  80 ++++++++++++++++--
 src/qemu/qemu_process.c     |   1 +
 src/util/virnetdev.c        | 195 ++++++++++++++++++++++++++++++++++++++++++++
 src/util/virnetdev.h        |  14 ++++
 10 files changed, 301 insertions(+), 13 deletions(-)

-- 
2.7.4

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux