Commit Graph

521 Commits

Author SHA1 Message Date
Zuul d29a9b64ee Merge "Make compute node rebalance safer" 2024-02-29 18:48:26 +00:00
Zuul 4c3640599a Merge "block_device: Add encryption attributes to swap disks" 2024-02-28 00:41:44 +00:00
John Garbutt 947bb5f641 Make compute node rebalance safer
Many bugs around nova-compute rebalancing are focused around
problems when the compute node and placement resources are
deleted, and sometimes they never get re-created.

To limit this class of bugs, we add a check to ensure a compute
node is only ever deleted when it is known to have been deleted
in Ironic.

There is a risk this might leave orphaned compute nodes and
resource providers that need manual clean up because users
do not want to delete the node in Ironic, but are removing it
from nova management. But on balance, it seems safer to leave
these cases up to the operator to resolve manually, and collect
feedback on how to better help those users.

blueprint ironic-shards

Change-Id: I2bc77cbb77c2dd5584368563dc4250d71913906b
2024-02-25 13:25:27 -08:00
Zuul bdd7daffbb Merge "Check if destination can support the src mdev types" 2024-02-23 15:46:01 +00:00
melanie witt eb4e0faf2d block_device: Add encryption attributes to swap disks
This enables use of ephemeral encryption for swap disks.

The 'encrypted' attribute is intended to be read-only, so we will raise
an error if something attempts to save it later.

DriverImageBlockDevice and DriverEphemeralBlockDevice are already not
saving updates to their 'encrypted' attributes, so the same error
checking is added to them as well for consistency.

Related to blueprint ephemeral-encryption-libvirt

Change-Id: Id30577699928180eff6a5b78390ce9e3efa28b16
2024-02-14 08:03:34 +00:00
Ghanshyam Mann 0c1e1ccf03 HyperV: Remove RDP console API
RDP console was only for HyperV driver so removing the
API. As API url stay same (because same used for other
console types API), RDP console API will return 400.

Cleaning up the related config options as well as moving its
API ref to obsolete seciton.

Keeping RPC method to avoid error when old controller is used
with new compute. It can be removed in next RPC version bump.

Change-Id: I8f5755009da4af0d12bda096d7a8e85fd41e1a8c
2024-02-13 12:24:38 -08:00
Sylvain Bauza 489aab934c Check if destination can support the src mdev types
Now that the source knows that both the computes support the right
libvirt version, it passes to the destination the list of mdevs it has
for the instance. By this change, we'll verify if the types of those
mdevs are actually supported by the destination.
On the next change, we'll pass the destination mdevs back to the
source.

Partially-Implements: blueprint libvirt-mdev-live-migrate
Change-Id: Icb52fa5eb0adc0aa6106a90d87149456b39e79c2
2024-02-05 15:10:55 +01:00
Sean Mooney f4852f4c81 [codespell] fix final typos and enable ci
This chnage adds the pre-commit config and
tox targets to run codespell both indepenetly
and via the pep8 target.

This change correct all the final typos in the
codebase as detected by codespell.

Change-Id: Ic4fb5b3a5559bc3c43aca0a39edc0885da58eaa2
2023-12-15 12:32:42 +00:00
Sylvain Bauza 36a5740e2a Revert "Make compute node rebalance safter"
This reverts commit 772f5a1ae4.

Change-Id: I20e78dfafe19fc1e7dc7344238c01cb585f744dc
2023-09-13 19:24:20 +02:00
John Garbutt 772f5a1ae4 Make compute node rebalance safter
Many bugs around nova-compute rebalancing are focused around
problems when the compute node and placement resources are
deleted, and sometimes they never get re-created.

To limit this class of bugs, we add a check to ensure a compute
node is only ever deleted when it is known to have been deleted
in Ironic.

There is a risk this might leave orphaned compute nodes and
resource providers that need manual clean up because users
do not want to delete the node in Ironic, but are removing it
from nova management. But on balance, it seems safer to leave
these cases up to the operator to resolve manually, and collect
feedback on how to better help those users.

blueprint ironic-shards

Change-Id: I7cd9e5ab878cea05462cac24de581dca6d50b3c3
2023-08-31 17:21:15 +00:00
Nobuhiro MIKI 2fd034ec48 libvirt: Add 'COMPUTE_ADDRESS_SPACE_*' traits support
Based on the Libvirt and QEMU versions, two traits,
COMPUTE_ADDRESS_SPACE_PASSTHROUGH and COMPUTE_ADDRESS_SPACE_EMULATED,
are controlled. Since the two are supported from the same version on
the Libvirt and QEMU, Nova handles them in the same way.

