[libvirt] [PATCH] esx: Support VLAN tags in virtual network port groups

Matthias Bolte matthias.bolte at googlemail.com
Sun Aug 26 10:02:42 UTC 2012


2012/8/20 Laine Stump <laine at laine.org>:
> On 08/18/2012 07:46 AM, Matthias Bolte wrote:
>> ---
>>  src/esx/esx_network_driver.c |   38 +++++++++++++++++++++++++++++++++-----
>>  1 files changed, 33 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
>> index 09d46d3..2f5f1ab 100644
>> --- a/src/esx/esx_network_driver.c
>> +++ b/src/esx/esx_network_driver.c
>> @@ -489,7 +489,16 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
>>              goto cleanup;
>>          }
>>
>> -        hostPortGroupSpec->vlanId->value = 0;
>> +        if (def->portGroups[i].vlan.trunk) {
>> +            hostPortGroupSpec->vlanId->value = 4095;
>> +        } else if (def->portGroups[i].vlan.nTags == 1) {
>> +            hostPortGroupSpec->vlanId->value = *def->portGroups[i].vlan.tag;
>> +        } else if (def->portGroups[i].vlan.nTags > 1) {
>> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
>> +                           _("Can apply one VLAN tag per port group only"));
>> +        } else {
>> +            hostPortGroupSpec->vlanId->value = 0;
>> +        }
>
> So in vmware you can specify that a port is to be used for trunking,
> (and you do that by specifying a tag of 4095), but can't limit the list
> of tags to allow - is that correct?

Yes.

> Aside from this, you are interpreting the <vlan> element in portgroups,
> but not the overlying <vlan> for the entire network (in practice this is
> what would be used if no portgroup was chosen, and no vlan info came
> from the domain's interface definition). If there isn't any practical
> way to implement this, you should check for it and log a
> CONFIG_UNSUPPORTED error if found.

There is no way to not choose a portgroup in VMware, but I could use
the following logic. If a portgroup has no <vlan> element but the
network has one than use the network's <vlan> for the portgroup.

-- 
Matthias Bolte
http://photron.blogspot.com




More information about the libvir-list mailing list