virtinst: support virtual port parameters for non-802.1Qbg NICs

Previous commit added support for virtual port profiles
on NICs, but only defined the attributes needed by the
802.1Qbg NIC type.

  commit 34e2ca8389
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Fri Jan 31 16:51:02 2014 -0500

    cli: --network: Wire up virtualport options

This commit adds the profileid and interfaceid parameters
needed by 801.Qbh, openvswitch and midonet

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2015-08-28 12:12:49 +01:00
parent 40d4c37868
commit d6ea493d1b
4 changed files with 19 additions and 0 deletions

View File

@ -168,6 +168,14 @@
<model type="virtio"/>
<driver name="qemu" queues="3"/>
</interface>
<interface type="bridge">
<source bridge="ovsbr"/>
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
<virtualport type="openvswitch">
<parameters profileid="demo" interfaceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b"/>
</virtualport>
</interface>
<interface type="direct">
<source dev="eth5" mode="vepa"/>
<mac address="00:11:22:33:44:55"/>

View File

@ -460,6 +460,7 @@ c.add_compare(""" \
\
--network user,mac=12:34:56:78:11:22,portgroup=foo \
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
--network bridge=ovsbr,virtualport_type=openvswitch,virtualport_profileid=demo,virtualport_interfaceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b \
--network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1 \
\
--graphics sdl \

View File

@ -1761,12 +1761,20 @@ class ParserNetwork(VirtCLIParser):
self.set_param("driver_queues", "driver_queues")
self.set_param("virtualport.type", "virtualport_type")
# For 802.1Qbg
self.set_param("virtualport.managerid", "virtualport_managerid")
self.set_param("virtualport.typeid", "virtualport_typeid")
self.set_param("virtualport.typeidversion",
"virtualport_typeidversion")
self.set_param("virtualport.instanceid", "virtualport_instanceid")
# For openvswitch & 802.1Qbh
self.set_param("virtualport.profileid", "virtualport_profileid")
# For openvswitch & midonet
self.set_param("virtualport.interfaceid", "virtualport_interfaceid")
def _parse(self, optsobj, inst):
if optsobj.fullopts == "none":
return

View File

@ -60,6 +60,8 @@ class VirtualPort(XMLBuilder):
typeid = XMLProperty("./parameters/@typeid", is_int=True)
typeidversion = XMLProperty("./parameters/@typeidversion", is_int=True)
instanceid = XMLProperty("./parameters/@instanceid")
profileid = XMLProperty("./parameters/@profileid")
interfaceid = XMLProperty("./parameters/@interfaceid")
class VirtualNetworkInterface(VirtualDevice):