Hi, everyone!
This patch supports VLan by '8021q' kernel module
other than by OVS. The way of '8021q' is simpler and more robust.
Mode 'vlan' is like mode 'route' except these major differences:
- mode 'vlan' inserts a vlan-device between the specified host's
interface and the internal bridge. The vlan-device is based on
'8021q' kernel module.
- mode 'vlan' has no routed iptables rules but has other common
iptables rules
It can simplify the work of management apps whose developers want to
implement VLan but don't want to introduce OVS into their project.
Thank John for his comments in v1. v1 here:
https://www.redhat.com/archives/libvir-list/2018-July/msg00331.html
since v1:
- Change docs/formatnetwork.html.in
- Change docs/schemas/network.rng
- Add tests/networkxml2*
- Other code fixes
Besides, I have post two patches followed by John's suggestions.
- Replace 'if' type conditions with 'switch' for VIR_NETWORK_FORWARD_*
https://www.redhat.com/archives/libvir-list/2018-July/msg01537.html
This has been accepted.
- Introduce timeout mode for virKModLoad to solve the potential problem
of the 'strange delay' when loading '8021q' module
https://www.redhat.com/archives/libvir-list/2018-August/msg00605.html
This has been rejected and I don't know wether I should continue to
solve this problem. Now I just check the INIT process code of '8021q'
module and I think this module should not cause delay now. The loading
time of '8021q' by virKModLoad on my PC is about 30 milliseconds.
Shi Lei (3):
add functions: load 8021q module, create/destroy vlan-dev
support new forward mode 'vlan' for virtual network
tests and docs for new forward mode 'vlan'
configure.ac | 6 +
docs/formatnetwork.html.in | 27 ++-
docs/schemas/network.rng | 1 +
src/conf/domain_conf.c | 1 +
src/conf/network_conf.c | 24 ++-
src/conf/network_conf.h | 1 +
src/conf/virnetworkobj.c | 1 +
src/esx/esx_network_driver.c | 1 +
src/libvirt_private.syms | 4 +
src/network/bridge_driver.c | 55 +++++-
src/qemu/qemu_process.c | 1 +
src/util/virnetdev.c | 203 +++++++++++++++++++++
src/util/virnetdev.h | 18 ++
tests/networkxml2confdata/vlan-network.conf | 16 ++
tests/networkxml2confdata/vlan-network.xml | 13 ++
tests/networkxml2conftest.c | 1 +
.../vlan-network-multi-vlan-tag.xml | 11 ++
.../vlan-network-no-forward-dev.xml | 10 +
tests/networkxml2xmlin/vlan-network-with-dhcp.xml | 15 ++
tests/networkxml2xmlin/vlan-network.xml | 10 +
tests/networkxml2xmlout/vlan-network-with-dhcp.xml | 17 ++
tests/networkxml2xmlout/vlan-network.xml | 12 ++
tests/networkxml2xmltest.c | 5 +
23 files changed, 448 insertions(+), 5 deletions(-)
create mode 100644 tests/networkxml2confdata/vlan-network.conf
create mode 100644 tests/networkxml2confdata/vlan-network.xml
create mode 100644 tests/networkxml2xmlin/vlan-network-multi-vlan-tag.xml
create mode 100644 tests/networkxml2xmlin/vlan-network-no-forward-dev.xml
create mode 100644 tests/networkxml2xmlin/vlan-network-with-dhcp.xml
create mode 100644 tests/networkxml2xmlin/vlan-network.xml
create mode 100644 tests/networkxml2xmlout/vlan-network-with-dhcp.xml
create mode 100644 tests/networkxml2xmlout/vlan-network.xml
--
2.7.4