Expose rx/tx_queue_size

Add support for configuring the `rx_queue_size` and `tx_queue_size`
options in the virtio-net driver via nova.conf

Related to nova change: Ib6d4a2d6b9072db42d11ecdde0950cf7a7781944

Change-Id: I71c3988f4a08bce848618555210a6b90415a7f71
This commit is contained in:
Oliver Walsh 2018-04-30 14:19:55 +01:00
parent 2e84826e90
commit 0a9202d0a6
3 changed files with 38 additions and 1 deletions

View File

@ -137,6 +137,16 @@
# https://libvirt.org/logging.html
# Defaults to undef
#
# [*rx_queue_size*]
# (optional) virtio-net rx queue size
# Valid values are 256, 512, 1024
# Defaults to $::os_service_default
#
# [*tx_queue_size*]
# (optional) virtio-net tx queue size
# Valid values are 256, 512, 1024
# Defaults to $::os_service_default
#
class nova::compute::libvirt (
$ensure_package = 'present',
$libvirt_virt_type = 'kvm',
@ -163,6 +173,8 @@ class nova::compute::libvirt (
$preallocate_images = $::os_service_default,
$manage_libvirt_services = true,
$log_outputs = undef,
$rx_queue_size = $::os_service_default,
$tx_queue_size = $::os_service_default,
) inherits nova::params {
include ::nova::deps
@ -199,6 +211,14 @@ class nova::compute::libvirt (
}
}
unless $rx_queue_size == $::os_service_default or $rx_queue_size in [256, 512, 1024] {
fail("Invalid rx_queue_size parameter: ${rx_queue_size}")
}
unless $tx_queue_size == $::os_service_default or $tx_queue_size in [256, 512, 1024] {
fail("Invalid_tx_queue_size parameter: ${tx_queue_size}")
}
# manage_libvirt_services is here for backward compatibility to support
# deployments that do not include nova::compute::libvirt::services
#
@ -234,6 +254,8 @@ class nova::compute::libvirt (
'libvirt/hw_disk_discard': value => $libvirt_hw_disk_discard;
'libvirt/hw_machine_type': value => $libvirt_hw_machine_type;
'libvirt/enabled_perf_events': value => join(any2array($libvirt_enabled_perf_events), ',');
'libvirt/rx_queue_size': value => $rx_queue_size;
'libvirt/tx_queue_size': value => $tx_queue_size;
}
# cpu_model param is only valid if cpu_mode=custom

View File

@ -0,0 +1,9 @@
---
features:
- |
Add support for configuring rx/tx queue sizes
Adds support for configuring the rx_queue_size and tx_queue_size options in the QEMU virtio-net driver by way of nova.conf. Only supported for vhost/vhostuser interfaces.
Currently, valid values for the ring buffer sizes are 256, 512, and 1024.
Adjustable RX queue sizes requires QEMU 2.7.0, and libvirt 2.3.0 (or newer) Adjustable TX queue sizes requires QEMU 2.10.0, and libvirt 3.7.0 (or newer)

View File

@ -60,6 +60,8 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_base_images').with_ensure('absent')}
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_ensure('absent')}
it { is_expected.to contain_nova_config('libvirt/rx_queue_size').with_value('<SERVICE DEFAULT>')}
it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value('<SERVICE DEFAULT>')}
end
describe 'with params' do
@ -83,7 +85,9 @@ describe 'nova::compute::libvirt' do
:virtlog_service_name => 'virtlog',
:compute_driver => 'libvirt.FoobarDriver',
:preallocate_images => 'space',
:log_outputs => '1:file:/var/log/libvirt/libvirtd.log'
:log_outputs => '1:file:/var/log/libvirt/libvirtd.log',
:rx_queue_size => 512,
:tx_queue_size => 1024,
}
end
@ -107,6 +111,8 @@ describe 'nova::compute::libvirt' do
it { is_expected.to contain_nova_config('DEFAULT/remove_unused_original_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_nova_config('libvirt/remove_unused_resized_minimum_age_seconds').with_value(3600)}
it { is_expected.to contain_libvirtd_config('log_outputs').with_value("\"#{params[:log_outputs]}\"")}
it { is_expected.to contain_nova_config('libvirt/rx_queue_size').with_value(512)}
it { is_expected.to contain_nova_config('libvirt/tx_queue_size').with_value(1024)}
it {
is_expected.to contain_service('libvirt').with(
:name => 'custom_service',