Commit Graph

61824 Commits

Author SHA1 Message Date
Stephen Finucane aec74c1f23 libvirt: Ensure device alias is present
Our event listener depends on devices having an alias set. We add an
early assertion to prove this is the case. In real-life, this will
always be the case since the devices we can detach - like interfaces and
disks - are among the lists of devices that libvirt will automatically
generate an alias for if the user (nova-compute, in this case) doesn't
provide their own [1]. However, many of our tests were not doing this so
we must update our LibvirtFixture in particular to start doing so.

[1] https://github.com/libvirt/libvirt/blob/v11.10.0/src/qemu/qemu_alias.c#L692-L786

Change-Id: Id98d8029af673ffa89d6472be98f90a6f0975511
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-12-18 17:49:45 +00:00
Stephen Finucane c7d37ee3ce trivial: Use functools.wraps
Rather than setting dunder attributes manually.

Change-Id: I71bf90f5deacb11cbf6e39dfe459edd5a03f3d75
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-12-18 16:11:16 +00:00
Zuul 5b540e579e Merge "Make guestfs' Tpool usage optional" 2025-12-16 13:27:31 +00:00
Zuul fc19a29d20 Merge "Make libvirt Tpool proxying conditional" 2025-12-16 04:49:53 +00:00
Zuul fb992ef376 Merge "Make RBD Tpool usage conditional" 2025-12-16 04:49:40 +00:00
Zuul 3d8513301b Merge "api: Add response body schemas for simple tenant usage APIs" 2025-12-15 18:19:03 +00:00
Zuul 843ea54a5b Merge "api: Add response body schemas for tenant network APIs" 2025-12-15 18:03:40 +00:00
Zuul dadc136d11 Merge "api: Add response body schemas for server usage audit log APIs" 2025-12-15 18:03:27 +00:00
Zuul 706e2cf09d Merge "api: Add response body schemas for services APIs" 2025-12-15 18:03:15 +00:00
Zuul 1e14d75268 Merge "Drop direct dependency on iso8601" 2025-12-11 20:51:44 +00:00
Zuul 8a4b000216 Merge "Remove openSUSE/SLES from install guide" 2025-12-09 09:31:39 +00:00
Zuul f268b385dd Merge "Use consistent program name for wsgi scripts and entry points" 2025-12-08 22:18:34 +00:00
Zuul b1586dd09e Merge "Collect result of _live_migration_operation" 2025-12-05 18:10:54 +00:00
Zuul da1cddfb14 Merge "Fix missing guest.migrate(parallel=) mock arg" 2025-12-05 17:44:37 +00:00
Dan Smith 20a9f9d740 Collect result of _live_migration_operation
Without this, we won't notice errors raised in the operation thread.

Before 1cd1c472bd the unit test actually
forced such errors to be raised even if in the real code it would
never be raised. But that patch fixed the unit test fixture to be more
realistic without realizing that such fixture error also means that we
might have wrong assumptions about the code under test.

Now we know that exception from the live migration thread was
never raised back to the monitor thread. To improve logging we added a
future.result() call after the main monitoring code finished.

Also the code had complex way to signal the monitoring thread that the
migration thread returned early by registering a callback on the
migration thread and setting an event. This can be simplified to just
check the status of the future of the migration thread. So the event and
the callback is removed.

All this was found because commit 25fbf32f22
missed to add the new parallel arg to the mock of guest.migrate()
on master, but the exception was never propagated to the unit test on
master. Backporting that change showed that in the old unit test env
there is a valid exception.

Co-authored-by: Dan Smith <dms@danplanet.com>
Change-Id: I22683ad5118796c6406f80d8726053afa84fff56
Signed-off-by: Dan Smith <dansmith@redhat.com>
Signed-off-by: Balazs Gibizer <gibi@redhat.com>
2025-12-05 10:09:14 +01:00
Dan Smith 6c940f4c3c Fix missing guest.migrate(parallel=) mock arg
This was missed in commit 25fbf32f22
because of a bug in our _live_migration_operation() post-eventlet
handling.

