Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,18 @@ IP address to use for configuration of SPICE consoles in instances.

Whether to resume instances on boot or not.

* `compute.block-device-allocate-retries` Number of attempts when waiting
for a volume to be created

Unset by default (nova's own default applies, currently 60 attempts).
Increase for slow volume backends that abort VM builds with
"Volume ... did not finish being created even after we waited ...".

* `compute.block-device-allocate-retries-interval` Interval in seconds
between volume creation attempts

Unset by default (nova's own default applies, currently 3 seconds).

* `compute.flavors` Flavor of the compute host

Comma separated string of Flavors like SEV, SRIOV, DPDK.
Expand Down
2 changes: 2 additions & 0 deletions openstack_hypervisor/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ def _get_local_ip_by_default_route() -> str:
"compute.key": UNSET,
"compute.migration-address": UNSET,
"compute.resume-on-boot": True,
"compute.block-device-allocate-retries": UNSET,
"compute.block-device-allocate-retries-interval": UNSET,
"compute.cpu-pinning-profile": UNSET,
"compute.flavors": UNSET,
"compute.pci-device-specs": [],
Expand Down
9 changes: 9 additions & 0 deletions templates/nova.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ metadata_workers = 4

resume_guests_state_on_host_boot = {{ compute.resume_on_boot }}

{% if compute.block_device_allocate_retries -%}
# Number of times to retry waiting for a volume to be created
block_device_allocate_retries = {{ compute.block_device_allocate_retries }}
{% endif -%}
{% if compute.block_device_allocate_retries_interval -%}
# Interval in seconds between volume creation retries
block_device_allocate_retries_interval = {{ compute.block_device_allocate_retries_interval }}
{% endif -%}

# To collect compute node related metrics
compute_monitors = cpu.virt_driver

Expand Down
19 changes: 19 additions & 0 deletions tests/unit/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
},
"compute": {
"resume_on_boot": False,
"block_device_allocate_retries": "",
"block_device_allocate_retries_interval": "",
"multipath_enabled": False,
"virt_type": "kvm",
"cpu_mode": "host-passthrough",
Expand Down Expand Up @@ -96,6 +98,23 @@ def test_nova_clients_use_internal_interface():
) == 1


def test_nova_block_device_allocate_retries_only_render_when_set():
output = _render("nova.conf.j2")

assert "block_device_allocate_retries" not in output
assert "block_device_allocate_retries_interval" not in output

compute = {
**BASE_CONTEXT["compute"],
"block_device_allocate_retries": "120",
"block_device_allocate_retries_interval": "3",
}
output = _render("nova.conf.j2", compute=compute)

assert "block_device_allocate_retries = 120" in output
assert "block_device_allocate_retries_interval = 3" in output


def test_neutron_clients_use_internal_interface():
output = _render("neutron.conf.j2")

Expand Down
Loading