Blueprint: libvirt-maxphysaddr-support
Depends-On: https://review.opendev.org/c/openstack/os-traits/+/871226
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Change-Id: If6c7169b7b8f43ad15a8992831824fb546e85aab
2023-07-24 17:09:19 +09:00
Dan Smith 72370a188c Check our nodes for hypervisor_hostname changes
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
2023-02-01 09:20:59 -08:00
Dan Smith 0caf24f308 Add get_available_node_uuids() to virt driver
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
2023-01-20 07:57:18 -08:00
Rajat Dhasmana 30aab9c234 Add support for volume backed server rebuild
This patch adds the plumbing for rebuilding a volume backed
instance in compute code. This functionality will be enabled
in a subsequent patch which adds a new microversion and the
external support for requesting it.

The flow of the operation is as follows:

1) Create an empty attachment
2) Detach the volume
3) Request cinder to reimage the volume
4) Wait for cinder to notify success to nova (via external events)
5) Update and complete the attachment

Related blueprint volume-backed-server-rebuild

Change-Id: I0d889691de1af6875603a9f0f174590229e7be18
2022-08-31 16:38:37 +05:30
Lee Yarwood 6d9e8739d4 virt: Add block_device_info helper to find encrypted disks
Change-Id: I6c5023dd9894fda0237bdf311993b214cf8b2844
2022-08-16 08:01:22 +00:00
Lee Yarwood 5df97016b4 block_device: Add DriverImageBlockDevice to block_device_info
Change-Id: I17e0758e3b77caebd4d142664a8367ab4601ebdf
2022-08-02 21:25:48 +00:00
Lee Yarwood a370d1b581 virt: Add ephemeral encryption flag
Depends-On: https://review.opendev.org/759878
Change-Id: I0f9affb3c8a80ff1c06b5a2f0c5324af6e384c62
2022-08-02 21:25:47 +00:00
Lee Yarwood 003f1d2b45 block_device_info: Add swap to inline
A trivial cleanup to make the contents of block_device_info clear to
the reader.

Change-Id: Idf8aaf77c593d433cd4f6d9e835acadc7a19a9d1
2022-08-02 21:25:47 +00:00
Rajesh Tailor 2521810e55 Fix typos
This change fixes some of the typos in unit tests as well
as in nova code-base.

Change-Id: I209bbb270baf889fcb2b9a4d1ce0ab4a962d0d0e
2022-05-30 17:40:00 +05:30
Dmitrii Shcherbakov d1e9ecb443 Add supports_remote_managed_ports capability
In order to support remote-managed ports the following is needed:

