mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
a8f75d2c7d
This patch parses the following two XML descriptions, one for 802.1Qbg and one for 802.1Qbh, and stores the data internally. The actual triggering of the switch setup protocol has not been implemented here but the relevant code to do that should go into the functions associatePortProfileId() and disassociatePortProfileId(). <interface type='direct'> <source dev='eth0.100' mode='vepa'/> <model type='virtio'/> <virtualport type='802.1Qbg'> <parameters managerid='12' typeid='0x123456' typeidversion='1' instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/> </virtualport> <filterref filter='clean-traffic'/> </interface> <interface type='direct'> <source dev='eth0.100' mode='vepa'/> <model type='virtio'/> <virtualport type='802.1Qbh'> <parameters profileid='my_profile'/> </virtualport> </interface> I'd suggest to use this patch as a base for triggering the setup protocol with the 802.1Qb{g|h} switch. Several rounds of changes were made to this patch. The following is a list of these changes. - Renamed structure virVirtualPortProfileDef to virVirtualPortProfileParams as per Daniel Berrange's request - Addressing Daniel Berrange's comments: - removing macvtap.h's dependency on domain_conf.h by moving the virVirtualPortProfileDef structure into macvtap.h and not passing virtDomainNetDefPtr to any functions in macvtap.c - Addressed most of Chris Wright's comments: - indicating error in case virtualport XML node cannot be parsed properly - parsing hex and decimal numbers using virStrToLong_ui() with parameter '0' for base - tgifname (target interface name) variable wasn't necessary to pass to openMacvtapTap function anymore - assigning the virtual port data structure to the virDomainNetDef only if it was previously parsed - make sure that the error code returned by openMacvtapTap() is a negative n in case the associatePortProfileId() function failed. - renaming vsi in the XML to virtualport - replace all occurrences of vsi in the source as well - removing mode and MAC address parameters from the functions that will communicate with the hareware diretctly or indirectly - moving the associate and disassociate functions to the end of the file for subsequent patches to easier make them generally available for export - passing the macvtap interface name rather than the link device since this otherwise gives funny side effects when using netlink messages where IFLA_IFNAME and IFLA_ADDRESS are specified and the link dev all of a sudden gets the MAC address of the macvtap interface. - Removing rc = -1 error indications in the case of 802.1Qbg|h setup in case we wanted to use hook scripts for the setup and so the setup doesn't fail here. - if instance ID UUID is not supplied it will automatically be generated - adapted schema to make instance ID UUID optional - added test case - parser and XML generator have been separated into their own functions so they can be re-used elsewhere (passthrough case for example) - Adapted XML parser and generator support the above shown type (802.1Qbg, 802.1Qbh). - Adapted schema to above XML - Adapted test XML to above XML - Passing through the VM's UUID which seems to be necessary for 802.1Qbh -- sorry no host UUID - adding virtual function ID to association function, in case it's necessary to use (for SR-IOV)
37 lines
1.1 KiB
XML
37 lines
1.1 KiB
XML
<domain type='lxc'>
|
|
<name>portprofile</name>
|
|
<uuid>00000000-0000-0000-0000-000000000000</uuid>
|
|
<memory>1048576</memory>
|
|
<os>
|
|
<type>exe</type>
|
|
<init>/sh</init>
|
|
</os>
|
|
<devices>
|
|
<interface type='direct'>
|
|
<source dev='eth0' mode='vepa'/>
|
|
<virtualport type='802.1Qbg'>
|
|
<parameters managerid='12' typeid='1193046' typeidversion='1'
|
|
instanceid='fa9b7fff-b0a0-4893-8e0e-beef4ff18f8f'/>
|
|
</virtualport>
|
|
</interface>
|
|
<interface type='direct'>
|
|
<source dev='eth0' mode='vepa'/>
|
|
<virtualport type='802.1Qbg'>
|
|
<parameters managerid='12' typeid='1193046' typeidversion='1'/>
|
|
</virtualport>
|
|
</interface>
|
|
<interface type='direct'>
|
|
<source dev='eth0' mode='vepa'/>
|
|
<virtualport type='802.1Qbh'>
|
|
<parameters profileid='my_profile'/>
|
|
</virtualport>
|
|
</interface>
|
|
<interface type='direct'>
|
|
<source dev='eth0' mode='vepa'/>
|
|
</interface>
|
|
<interface type='direct'>
|
|
<source dev='eth0' mode='vepa'/>
|
|
</interface>
|
|
</devices>
|
|
</domain>
|