Change-Id: I39a7d6ebd72d9938bcb60143dfc50bd6a9c994b0
Signed-off-by: Dan Smith <dansmith@redhat.com>
2025-12-05 10:09:14 +01:00
Zuul 1712ae48e3 Merge "libvirt: add configuration option for volume AIO mode" 2025-12-05 05:20:30 +00:00
Zuul 7bd20e52d1 Merge "pre-commit: Bump versions" 2025-12-04 15:33:55 +00:00
Zuul 5d3d0c870a Merge "ensure correct cleanup of multi-attach volumes" 2025-12-04 07:00:30 +00:00
Stephen Finucane 164c3f0f61 Remove openSUSE/SLES from install guide
This has not been supported for some time.

Change-Id: Ic7073740deb0bf9670eebe77f0f8b0daca100a5c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2025-12-02 16:35:38 +00:00
Takashi Kajinami 253aaec4bb Use consistent program name for wsgi scripts and entry points
Make sure that the consistent program name is always set,so that
the same config sub-directory ( /etc/{project}/{prog}.conf.d ) is used
regardless of the way api service is run.

Closes-Bug: #2098514
Change-Id: Ib5c6d431176b83eefafddc1b35589015db6dfd04
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
2025-12-02 02:57:25 +09:00
Zuul 23b462d77d Merge "[ironic] Ensure unprovision happens for new states" 2025-11-24 10:43:39 +00:00
Zuul 16e65e74b2 Merge "docs: Corrects a typo on a placement audit command" 2025-11-21 15:23:30 +00:00
Balazs Gibizer 3c095c6b8d Make guestfs' Tpool usage optional
When running in eventlet mode we keep the original eventlet.tpool usage
but when running in threading mode we call the functions directly on the
thread of the caller.

Change-Id: I779374814a8ed8b2146bea226afe1250dea63079
Signed-off-by: Balazs Gibizer <gibi@redhat.com>
2025-11-21 16:05:21 +01:00
Balazs Gibizer eda6792632 Make libvirt Tpool proxying conditional
When running in eventlet mode we keep the original eventlet.tpool usage
but when running in threading mode we call the functions directly on the
thread of the caller.

The patch_tpool_proxy() logic is removed from the libvirt driver as it
was only needed for python old style classes which is not in use any
more in python3 and the issue is not reproducible any more with
virConnect even without the patching.

❯ python3
Python 3.12.10 (main, Apr  9 2025, 04:44:59) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import eventlet
>>> eventlet.monkey_patch()
>>> from nova.virt.libvirt import host
>>> h = host.Host(uri="qemu:///system")
>>> h.get_connection()
libvirt:  error : internal error: could not initialize domain event timer
URI qemu:///system does not support events: internal error: could not initialize domain event timer
<libvirt.virConnect object at 0x7f829e94c170>
>>> c = h.get_connection()
>>> str(c)
'<libvirt.virConnect object at 0x7f829e94c170>'
>>>

Signed-off-by: Balazs Gibizer <gibi@redhat.com>
Change-Id: Ic60ab78cec2a9f9ba177568b69e738425e56cae1
2025-11-21 16:05:21 +01:00
Balazs Gibizer 8c8047ce2a Make RBD Tpool usage conditional
When running in eventlet mode we keep the original eventlet.tpool usage
but when running in threading mode we call the functions directly on the
thread of the caller.

Signed-off-by: Balazs Gibizer <gibi@redhat.com>
Change-Id: I08f257d49c87d0d8a87127f61157b1b0b5ca7b3c
2025-11-21 16:05:21 +01:00
Zuul 53df49b2ec Merge "Init virt driver before use" 2025-11-21 14:27:01 +00:00
Zuul c09e17582d Merge "api: Add response body schemas for security group APIs" 2025-11-20 23:35:27 +00:00
Jay Faulkner 56cb5f52fb [ironic] Ensure unprovision happens for new states
States were added to the Ironic API to enable the node servicing
feature, which can be performed on nodes provisioned with Nova
instances. Current nova, if asked to delete these instances, will only
remove the instance metadata and not tear them down.

