]> xenbits.xensource.com Git - osstest/openstack-nova.git/commitdiff
vif: allow for creation of multiqueue taps in vrouter
authorRoman Podoliaka <rpodolyaka@mirantis.com>
Thu, 3 Nov 2016 10:51:48 +0000 (12:51 +0200)
committerMatt Riedemann <mriedem@us.ibm.com>
Sat, 26 Nov 2016 15:30:21 +0000 (10:30 -0500)
This extends the work done in libvirt-virtio-net-multiqueue bp to
allow for enabling multiqueue mode for vrouter VIFs (OpenContrail).
In case of vrouter mechanism is slightly different and a tap device
created by nova-compute must already be in the multiqueue mode,
when it's passed to vrouter.

Implements blueprint vif-vrouter-multiqueue

Co-Authored-By: Michal Dubiel <md@semihalf.com>
Change-Id: I7b20650c8a772fdaa05707e0dfe27ad32481a2d3

nova/tests/unit/virt/libvirt/test_vif.py
nova/virt/libvirt/vif.py
releasenotes/notes/vif-vrouter-multiqueue-077785e1a2d242a0.yaml [new file with mode: 0644]

index 729b62098f4c2439e5d912022330eb35e5c140f0..5d211864e646584408d18acbae2dfa2ea8d908d6 100644 (file)
@@ -937,6 +937,7 @@ class LibvirtVifTestCase(test.NoDBTestCase):
         instance.uuid = '46a4308b-e75a-4f90-a34a-650c86ca18b2'
         instance.project_id = 'b168ea26fa0c49c1a84e1566d9565fa5'
         instance.display_name = 'instance1'
+        instance.image_meta = objects.ImageMeta.from_dict({'properties': {}})
         with mock.patch.object(utils, 'execute') as execute:
             d.plug(instance, self.vif_vrouter)
             execute.assert_has_calls([
@@ -958,6 +959,36 @@ class LibvirtVifTestCase(test.NoDBTestCase):
                     '--tx_vlan_id=-1 '
                     '--rx_vlan_id=-1', run_as_root=True)])
 
+    @mock.patch('nova.network.linux_net.create_tap_dev')
+    def test_plug_vrouter_with_details_multiqueue(self, mock_create_tap_dev):
+        d = vif.LibvirtGenericVIFDriver()
+        instance = mock.Mock()
+        instance.name = 'instance-name'
+        instance.uuid = '46a4308b-e75a-4f90-a34a-650c86ca18b2'
+        instance.project_id = 'b168ea26fa0c49c1a84e1566d9565fa5'
+        instance.display_name = 'instance1'
+        instance.image_meta = objects.ImageMeta.from_dict({
+            'properties': {'hw_vif_multiqueue_enabled': True}})
+        instance.flavor.vcpus = 2
+        with mock.patch.object(utils, 'execute') as execute:
+            d.plug(instance, self.vif_vrouter)
+            mock_create_tap_dev.assert_called_once_with('tap-xxx-yyy-zzz',
+                                                        multiqueue=True)
+            execute.assert_called_once_with(
+                'vrouter-port-control',
+                '--oper=add --uuid=vif-xxx-yyy-zzz '
+                '--instance_uuid=46a4308b-e75a-4f90-a34a-650c86ca18b2 '
+                '--vn_uuid=network-id-xxx-yyy-zzz '
+                '--vm_project_uuid=b168ea26fa0c49c1a84e1566d9565fa5 '
+                '--ip_address=0.0.0.0 '
+                '--ipv6_address=None '
+                '--vm_name=instance1 '
+                '--mac=ca:fe:de:ad:be:ef '
+                '--tap_name=tap-xxx-yyy-zzz '
+                '--port_type=NovaVMPort '
+                '--tx_vlan_id=-1 '
+                '--rx_vlan_id=-1', run_as_root=True)
+
     def test_ivs_ethernet_driver(self):
         d = vif.LibvirtGenericVIFDriver()
         self._check_ivs_ethernet_driver(d,
index 059d212a57358e494d6c34330bab91745d1edcb4..2e9df69de33b45f3434249f9ee303443643b0fad 100644 (file)
@@ -144,6 +144,10 @@ class LibvirtGenericVIFDriver(object):
         designer.set_vif_host_backend_hostdev_pci_config(conf, pci_slot)
         return conf
 
+    def _is_multiqueue_enabled(self, image_meta, flavor):
+        _, vhost_queues = self._get_virtio_mq_settings(image_meta, flavor)
+        return vhost_queues > 1
+
     def _get_virtio_mq_settings(self, image_meta, flavor):
         """A methods to set the number of virtio queues,
            if it has been requested in extra specs.
@@ -770,7 +774,9 @@ class LibvirtGenericVIFDriver(object):
                     instance.display_name, vif['address'],
                     vif['devname'], ptype, -1, -1))
         try:
-            linux_net.create_tap_dev(dev)
+            multiqueue = self._is_multiqueue_enabled(instance.image_meta,
+                                                     instance.flavor)
+            linux_net.create_tap_dev(dev, multiqueue=multiqueue)
             utils.execute('vrouter-port-control', cmd_args, run_as_root=True)
         except processutils.ProcessExecutionError:
             LOG.exception(_LE("Failed while plugging vif"), instance=instance)
diff --git a/releasenotes/notes/vif-vrouter-multiqueue-077785e1a2d242a0.yaml b/releasenotes/notes/vif-vrouter-multiqueue-077785e1a2d242a0.yaml
new file mode 100644 (file)
index 0000000..6b33e99
--- /dev/null
@@ -0,0 +1,7 @@
+---
+features:
+  - When using libvirt driver, vrouter VIFs (OpenContrail) now supports
+    multiqueue mode, which allows to scale network performance across number
+    of vCPUs. To use this feature one needs to create instance with more than
+    1 vCPU from an image with ``hw_vif_multiqueue_enabled`` property set to
+    ``true``.