* Nova compute driver needs to support this feature;
* For the Libvirt compute driver, a given host needs to have the right
  version of Libvirt - the one which supports PCI VPD (7.9.0
  https://libvirt.org/news.html#v7-9-0-2021-11-01).

Therefore, this change introduces a new capability to track driver
support for remote-managed ports.

Change-Id: I7ea96fd85d2607e0af0f6918b0b45c58e8bec058
2022-02-09 01:23:27 +03:00
Zuul fded762f4d Merge "fup: Remove unused legacy block_device_info format" 2021-08-25 02:25:41 +00:00
Zuul 1624b5f1aa Merge "Follow up from bp/pci-socket-affinity series" 2021-08-24 22:08:30 +00:00
Lee Yarwood b11e3f1d0d fup: Remove unused legacy block_device_info format
As announced on the ML [1] this change removes the now unused legacy format
from the codebase and updates the reference docs.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2021-August/024116.html

Change-Id: I3895b61b436b9bb882477d2d1b3f4907f03b3b1c
2021-08-20 13:26:46 +01:00
Zuul 9f4630fdc5 Merge "fake: Ensure need_legacy_block_device_info returns False" 2021-08-20 11:03:51 +00:00
Lee Yarwood d102b751b7 fake: Ensure need_legacy_block_device_info returns False
The legacy block_device_info format has not been used for a while in the
virt drivers and the Fake virt drivers shouldn't be using it anymore.

Some compute tests have been updated as they were previously asserting
the legacy format incorrectly. TODOs are also left to remove support for
the legacy format in a follow up change.

Change-Id: I066fb5617bae944a03273049117fc2b5bf329283
2021-08-11 19:51:14 +01:00
Stephen Finucane 100b9dc62c db: Unify 'nova.db.api', 'nova.db.sqlalchemy.api'
Merge these, removing an unnecessary layer of abstraction, and place
them in the new 'nova.db.main' directory. The resulting change is huge,
but it's mainly the result of 's/sqlalchemy import api/main import api/'
and 's/nova.db.api/nova.db.main.api/' with some necessary cleanup. We
also need to rework how we do the blocking of API calls since we no
longer have a 'DBAPI' object that we can monkey patch as we were doing
before. This is now done via a global variable that is set by the 'main'
function of 'nova.cmd.compute'.

The main impact of this change is that it's no longer possible to set
'[database] use_db_reconnect' and have all APIs automatically wrapped in
a DB retry. Seeing as this behavior is experimental, isn't applied to
any of the API DB methods (which don't use oslo.db's 'DBAPI' helper),
and is used explicitly in what would appear to be the critical cases
(via the explicit 'oslo_db.api.wrap_db_retry' decorator), this doesn't
seem like a huge loss.

Change-Id: Iad2e4da4546b80a016e477577d23accb2606a6e4
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-08-09 15:34:40 +01:00
Lee Yarwood 1cc52fd2f2 virt: Add destroy_secrets kwarg to destroy and cleanup
This change adds a simple optional kwarg to the virt driver signature of
destroy and cleanup to allow for callers to control when secrets should
be removed.

Change-Id: I856268b371f7ba712b02189db3c927cd762a4dc3
2021-06-02 15:41:51 +01:00
Artom Lifshitz e19f6fda58 Follow up from bp/pci-socket-affinity series
This patch addresses outstanding nits from the bp/pci-socket-affinity
series. The most important is how the libvirt driver handles reporting
the new COMPUTE_SOCKET_PCI_NUMA_AFFINITY trait. Previously, this was
done by directly adding the trait in static_traits(). This patch
switches it to use driver capabilities.

Change-Id: I89d742ae01d65ab4e16fd8bd86b761f4c5d54d54
2021-03-29 10:50:35 -04:00
Stephen Finucane d2fef725b1 compute: Report COMPUTE_SECURITY_UEFI_SECURE_BOOT
Currently only the Hyper-V driver supports this, so that's the only
thing that will report True. Future changes will extend this
functionality to libvirt.

Blueprint: allow-secure-boot-for-qemu-kvm-guests
Change-Id: I314f50a253317b6d80e1fcdd1b5932534841c57f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-03-08 16:33:16 +00:00
Takashi Natsume 383e2a8bdc Remove six.text_type (1/2)
Replace six.text_type with str.
A subsequent patch will replace other six.text_type.

Change-Id: I23bb9e539d08f5c6202909054c2dd49b6c7a7a0e
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-12-13 11:25:31 +00:00
Stephen Finucane 9d1683f70f virt: Remove 'get_all_bw_counters' API
This one is a little more involved because there are persistent objects
and versioned notifications to worry about, neither of which we can
remove right now.

Change-Id: Ic7c330ee1cccdc44a2a555c16cb6090eecbf6ce1
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-11-24 15:29:21 +00:00
Stephen Finucane 68bc87876f virt: Remove 'reset_network' API
This one is tied into an admin action in the server actions API, which
means we must remove that API action also. Otherwise, this isn't too
crazy.

Change-Id: I58343b94b67915062d044fa0f53aeab01b77738f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-11-23 15:55:50 +00:00
Stephen Finucane 30067be9bd virt: Remove 'change_instance_metadata' API
This was used to propagate the metadata changes to the hypervisor. For
all non-XenAPI drivers, we still allow updating instance metadata via
the API (i.e. '/servers/{server_id}/metadata') but this simply changes
what is exposed via the metadata API.

Change-Id: Ibd0ffd9906e7d7f22a9233539091d450e8023f07
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-11-17 11:42:08 +00:00
Zuul 4f2540a7a6 Merge "virt: Remove 'get_per_instance_usage' API" 2020-11-09 18:50:31 +00:00
Zuul 8584a82e25 Merge "virt: Remove various aggregate APIs" 2020-11-08 09:45:13 +00:00
Zuul ccb0ab1d0a Merge "virt: Remove 'set_bootable' API" 2020-11-07 14:55:57 +00:00
Zuul 120d866df7 Merge "Allow excluding image type capabilities" 2020-11-07 08:27:51 +00:00
Dan Smith cf0e519a0e Allow excluding image type capabilities
During the implementation of blueprint request-filter-image-types,
I left a FIXME to follow-up and add an ability for an operator to
configure compute nodes to not expose image formats that they *can*
support, for situations where they may not be desired. Consider a
remote compute node which *can* support raw images, but for which
you want to require that the user use qcow2 for transfer efficiency.

This adds a new compute-level config option which allows excluding
image types, which will be filtered out of the traits list in a
general way, to avoid having to honor the list in each driver.

Change-Id: Iabe6246dba212b1a287a82cc0cf16e2e8c8a24b8
2020-10-09 07:02:18 -07:00
Stephen Finucane 8aea747c97 virt: Remove 'get_per_instance_usage' API
Another pretty trivial one. This one was intended to provide an overview
of instances that weren't properly tracked but were running on the host.
It was only ever implemented for the XenAPI driver so remove it now.

Change-Id: Icaba3fc89e3295200e3d165722a5c24ee070002c
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:10:30 +01:00
Stephen Finucane 83ae149c72 virt: Remove various aggregate APIs
These were used to broadcast aggregate changes to XenAPI pools and
aren't used by any other in-tree driver. Remove them.

Change-Id: I18a01032a89bff84d71e879c5207157393849b7e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:07 +01:00
Stephen Finucane caa5f9ef94 virt: Remove 'set_bootable' API
Change-Id: I02b4e5b48c4974c426b8b576292f27f50565fb4f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:07 +01:00
Stephen Finucane 39fe22161c virt: Remove 'post_interrupted_snapshot_cleanup' API
Change-Id: I999f93b1c99fd327774bdbd92a8e483f3a41637f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Stephen Finucane 1fd44eb56f trivial: Final cleanup
Remove references to the feature from various comments scattered
throughout the code.

Change-Id: Ic353a2489389c557859c249218eaf6060974e1a9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Stephen Finucane 912b717207 virt: Remove 'get_console_pool_info' API
This is no longer used by any in-tree virt drivers and can be removed.
The equivalent RPC API now always raises 'NotImplementedError', which
was the behavior with virt drivers that didn't support the feature.

Change-Id: Iab881ef4f52eff4815e781f10204497968f8a06b
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Stephen Finucane 7991155454 virt: Remove 'is_xenapi' helper
This will never be true now.

Change-Id: I10c3542e06a4d8132314aaac5cf5a905e1f8a270
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-11 14:09:06 +01:00
Zuul 94810a8612 Merge "Track error migrations in resource tracker" 2020-09-11 02:31:36 +00:00
Zuul be25c1caa3 Merge "virt: Highlight soon-to-be-unused driver APIs" 2020-09-10 12:19:11 +00:00
LuyaoZhong 255b3f2f91 Track error migrations in resource tracker
If rollback_live_migration failed, the migration status is set to
'error', and there might me some resource not be cleaned up like vpmem
since rollback is not completed. So we propose to track those 'error'
migrations in resource tracker until they are cleaned up by periodic
task '_cleanup_incomplete_migrations'.

So if rollback_live_migration succeeds, we need to set the migration
status to 'failed' which will not be tracked in resource tracker. The
'failed' status is already used for resize to indicated a migration
finishing the cleanup.

'_cleanup_incomplete_migrations' will also handle failed
rollback_live_migration cleanup except for failed resize/revert-resize.

Besides, we introduce a new 'cleanup_lingering_instance_resources' virt
driver interface to handle lingering instance resources cleanup
including vpmem cleanup and whatever we add in the future.

Change-Id: I422a907056543f9bf95acbffdd2658438febf801
Partially-Implements: blueprint vpmem-enhancement
2020-09-10 05:30:39 +00:00
Sean Mooney 1356ef5b57 Cyborg evacuate support
This change extends the conductor manager
to append the cyborg resource request to the
request spec when performing an evacuate.

This change passes the ARQs to spawn during rebuild
and evacuate. On evacuate the existing ARQs will be deleted
and new ARQs will be created and bound, during rebuild the
existing ARQs are reused.

This change extends the rebuild_instance compute rpcapi
function to carry the arq_uuids. This eliminates the
need to lookup the uuids associated with the arqs assinged
to the instance by quering cyborg.

Co-Authored-By: Wenping Song <songwenping@inspur.com>
Co-Authored-By: Brin Zhang <zhangbailin@inspur.com>

Implements: blueprint cyborg-rebuild-and-evacuate
Change-Id: I147bf4d95e6d86ff1f967a8ce37260730f21d236
2020-09-01 08:41:45 +00:00
Stephen Finucane d4e6e9151c virt: Highlight soon-to-be-unused driver APIs
These are all XenAPI-only APIs and can be removed in the near future
when that driver goes away. Highlight this fact now.

Change-Id: I04f6bd4000f58b9da2e4165aa2d623e795845d4e
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-08-31 15:51:26 +01:00