summaryrefslogtreecommitdiff
path: root/nova/tests
Commit message (Collapse)AuthorAgeFilesLines
* Make scheduler lazy-load the placement clientDan Smith2023-03-221-0/+36
| | | | | | | | | | | Like we did for conductor, this makes the scheduler lazy-load the placement client instead of only doing it during __init__. This avoids a startup crash if keystone or placement are not available, but retains startup failures for other problems and errors likely to be a result of misconfigurations. Closes-Bug: #2012530 Change-Id: I42ed876b84d80536e83d9ae01696b0a64299c9f7
* Merge "Unbind port when offloading a shelved instance"Zuul2023-03-133-22/+47
|\
| * Unbind port when offloading a shelved instanceArnaud Morin2022-11-293-22/+47
| | | | | | | | | | | | | | | | | | | | When offloading a shelved instance, the compute needs to remove the binding so the port will appear as "unbound" in neutron. Closes-Bug: 1983471 Change-Id: Ia49271b126870c7936c84527a4c39ab96b6c5ea7 Signed-off-by: Arnaud Morin <arnaud.morin@ovhcloud.com>
* | Merge "fup for power management series"Zuul2023-03-091-3/+3
|\ \
| * | fup for power management seriesSylvain Bauza2023-02-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Emptying the cpu init file and directly calling the submodule API. Relates to blueprint libvirt-cpu-state-mgmt Change-Id: I1299ca4b49743f58bec6f541785dd9fbee0ae9e2
* | | Merge "Revert "Add logging to find test cases leaking libvirt threads""27.0.0.0rc127.0.0Zuul2023-03-041-26/+0
|\ \ \
| * | | Revert "Add logging to find test cases leaking libvirt threads"Sylvain Bauza2023-02-141-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1778a9c589cf24e17b44f556680b17af9577df11. Reason for revert: We said we wouldn't have it in RC1. Change-Id: Idf0c9a8adeac231f099b312fc24b9cf9726687e0
* | | | Merge "Fix logging in MemEncryption-related checks"Zuul2023-02-282-2/+22
|\ \ \ \
| * | | | Fix logging in MemEncryption-related checksAlexey Stupnikov2023-02-112-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently Nova produces ambigous error when volume-backed instance is started using flavor with hw:mem_encryption extra_specs flag: ImageMeta doesn't contain name if it represents Cinder volume. This fix sligtly changes steps to get image_meta.name for some MemEncryption-related checks where it could make any difference. Closes-bug: #2006952 Change-Id: Ia69e7cb18cd862f01ecfdbdc358c87af1ab8fbf6
* | | | | Merge "Transport context to all threads"Zuul2023-02-271-1/+7
|\ \ \ \ \ | |_|_|/ / |/| | | |
| * | | | Transport context to all threadsFabian Wiesel2022-08-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The nova.utils.spawn and spawn_n methods transport the context (and profiling information) to the newly created threads. But the same isn't done when submitting work to thread-pools in the ComputeManager. The code doing that for spawn and spawn_n is extracted to a new function and called to submit the work to the thread-pools. Closes-Bug: #1962574 Change-Id: I9085deaa8cf0b167d87db68e4afc4a463c00569c
* | | | | Merge "Enable cpus when an instance is spawning"Zuul2023-02-184-0/+484
|\ \ \ \ \
| * | | | | Enable cpus when an instance is spawningSylvain Bauza2023-02-104-0/+484
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By this patch, we now automatically power down or up cores when an instance is either stopped or started. Also, by default, we now powersave or offline dedicated cores when starting the compute service. Implements: blueprint libvirt-cpu-state-mgmt Change-Id: Id645fd1ba909683af903f3b8f11c7f06db3401cb
* | | | | | Merge "libvirt: let CPUs be power managed"Zuul2023-02-182-0/+34
|\ \ \ \ \ \ | |/ / / / /
| * | | | | libvirt: let CPUs be power managedSylvain Bauza2023-02-102-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before going further, we need to somehow return the list of CPUs even offline if they are power managed by Nova. Co-Authored-By: Sean Mooney <smooney@redhat.com> Partially-Implements: blueprint libvirt-cpu-state-mgmt Change-Id: I5dca10acde0eff554ed139587aefaf2f5fad2ca5
* | | | | | Merge "libvirt: Add configuration options to set SPICE compression settings"Zuul2023-02-172-1/+89
|\ \ \ \ \ \
| * | | | | | libvirt: Add configuration options to set SPICE compression settingsManuel Bentele2023-01-112-1/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the following SPICE-related options to the 'spice' configuration group of a Nova configuration: - image_compression - jpeg_compression - zlib_compression - playback_compression - streaming_mode These configuration options can be used to enable and set the SPICE compression settings for libvirt (QEMU/KVM) provisioned instances. Each configuration option is optional and can be set explictly to configure the associated SPICE compression setting for libvirt. If all configuration options are not set, then none of the SPICE compression settings will be configured for libvirt, which corresponds to the behavior before this change. In this case, the built-in defaults from the libvirt backend (e.g. QEMU) are used. Note that those options are only taken into account if SPICE support is enabled (and the VNC support is disabled). Implements: blueprint nova-support-spice-compression-algorithm Change-Id: Ia7efeb1b1a04504721e1a5bdd1b5fa7a87cdb810
* | | | | | | Merge "cpu: interfaces for managing state and governor"Zuul2023-02-154-0/+237
|\ \ \ \ \ \ \ | | |/ / / / / | |/| | | | |
| * | | | | | cpu: interfaces for managing state and governorSylvain Bauza2023-02-094-0/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first stage of the power management series. In order to be able to switch the CPU state or change the governor, we need a framework to access sysfs. As some bits can be reused, let's create a nova.filesystem helper module that will define read-write mechanisms for accessing sysfs-specific commands. Partially-Implements: blueprint libvirt-cpu-state-mgmt Change-Id: Icb913ed9be8d508de35e755a9c650ba25e45aca2
* | | | | | | Merge "Add logging to find test cases leaking libvirt threads"Zuul2023-02-141-0/+26
|\ \ \ \ \ \ \ | |_|_|_|/ / / |/| | | | / / | | |_|_|/ / | |/| | | |
| * | | | | Add logging to find test cases leaking libvirt threadsSylvain Bauza2023-02-101-0/+26
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We see functional test failures due to leaked libvirt event handling thread weaking up after its original test finished and importing libvirt. If it happens when the libvirt package import is poisoned then the currently executing test will fail. This patch logs the name of the test case that leaked the libvirt event handling thread. We will revert his before RC1. Change-Id: I3146e9afb411056d004fc118ccfa31126a3c6b15 Related-Bug: #1946339
* | | | | Stable compute uuid functional testsDan Smith2023-02-011-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a number of functional test cases for the stable-compute-uuid error cases. Specifically around checks and aborted startups to make sure we're catching what we expect, and failing in the appropriate ways. Related to blueprint stable-compute-uuid Change-Id: I8bcb93a6887ed06dbd4b7c28c93a20a3705a6077
* | | | | Abort startup if nodename conflict is detectedDan Smith2023-02-012-0/+23
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do run update_available_resource() synchronously during service startup, but we only allow certain exceptions to abort startup. This makes us abort for InvalidConfiguration, and makes the resource tracker raise that for the case where the compute node create failed due to a duplicate entry. This also modifies the object to raise a nova-specific error for that condition to avoid the compute node needing to import oslo_db stuff just to be able to catch it. Change-Id: I5de98e6fe52e45996bc2e1014fa8a09a2de53682
* | | | Protect against a deleted node id fileDan Smith2023-02-012-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we are starting up for the first time, we expect to generate and write a node_uuid file if one does not exist. If we are upgrading, we expect to do the same. However, if we are starting up not after an upgrade and not for the first time, a missing compute_id file is an error, and we should abort. Because of the additional check that this adds, which is called from a variety of places that don't have the stable compute node singleton stubbed to make it happy, this mocks the check for any test that does not specifically aim to exercise it. Related to blueprint stable-compute-uuid Change-Id: If83ce14b96e7d84ae38eba9d798754557d5abdfd
* | | | Check our nodes for hypervisor_hostname changesDan Smith2023-02-011-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we are loading our ComputeNode objects by UUID according to what the virt driver reported, we can sanity check the DB records against the virt driver's hostname. This covers the case where our CONF.host has not changed but the hostname reported by the virt driver has, assuming we can find the ComputeNode object(s) that match our persistent node uuid. Related to blueprint stable-compute-uuid Change-Id: I41635210d7d6f46b437b06d2570a26a80ed8676a
* | | | Merge "api: extend evacuate instance to support target state"Zuul2023-02-0117-22/+182
|\ \ \ \
| * | | | api: extend evacuate instance to support target stateSahid Orentino Ferdjaoui2023-01-3117-22/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Start to v2.95 any evacuated instances will be stopped a destination Implements: bp/allowing-target-state-for-evacuate Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> Change-Id: I141b6f057cc4eb9c541c2bc6eddae27270ede08d
* | | | | Merge "compute: enhance compute evacuate instance to support target state"Zuul2023-02-016-42/+126
|\ \ \ \ \ | |/ / / /
| * | | | compute: enhance compute evacuate instance to support target stateSahid Orentino Ferdjaoui2023-01-316-42/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to the bp/allowing-target-state-for-evacuate. This change is extending compute API to accept a new argument targetState. The targetState argument when set will force state of an evacuated instance to the destination host. Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> Change-Id: I9660d42937ad62d647afc6be965f166cc5631392
* | | | | Merge "Detect host renames and abort startup"Zuul2023-02-011-3/+51
|\ \ \ \ \
| * | | | | Detect host renames and abort startupDan Smith2023-01-301-3/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Except on ironic, if we are able to determine that our locally- configured node has a hostname other than what we expect, we should abort startup. Since we currently depend on the loose name-based association of nodes, services, and instances, we need to make sure we do not startup in an inconsistent configuration. Related to blueprint stable-compute-uuid Change-Id: I595b27a57516cffe1f172cf2fb736e1b11373a1d
* | | | | | Merge "Add further workaround features for qemu_monitor_announce_self"Zuul2023-01-311-0/+16
|\ \ \ \ \ \ | |/ / / / / |/| | | | |
| * | | | | Add further workaround features for qemu_monitor_announce_selfas02023-01-301-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases on Arista VXLAN fabrics, VMs are inaccessible via network after live migration, despite garps being observed on the fabric itself. This patch builds on the feature ``[workarounds]/enable_qemu_monitor_announce_self`` feature as reported in `bug 1815989 <https://bugs.launchpad.net/nova/+bug/1815989>` This patch adds the ability to config the number of times the QEMU announce_self monitor command is called, and add a new configuration option to specify a delay between calling the announce_self command multiple times, as in some cases, multiple announce_self monitor commands are required for the fabric to honor the garp packets and the VM to become accessible via the network after live migration. Closes-Bug: #1996995 Change-Id: I2f5bf7c9de621bb1dc7fae5b3374629a4fcc1f46
* | | | | | Fixup patch for stable-compute-uuid seriesDan Smith2023-01-303-5/+4
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minor cleanups from feedback on earlier patches. Related to blueprint stable-compute-uuid Change-Id: I00505f1df47b46ed36645c781354258e255f0dcc
* | | | | Make resource tracker use UUIDs instead of namesDan Smith2023-01-304-100/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the resource tracker look up and create ComputeNode objects by uuid instead of nodename. For drivers like ironic that already provide 'uuid' in the resources dict, we can use that. For those that do not, we force the uuid to be the locally-persisted node uuid, and use that to find/create the ComputeNode object. A (happy) side-effect of this is that if we find a deleted compute node object that matches that of our hypervisor, we undelete it instead of re-creating one with a new uuid, which may clash with our old one. This means we remove some of the special-casing of ironic rebalance, although the tests for that still largely stay the same. Change-Id: I6a582a38c302fd1554a49abc38cfeda7c324d911
* | | | | Merge "Persist existing node uuids locally"Zuul2023-01-301-9/+127
|\ \ \ \ \
| * | | | | Persist existing node uuids locallyDan Smith2023-01-201-9/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we start up from an older service version, we need to look at the database to determine what our node is and write it locally. This leap of faith will be the last time we need to look up our node based on our hostname. Instead of relying on this, operators can (ideally) pre-populate the compute node identities for maximum safety. Change-Id: I178700bf5ba172603593b1c9972520d05face849
* | | | | | Merge "Fix rescue volume-based instance"Zuul2023-01-302-11/+208
|\ \ \ \ \ \
| * | | | | | Fix rescue volume-based instanceRajesh Tailor2022-08-262-11/+208
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of now, when attempting to rescue a volume-based instance using an image without the hw_rescue_device and/or hw_rescue_bus properties set, the rescue api call fails (as non-stable rescue for volume-based instances are not supported) leaving the instance in error state. This change checks for hw_rescue_device/hw_rescue_bus image properties before attempting to rescue and if the property is not set, then fail with proper error message, without changing instance state. Related-Bug: #1978958 Closes-Bug: #1926601 Change-Id: Id4c8c5f3b32985ac7d3d7c833b82e0876f7367c1
* | | | | | | Merge "Add get_available_node_uuids() to virt driver"Zuul2023-01-274-3/+13
|\ \ \ \ \ \ \ | | |/ / / / / | |/| | | | |
| * | | | | | Add get_available_node_uuids() to virt driverDan Smith2023-01-204-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a get_available_node_uuids() method to the virt driver interface. This aims to eventually replace the nodename-based interface, but currently provides an implementation that will work for most drivers. Any driver that does not override this method will get the locally-persistent UUID from nova.virt.node. Ironic obviously needs to override this (which is easy), as well as the fake driver because it supports multiple nodes for testing. The libvirt driver overrides it only because we test multiple libvirt driver instances on a single host and we need each instantiation of it to "capture" the UUID we have mocked out at the time it is started. Change-Id: Ibe14d2b223c737d82c217a74bc94e41603271a9d
* | | | | | | Merge "Pass service ref to init_host(), if exists"Zuul2023-01-262-13/+14
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Pass service ref to init_host(), if existsDan Smith2023-01-202-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This just adds the service ref to init_host() so that we can pass it (if it exists) at startup. On the first run, this will be None, so we know that we don't have an existing service record and thus do not need to do any migration. Related to blueprint stable-compute-uuid Change-Id: I1491c9b234ef0c262b5ed01d4c138eba8dedff77
* | | | | | | Merge "Add virt/node module for stable uuids"Zuul2023-01-263-0/+157
|\ \ \ \ \ \ \ | |/ / / / / /
| * | | | | | Add virt/node module for stable uuidsDan Smith2023-01-203-0/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to blueprint stable-compute-uuid Change-Id: Ie8897a843fadf325c696b411923f075e237a7342
* | | | | | | Merge "libvirt: Replace usage of compareCPU() with compareHypervisorCPU()"Zuul2023-01-262-18/+28
|\ \ \ \ \ \ \
| * | | | | | | libvirt: Replace usage of compareCPU() with compareHypervisorCPU()Kashyap Chamarthy2023-01-242-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The older libvirt API compareCPU() does not take into account the capabilities of the "host hypervisor" (KVM, QEMU and the details libvirt knows about the host) when comparing CPUs. This is causing unwanted failures during CPU compatibility checks. To fix this and other related problems, libvirt has introduced (in v4.4.0) a newer API, compareHypervisorCPU(), which _does_ take into account the host hypervisor's capabilities before comparing CPUs. This will help fix a range of problems, such as[1][2]. So let's switch to the newer API, which is largely a drop-in replacement. In this patch: - Introduce a wrapper method, compare_hypervisor_cpu() for libvirt's compareHypervisorCPU() API. - Update the _compare_cpu() method to use the wrapper method, compare_hypervisor_cpu(). - Update the unit tests to use the newer API, compareHypervisorCPU(). [1] https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1978064 [2] https://bugzilla.redhat.com/show_bug.cgi?id=2138381 Change-Id: Ib523753f52993cfe72e35e0309e429ca879c125c Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
* | | | | | | | Merge "libvirt: At start-up rework compareCPU() usage with a workaround"Zuul2023-01-261-3/+19
|\ \ \ \ \ \ \ \ | |/ / / / / / /
| * | | | | | | libvirt: At start-up rework compareCPU() usage with a workaroundKashyap Chamarthy2023-01-241-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this patch: - Remove the first compareCPU() call (called via the wrapper _compare_cpu()) in _check_cpu_compatibility(), and let libvirt handle it. (QEMU >=2.9 and libvirt >= 4.4.0 are the mininum required versions, and upstream Nova satisfies them by a good margin.) - Validate the user-configured CPU models from _get_cpu_model_mapping(). And take into account all the CPU flags before calling _compare_cpu(). (Suggested-by: Sean Mooney -- thanks!) - Add a workaround to allow skipping the remaining compareCPU() call in _check_cpu_compatibility() as a potential future-proof (because we cannot test all possible CPU models and hardware). Unlike the removed first call, this call takes into account the extra CPU flags provided by the user into account when evaluating guest CPU model compatibility. As a follow up comes the patch[1] that replaces the older libvirt CPU API with the newer one. [1] https://review.opendev.org/c/openstack/nova/+/869950 -- libvirt: Replace usage of compareCPU() with compareHypervisorCPU() Change-Id: I8ef9db851b37c5249d2efbe09a15a1ddbae8205d Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
* | | | | | | | Merge "Handle InstanceInvalidState exception"Zuul2023-01-262-0/+32
|\ \ \ \ \ \ \ \