This change has two parts:
- I have added the new, relevant states to _UNPROVISION_STATES in
  driver.py, which now allows Nova to know that SERVIC* states and
  DEPLOYHOLD are safe to unprovision from.
- I have added all existing ironic states to ironic_states.py and the
  PROVISION_STATE_LIST constant and check the state against it -- in a
  case where a completely unknown state is returned, we should attempt
  an unprovision.

This fix needs to be backported as far as possible, as this bug has
existed since Antelope / 2023.1 (DEPLOYHOLD) or Bobcat / 2023.3
(SERVIC*).

Assisted-by: Claude Code
Closes-bug: #2131960
Change-Id: I31c70d35b0e6e9f8d2252bfb2f0bdec477cc6cc7
Signed-off-by: Jay Faulkner <jay@jvf.cc>
2025-11-20 15:23:58 -08:00
melanie witt c5c1b93d21 libvirt: add configuration option for volume AIO mode
With the NFS, FC, and iSCSI Cinder volume backends, Nova explicitly
sets AIO mode ``io=native`` in the Libvirt guest XML. Operators may set
this option to True in order to defer AIO mode selection to QEMU if
forcing ``io=native`` is not desired.

Closes-Bug: #2129788

Change-Id: I6e51706b5cb8be5becebbafe9108df1ba9e0f69f
Signed-off-by: melanie witt <melwittt@gmail.com>
2025-11-19 12:04:31 -08:00
Zuul 53aadaf967 Merge "Update comment about migrated mypy conf files" 2025-11-19 17:50:23 +00:00
Zuul 94788200db Merge "TPM: support instances with host secret security" 2025-11-19 17:45:06 +00:00
Zuul 32ad7a036b Merge "TPM: support instances with user secret security" 2025-11-19 17:37:39 +00:00
Zuul d6b0961862 Merge "TPM: add RequestContext checks to functional tests" 2025-11-19 15:51:15 +00:00
Rajesh Tailor cec81f76fb Update comment about migrated mypy conf files
The change Ife39b55eb40c9cb8e61f1b2295b6d42cefe3a680 migrated mypy
configuration files from setup.cfg to pyproject.toml file, but a
comment in .pre-commit-config.yaml says to keep is in sync with
setup.cfg, which is incorrect.

This change updates comment in the .pre-commit-config.yaml file to
reflect the change.

Signed-off-by: Rajesh Tailor <ratailor@redhat.com>
Change-Id: I4d35b989e8c90b629bcb15438ad82f60f7ca8957
2025-11-19 11:47:50 +05:30
Zuul e2eefc277c Merge "api: Add response body schemas for floating IP APIs" 2025-11-18 18:08:36 +00:00
Zuul df6f5c3fdc Merge "api: Add response body schemas for volume attachments APIs" 2025-11-18 17:54:28 +00:00
Zuul c5ebda4d84 Merge "api: Add response body schemas for snapshots APIs" 2025-11-18 17:54:16 +00:00
Zuul 0c33871c36 Merge "Add managed='no' flag to libvirt XML definition for VIF type TAP" 2025-11-18 14:57:17 +00:00
Artom Lifshitz 245a321e43 TPM: support instances with host secret security
Start supporting booting instances with the `host` TPM secret
security. This means setting the `ephemeral` and `private` attributes
on the Libvirt secret correctly, and not undefining the secret once
the instance has spawned. The Libvirt fixture's Secret support is
extended to be able to test all that in a functional test.

For functional testing, we need to:

* Extend our libvirt fixture's Secret object to properly set the usage
  id (which is just the instance UUID) when parsing vTPM secret XML.

Related to blueprint vtpm-live-migration

Change-Id: I5a38a0de76a78b28a205a8d19f2374830054e1ab
Signed-off-by: melanie witt <melwittt@gmail.com>
2025-11-17 17:26:38 -08:00
Artom Lifshitz ad1dd5e594 TPM: support instances with user secret security
The `user` secret security policy is just existing behavior. No
changes are necessary in the mechanics, so this patch just adds a
scheduler prefilter and tests. The functional tests add some
groundwork to make future tests easier as well by making the helper
methods more flexible.

