Browse Source

Merge "add [libvirt]/max_queues config option" into stable/train

Zuul 2 months ago
committed by Gerrit Code Review
4 changed files with 45 additions and 0 deletions
  1. +8
  2. +15
  3. +7
  4. +15

+ 8
- 0
nova/conf/ View File

@ -1319,6 +1319,14 @@ Configure virtio tx queue size.
This option is only usable for virtio-net device with vhost-user
backend. Available only with QEMU/KVM. Requires libvirt v3.7 QEMU
cfg.IntOpt('max_queues', default=None, min=1, help="""
The maximum number of virtio queue pairs that can be enabled
when creating a multiqueue guest. The number of virtio queues
allocated will be the lesser of the CPUs requested by the guest
and the max value defined. By default, this value is set to none
meaning the legacy limits based on the reported kernel
major version will be used.

+ 15
- 0
nova/tests/unit/virt/libvirt/ View File

@ -657,6 +657,21 @@ class LibvirtVifTestCase(test.NoDBTestCase):
def test_virtio_multiqueue_in_kernel_4(self, mock_uname):
self._test_virtio_multiqueue(10, '10')
@mock.patch('os.uname', return_value=('Linux', '', '2.6.32-21-generic'))
def test_virtio_multiqueue_in_kernel_2_max_queues(self, mock_uname):
self.flags(max_queues=2, group='libvirt')
self._test_virtio_multiqueue(10, '2')
@mock.patch('os.uname', return_value=('Linux', '', '3.19.0-47-generic'))
def test_virtio_multiqueue_in_kernel_3_max_queues(self, mock_uname):
self.flags(max_queues=2, group='libvirt')
self._test_virtio_multiqueue(10, '2')
@mock.patch('os.uname', return_value=('Linux', '', '4.2.0-35-generic'))
def test_virtio_multiqueue_in_kernel_4_max_queues(self, mock_uname):
self.flags(max_queues=2, group='libvirt')
self._test_virtio_multiqueue(10, '2')
def test_vhostuser_os_vif_multiqueue(self):
d = vif.LibvirtGenericVIFDriver()
hostimpl = host.Host("qemu:///system")

+ 7
- 0
nova/virt/libvirt/ View File

@ -248,6 +248,13 @@ class LibvirtGenericVIFDriver(object):
return False
def _get_max_tap_queues(self):
# Note(sean-k-mooney): some linux distros have backported
# changes for newer kernels which make the kernel version
# number unreliable to determine the max queues supported
# To address this without making the code distro dependent
# we introduce a new config option and prefer it if set.
if CONF.libvirt.max_queues:
return CONF.libvirt.max_queues
# NOTE(kengo.sakai): In kernels prior to 3.0,
# multiple queues on a tap interface is not supported.
# In kernels 3.x, the number of queues on a tap interface

+ 15
- 0
releasenotes/notes/virtio-max-queues-27f73e988c7e66ba.yaml View File

@ -0,0 +1,15 @@
- |
The nova libvirt virt driver supports creating instances with multi-queue
virtio network interfaces. In previous releases nova has based the maximum
number of virtio queue pairs that can be allocated on the reported kernel
major version. It has been reported in `bug #1847367`_ that some distros have
backported changes from later major versions that make major version
number no longer suitable to determine the maximum virtio queue pair count.
A new config option has been added to the libvirt section of the nova.conf.
When defined nova will now use the ``[libvirt]/max_queues`` option to
define the max queues that can be configured, if undefined it will
fallback to the previous kernel version approach.
.. _`bug #1847367`: