[libvirt] [PATCH 0/2] a couple of vlan-related fixes

One in the code, one in the documentation (the latter was pushed as trivial) Laine Stump (2): network: allow <vlan> in type='hostdev' networks docs: correct and update network vlan example docs/formatnetwork.html.in | 39 ++++++++++++++++++--------------------- src/network/bridge_driver.c | 6 ++++-- 2 files changed, 22 insertions(+), 23 deletions(-) -- 1.7.11.7

Although SRIOV network cards support setting a vlan tag on their virtual functions, and although setting this vlan tag via a <vlan> element in a domain's <interface> works, setting a vlan tag for these devices in a <network> definition, or in a network <portgroup> definition is also supposed to work (and the comment that validates <vlan> usage even says that!). However, the check to allow it only checked for an openvswitch network, so attempts to add <vlan> to a network of type='hostdev' would fail. --- src/network/bridge_driver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 5988209..2cf49bb 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -3154,9 +3154,11 @@ networkValidate(struct network_driver *driver, * a pool, and those using an Open vSwitch bridge. */ - vlanAllowed = (def->forward.type == VIR_NETWORK_FORWARD_BRIDGE && + vlanAllowed = ((def->forward.type == VIR_NETWORK_FORWARD_BRIDGE && def->virtPortProfile && - def->virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH); + def->virtPortProfile->virtPortType + == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) || + def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV); vlanUsed = def->vlan.nTags > 0; for (ii = 0; ii < def->nPortGroups; ii++) { -- 1.7.11.7

Somehow I put an example of a domain interface with a <vlan> element into the network documentation. This patch replaces that with an example of a network definition that has a vlan element with trunk='yes', multiple tags, and even the new nativeMode attribute. It also includes a <portgroup> that has a vlan defined. --- Pushed under trivial rule. docs/formatnetwork.html.in | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 641f15e..eb7c4c7 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -434,27 +434,24 @@ <h5><a name="elementVlanTag">Setting VLAN tag (on supported network types only)</a></h5> <pre> - ... - <devices> - <interface type='bridge'> - <b><vlan trunk='yes'></b> - <b><tag id='42'/></b> - <b><tag id='47'/></b> - <b></vlan></b> - <source bridge='ovsbr0'/> - <virtualport type='openvswitch'> - <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/> - </virtualport> - </interface> - <interface type='bridge'> - <b><vlan trunk='yes'></b> - <b><tag id='42'/></b> - <b><tag id='123' nativeMode='untagged'/></b> - <b></vlan></b> - ... - </interface> - <devices> - ...</pre> +<network> + <name>ovs-net</name> + <forward mode='bridge'/> + <bridge name='ovsbr0'/> + <virtualport type='openvswitch'> + <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/> + </virtualport> + <b><vlan trunk='yes'></b> + <b><tag id='42' nativeMode='untagged'/></b> + <b><tag id='47'/></b> + <b></vlan></b> + <portgroup name='dontpanic'> + <b><vlan></b> + <b><tag id='42'/></b> + <b></vlan></b> + </portgroup> +</network> +</pre> <p> If (and only if) the network type supports vlan tagging -- 1.7.11.7

On 26.06.2013 08:20, Laine Stump wrote:
One in the code, one in the documentation (the latter was pushed as trivial)
Laine Stump (2): network: allow <vlan> in type='hostdev' networks docs: correct and update network vlan example
docs/formatnetwork.html.in | 39 ++++++++++++++++++--------------------- src/network/bridge_driver.c | 6 ++++-- 2 files changed, 22 insertions(+), 23 deletions(-)
ACK to both patches. Michal
participants (2)
-
Laine Stump
-
Michal Privoznik