[virt-tools-list] [PATCH virt-manager 1/2] virtinst: support virtual port parameters for non-802.1Qbg NICs

Daniel P. Berrange berrange at redhat.com
Fri Aug 28 11:26:30 UTC 2015


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

  commit 34e2ca8389ddf1c764109c4e5c74f8fd5bf0e604
  Author: Cole Robinson <crobinso at 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 at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 8 ++++++++
 tests/clitest.py                                         | 1 +
 virtinst/cli.py                                          | 6 ++++++
 virtinst/deviceinterface.py                              | 2 ++
 4 files changed, 17 insertions(+)

diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index cf77888..1cb4b3f 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -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"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index ccd15bc..2c87804 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -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 \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 22123d8..f5ed1c2 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1761,12 +1761,18 @@ class ParserNetwork(VirtCLIParser):
         self.set_param("driver_queues", "driver_queues")
 
         self.set_param("virtualport.type", "virtualport_type")
+
+        # For vepa
         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
+        self.set_param("virtualport.profileid", "virtualport_profileid")
+        self.set_param("virtualport.interfaceid", "virtualport_interfaceid")
+
     def _parse(self, optsobj, inst):
         if optsobj.fullopts == "none":
             return
diff --git a/virtinst/deviceinterface.py b/virtinst/deviceinterface.py
index cabd656..78143a9 100644
--- a/virtinst/deviceinterface.py
+++ b/virtinst/deviceinterface.py
@@ -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):
-- 
2.4.3




More information about the virt-tools-list mailing list