]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
libvirt: add supported vif types for virtuozzo virt_type
authorMaxim Nestratov <mnestratov@virtuozzo.com>
Tue, 6 Sep 2016 08:33:05 +0000 (11:33 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Thu, 20 Oct 2016 12:14:24 +0000 (15:14 +0300)
Enable vif driver configuring for virtuozzo and make configuration
parameter use_virtio_for_bridges be usable for virtuozzo hypervisor.

Change-Id: Ied17a5406d5625f1e9f704e5b9b46d300f2870c2
Closes-Bug: #1635230

nova/tests/unit/virt/libvirt/test_vif.py
nova/virt/libvirt/vif.py
releasenotes/notes/virtuozzo_vif_types-6e50217b295a1589.yaml [new file with mode: 0644]

index 6972a594f378c5d32981ad86b52f1b7faa2680b1..a5638ada3770a7db4ac6da4d76fe2af7965b40bb 100644 (file)
@@ -641,18 +641,31 @@ class LibvirtVifTestCase(test.NoDBTestCase):
         xml = self._get_instance_xml(d, self.vif_bridge)
         self._assertModel(xml, network_model.VIF_MODEL_VIRTIO)
 
-    def test_model_kvm_qemu_custom(self):
-        for virt in ('kvm', 'qemu'):
+    def test_model_parallels(self):
+        self.flags(use_virtio_for_bridges=True,
+                   virt_type='parallels',
+                   group='libvirt')
+
+        d = vif.LibvirtGenericVIFDriver()
+        xml = self._get_instance_xml(d, self.vif_bridge)
+        self._assertModel(xml, network_model.VIF_MODEL_VIRTIO)
+
+    def test_model_kvm_qemu_parallels_custom(self):
+        for virt in ('kvm', 'qemu', 'parallels'):
             self.flags(use_virtio_for_bridges=True,
                        virt_type=virt,
                        group='libvirt')
 
             d = vif.LibvirtGenericVIFDriver()
-            supported = (network_model.VIF_MODEL_NE2K_PCI,
-                         network_model.VIF_MODEL_PCNET,
-                         network_model.VIF_MODEL_RTL8139,
-                         network_model.VIF_MODEL_E1000,
-                         network_model.VIF_MODEL_SPAPR_VLAN)
+            if virt == 'parallels':
+                supported = (network_model.VIF_MODEL_RTL8139,
+                             network_model.VIF_MODEL_E1000)
+            else:
+                supported = (network_model.VIF_MODEL_NE2K_PCI,
+                             network_model.VIF_MODEL_PCNET,
+                             network_model.VIF_MODEL_RTL8139,
+                             network_model.VIF_MODEL_E1000,
+                             network_model.VIF_MODEL_SPAPR_VLAN)
             for model in supported:
                 image_meta = objects.ImageMeta.from_dict(
                     {'properties': {'hw_vif_model': model}})
index b1591ee143ed16b2faefe47879ff84b26a6eec4d..5339a7b50f6d2cb953c0237d6b9289d10f09749f 100644 (file)
@@ -68,6 +68,9 @@ def is_vif_model_valid_for_virt(virt_type, vif_model):
                 network_model.VIF_MODEL_E1000],
         'lxc': [],
         'uml': [],
+        'parallels': [network_model.VIF_MODEL_VIRTIO,
+                      network_model.VIF_MODEL_RTL8139,
+                      network_model.VIF_MODEL_E1000],
         }
 
     if vif_model is None:
@@ -107,10 +110,10 @@ class LibvirtGenericVIFDriver(object):
         if image_meta:
             model = osinfo.HardwareProperties(image_meta).network_model
 
-        # Else if the virt type is KVM/QEMU, use virtio according
-        # to the global config parameter
+        # Else if the virt type is KVM/QEMU/VZ(Parallels), then use virtio
+        # according to the global config parameter
         if (model is None and
-            virt_type in ('kvm', 'qemu') and
+            virt_type in ('kvm', 'qemu', 'parallels') and
                     CONF.libvirt.use_virtio_for_bridges):
             model = network_model.VIF_MODEL_VIRTIO
 
@@ -124,7 +127,7 @@ class LibvirtGenericVIFDriver(object):
                                            model):
             raise exception.UnsupportedHardware(model=model,
                                                 virt=virt_type)
-        if (virt_type == 'kvm' and
+        if (virt_type in ('kvm', 'parallels') and
             model == network_model.VIF_MODEL_VIRTIO):
             vhost_drv, vhost_queues = self._get_virtio_mq_settings(image_meta,
                                                                    inst_type)
diff --git a/releasenotes/notes/virtuozzo_vif_types-6e50217b295a1589.yaml b/releasenotes/notes/virtuozzo_vif_types-6e50217b295a1589.yaml
new file mode 100644 (file)
index 0000000..a3e9d3c
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - A list of valid vif models is extended for
+    Virtuozzo hypervisor (virt_type=parallels) with
+    VIRTIO, RTL8139 and E1000 models.