For functional testing, we need to:

* Have our libvirt fixture keep track of undefined secrets. Secrets
  are undefined as soon as the VM that uses them successfully boots
  (as mentioned previously, VM creation follows this pattern), but our
  tests would still like to assert that the secret had been created on
  a host. Just add a _removed_secrets dict that _remove_secret()
  populates.

Related to blueprint vtpm-live-migration

Change-Id: Ib449dc2f1c4a9af9d423252594261947e811452e
Signed-off-by: melanie witt <melwittt@gmail.com>
2025-11-17 17:26:38 -08:00
melanie witt 0f82c2953e TPM: add RequestContext checks to functional tests
Key manager service secret ownership can be a challenge when dealing
vTPM instances. Some instance actions require access to the secret and
will fail if there is a mismatch.

In preparation for vTPM live migration changes which will involve
different users accessing secrets (user|admin|Nova service user), this
removes ADMIN_ONLY from the functional tests class and adds checking of
RequestContext user_id in the FakeKeyManager.

Change-Id: I2790cd274a4776ab306b39df1e591e8304b63f96
Signed-off-by: melanie witt <melwittt@gmail.com>
2025-11-17 17:26:38 -08:00
Zuul cf930034f2 Merge "Reproduce bug/2130881" 2025-11-17 16:44:07 +00:00
Zuul 72dd372fc4 Merge "[hacking] Improve N373 to catch also other primitives" 2025-11-17 16:18:33 +00:00
Sean Mooney 22012360c4 ensure correct cleanup of multi-attach volumes
If a host has multiple instance with the same shared
multi attach volume and you delete them in parallel
nova need to correctly clean up the volume connection on
the host when the last instance is removed.

currently we do not have a volume level lock to guard the
critical section that determins if the current disconnect is
removing the final usage of the volume.

This can lead to leaking the volume or other issues as
noted in bug: #2048837

This change introduces a FairLockGuard to ensure we acquire
and release the locks in a fair and orderd manner.
The FairLockGuard is used to lock the server delete with
one lock per multi attach volume.

This will ensure that disconnects of diffrent volumes can happen
in parallel but if we are disconnecting the same volume in multiple
greenthread concurrently they will be serialised.

Assisted-By: Cursor Auto
Closes-Bug: #2048837
Change-Id: I67e10cace451259127a5d7da8fbdf7739afe3e51
Signed-off-by: Sean Mooney <work@seanmooney.info>
2025-11-17 13:26:08 +00:00
Zuul 8a993d583f Merge "add functional repoducer for bug 2048837" 2025-11-14 22:20:55 +00:00
Dan Smith 326b77d837 Test nova-next with >1 parallel migrations
Change-Id: Ic69872e6667664d1b3bd7a88d7ef018b67352f44
Signed-off-by: Dan Smith <dansmith@redhat.com>
2025-11-13 06:32:54 -08:00
Sean Mooney fac1a4d9de add functional repoducer for bug 2048837
Change-Id: I8ce3044cff198209416d2a458317f01d1177e9da
Signed-off-by: Sean Mooney <work@seanmooney.info>
2025-11-12 10:32:06 +00:00
Zuul b7d50570c7 Merge "api: Add response body schemas for volumes APIs" 2025-11-11 20:10:29 +00:00
Sean Mooney 61242f75da allow funtional test to run with released placment
As part of I0b5e13673cb4cc7c57aeae50914ace443dfc18fa
a new depency was created on a placement config
option and the workarounds config group

This enabled the workaround added in
I13ab83a165c229ae57876df4570e8af25221a45e
which is present on master but not in a release

That works in ci because in ci we use placement
master but locally and in the requirement repo
we do not.

Closes-Bug: #2131032
Change-Id: I744049b5cf0ef69624fc4b6db1e5f415ab89a5af
Signed-off-by: Sean Mooney <work@seanmooney.info>
2025-11-10 20:07:10 +00:00