Allow overriding libvirt/num_pcie_ports

Especially with arm64/aarch64, the default value limits the number of
volume attachments to two usually. And when more than two volumes are to
be attached, it will fail with "No more available PCI slots". There is
no one-size-fits-all value here so let operators override the default
value.

Closes-Bug: #1944214
Change-Id: I9b9565873cbaeb575704b94a25d0a8556ab96292
This commit is contained in:
Nobuto Murata 2021-09-24 16:01:59 +09:00
parent 7d850b2754
commit 22523e5b54
6 changed files with 23 additions and 0 deletions

@ -294,6 +294,15 @@ options:
preemption and avoiding packet drops. Only works with Rocky and later,
since QEMU 2.7.0 and libvirt 2.3.0. Default value 256. Authorized
values [256, 512, 1024].
num-pcie-ports:
type: int
default:
description: |
Sets libvirt/num_pcie_ports option in nova.conf to assign more
PCIe ports available for a VM. The default value relies on libvirt
calculating amount of ports. The maximum value can be set is "28".
.
This option is only available from the Rocky release and later.
worker-multiplier:
type: float
default:

@ -298,6 +298,9 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
ctxt['virtio_net_rx_queue_size'] = (
config('virtio-net-rx-queue-size'))
if config('num-pcie-ports'):
ctxt['num_pcie_ports'] = config('num-pcie-ports')
ctxt['reserved_host_memory'] = config('reserved-host-memory')
db = kv()

@ -305,6 +305,9 @@ tx_queue_size = {{ virtio_net_tx_queue_size }}
{% if virtio_net_rx_queue_size -%}
rx_queue_size = {{ virtio_net_rx_queue_size }}
{% endif %}
{% if num_pcie_ports -%}
num_pcie_ports = {{ num_pcie_ports }}
{% endif %}
{% if virt_type == 'lxd' -%}
[lxd]

@ -318,6 +318,9 @@ tx_queue_size = {{ virtio_net_tx_queue_size }}
{% if virtio_net_rx_queue_size -%}
rx_queue_size = {{ virtio_net_rx_queue_size }}
{% endif %}
{% if num_pcie_ports -%}
num_pcie_ports = {{ num_pcie_ports }}
{% endif %}
{% if virt_type == 'lxd' -%}
[lxd]

@ -325,6 +325,9 @@ tx_queue_size = {{ virtio_net_tx_queue_size }}
{% if virtio_net_rx_queue_size -%}
rx_queue_size = {{ virtio_net_rx_queue_size }}
{% endif %}
{% if num_pcie_ports -%}
num_pcie_ports = {{ num_pcie_ports }}
{% endif %}
{% if virt_type == 'lxd' -%}
[lxd]

@ -738,6 +738,7 @@ class NovaComputeContextTests(CharmTestCase):
self.test_config.set('pci-passthrough-whitelist', 'mypcidevices')
self.test_config.set('virtio-net-tx-queue-size', 512)
self.test_config.set('virtio-net-rx-queue-size', 1024)
self.test_config.set('num-pcie-ports', 15)
self.test_config.set('cpu-shared-set', "4-12,^8,15")
self.test_config.set('cpu-dedicated-set', "0-3,^10,33")
libvirt = context.NovaComputeLibvirtContext()
@ -758,6 +759,7 @@ class NovaComputeContextTests(CharmTestCase):
'pci_passthrough_whitelist': 'mypcidevices',
'virtio_net_tx_queue_size': 512,
'virtio_net_rx_queue_size': 1024,
'num_pcie_ports': 15,
'default_ephemeral_format': 'ext4',
'cpu_shared_set': "4-12,^8,15",
'cpu_dedicated_set': "0-3,^10,33"}, libvirt())