[libvirt] [PATCH 2/3 v3] Schema and docs for the midonet virtualport type

Antoni Segura Puimedon toni at midokura.com
Mon Feb 23 20:54:55 UTC 2015


Midonet is an opensource virtual networking that over lays the IP
network between hypervisors. Currently, such networks can be made
with the openvswitch virtualport type.

This patch, defines the schema and documentation that will serve
as basis for the follow up patches that will add support to libvirt
for using Midonet virtual ports for its interfaces. The schema
definition requires that the port profile expresses its interfaceid
as part of the port profile. For that reason, this is part of the
patch too.

Signed-off-by: Antoni Segura Puimedon <toni+libvirt at midokura.com>
---
 docs/formatdomain.html.in                          | 34 +++++++++++++++++++++
 docs/schemas/networkcommon.rng                     | 12 ++++++++
 src/conf/netdev_vport_profile_conf.c               |  3 +-
 .../qemuxml2argvdata/qemuxml2argv-net-midonet.xml  | 35 ++++++++++++++++++++++
 tests/qemuxml2xmltest.c                            |  1 +
 5 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-midonet.xml

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f6477c2..1c2bb45 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3652,6 +3652,40 @@
   </devices>
   ...</pre>
 
+    <p>
+      On hosts that support Open vSwitch on the kernel side and that have the
+      Midonet Host Agent configured, it is also possible to connect to the
+      'midonet' bridge device by adding a
+      <code><virtualport type='midonet'/></code> to the
+      interface definition.  (<span class="since">Since
+      1.2.13</span>). The Midonet virtualport type requires an
+      <code>interfaceid</code> attribute to its
+      <code><parameters></code> element. This interface id is the UUID
+      that specifies which port in the virtual network topology will be bound
+      to the interface.
+    </p>
+<pre>
+  ...
+  <devices>
+    ...
+    <interface type='bridge'>
+      <source bridge='br0'/>
+    </interface>
+    <interface type='bridge'>
+      <source bridge='br1'/>
+      <target dev='vnet7'/>
+      <mac address="00:11:22:33:44:55"/>
+    </interface>
+    <interface type='bridge'>
+      <source bridge='midonet'/>
+      <virtualport type='midonet'>
+        <parameters interfaceid='0b2d64da-3d0e-431e-afdd-804415d6ebbb'/>
+      </virtualport>
+    </interface>
+    ...
+  </devices>
+  ...</pre>
+
     <h5><a name="elementsNICSSlirp">Userspace SLIRP stack</a></h5>
 
     <p>
diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng
index 162ea3d..cc8b1dc 100644
--- a/docs/schemas/networkcommon.rng
+++ b/docs/schemas/networkcommon.rng
@@ -79,6 +79,18 @@
         </element>
       </group>
       <group>
+        <element name="virtualport">
+          <attribute name="type">
+            <value>midonet</value>
+          </attribute>
+          <element name="parameters">
+            <attribute name="interfaceid">
+              <ref name="UUID"/>
+            </attribute>
+          </element>
+        </element>
+      </group>
+      <group>
         <!-- use this when no type attribute is present -->
         <element name="virtualport">
           <optional>
diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c
index 8da0838..1641a3e 100644
--- a/src/conf/netdev_vport_profile_conf.c
+++ b/src/conf/netdev_vport_profile_conf.c
@@ -260,7 +260,8 @@ virNetDevVPortProfileFormat(virNetDevVPortProfilePtr virtPort,
         virBufferAsprintf(buf, " instanceid='%s'", uuidstr);
     }
     if (virtPort->interfaceID_specified &&
-        (type == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH ||
+        (type == VIR_NETDEV_VPORT_PROFILE_MIDONET ||
+         type == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH ||
          type == VIR_NETDEV_VPORT_PROFILE_NONE)) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
 
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-midonet.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-midonet.xml
new file mode 100644
index 0000000..ae5a174
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-midonet.xml
@@ -0,0 +1,35 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219136</memory>
+  <currentMemory unit='KiB'>219136</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='i686' machine='pc'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/bin/qemu</emulator>
+    <disk type='block' device='disk'>
+      <source dev='/dev/HostVG/QEMUGuest1'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'/>
+    <controller type='ide' index='0'/>
+    <controller type='pci' index='0' model='pci-root'/>
+    <interface type='bridge'>
+      <mac address='00:11:22:33:44:55'/>
+      <source bridge='midonet'/>
+      <virtualport type='midonet'>
+        <parameters interfaceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/>
+      </virtualport>
+      <model type='virtio'/>
+    </interface>
+    <memballoon model='virtio'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 99d4629..ba1157c 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -275,6 +275,7 @@ mymain(void)
     DO_TEST("net-virtio-network-portgroup");
     DO_TEST("net-hostdev");
     DO_TEST("net-hostdev-vfio");
+    DO_TEST("net-midonet");
     DO_TEST("net-openvswitch");
     DO_TEST("sound");
     DO_TEST("sound-device");
-- 
2.3.0




More information about the libvir-list mailing list