add [libvirt]/max_queues config option
This change adds a max_queues config option to allow operators to set the maximium number of virtio queue pairs that can be allocated to a virtio network interface. Change-Id: I9abe783a9a9443c799e7c74a57cc30835f679a01 Closes-Bug: #1847367
This commit is contained in:
parent
449a5e770b
commit
0e6aac3c2d
|
@ -1312,6 +1312,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
|
||||
v2.10."""),
|
||||
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.
|
||||
"""),
|
||||
|
||||
]
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -225,6 +225,13 @@ class LibvirtGenericVIFDriver(object):
|
|||
return (driver, vhost_queues)
|
||||
|
||||
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
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
other:
|
||||
- |
|
||||
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`: https://bugs.launchpad.net/nova/+bug/1847367
|
Loading…
Reference in New Issue