Commit Graph

56228 Commits

Author SHA1 Message Date
Lorenzo Affetti 14342d629b FakeDriver: adding and removing instances on live migration.
There was no code in FakeDriver that updated the internal
dict `self.instances` when a FakeInstance was live migrated.
This commit fills this gap. As a result, a couple of versioned
notification samples get updated since we are now properly
tracking a live migrated instance on the destination host as
running vs pending power state.

Closes-Bug: 1426433

Change-Id: I9562e1bcbb18c7d543d5a6b36011fa28c13dfa79
2019-12-20 10:59:06 +00:00
Zuul bbda16f634 Merge "Refresh target cell instance after finish_snapshot_based_resize_at_dest" 2019-12-20 06:41:41 +00:00
Zuul 93197eb671 Merge "Add functional cross-cell revert test with detached volume" 2019-12-20 06:41:35 +00:00
Matt Riedemann 40950f9c87 Fix race in test_create_servers_with_vpmem
This test creates 2 servers which take up all of the
CUSTOM_PMEM_NAMESPACE_SMALL resources on the sole host in
the test. Then it tries to create a 3rd server which it
expects to fail and it does. Then it deletes the second
server to free up one CUSTOM_PMEM_NAMESPACE_SMALL resource
on the host and schedules another server which it expects
to work. The problem is the test doesn't wait for the
second server to be fully deleted so the test intermittently
fails when the CUSTOM_PMEM_NAMESPACE_SMALL resource isn't
yet freed up when the fourth server goes through scheduling.

This adds a simple wait call for the deleted server to actually
be gone before creating the fourth server.

Change-Id: Id3389038b5fed1e70dd12c7ed9cef2c0950625cf
Closes-Bug: #1856902
2019-12-19 09:41:18 -05:00
Zuul d5a786f540 Merge "Remove now invalid cells v1 comments from conductor code" 2019-12-19 04:38:06 +00:00
Zuul 32a6acf94b Merge "Revert cross-cell resize from the API" 2019-12-19 00:06:38 +00:00
Zuul a5b8217f5f Merge "Optimization for nova-api _checks_for_create_and_rebuild" 2019-12-18 18:28:05 +00:00
Zuul 1a1fce0fa8 Merge "Remove dead code from MigrationTask._execute" 2019-12-18 17:44:28 +00:00
Zuul ac2cec2d4d Merge "Add troubleshooting doc about rebuilding the placement db" 2019-12-18 17:44:22 +00:00
Zuul c48bc31c90 Merge "Zuul v3: use devstack-plugin-nfs-tempest-full" 2019-12-18 17:44:16 +00:00
Zuul 4d5b910c52 Merge "api-ref: avoid mushy wording around server.image description" 2019-12-18 17:22:48 +00:00
Zuul 56fc3f28e4 Merge "Add revert_snapshot_based_resize conductor RPC method" 2019-12-18 01:20:19 +00:00
Luigi Toscano e7e39b8c2e Zuul v3: use devstack-plugin-nfs-tempest-full
... and replace its legacy ancestor.

Change-Id: Ifd4387a02b3103e1258e146e63c73be1ad10030c
2019-12-18 00:28:15 +01:00
Zuul d052e72040 Merge "DRY: Build ImageMetaPropsPayload from ImageMetaProps" 2019-12-16 18:48:39 +00:00
Zuul fd404c8d7b Merge "Flesh out RevertResizeTask.rollback" 2019-12-16 10:50:32 +00:00
Zuul edf7775f16 Merge "nova-net: Remove db methods for ProviderMethod" 2019-12-14 05:09:39 +00:00
Zuul 5377fd1d9a Merge "Revert "(Temporarily) readd bare support for py27"" 2019-12-14 04:22:18 +00:00
Zuul 7b8f3686e7 Merge "Sync ImageMetaPropsPayload fields" 2019-12-14 04:15:18 +00:00
Zuul b96bc9d675 Merge "Add RevertResizeTask" 2019-12-14 01:59:27 +00:00
Zuul 24ba5fd8c0 Merge "Add finish_revert_snapshot_based_resize_at_source compute method" 2019-12-14 01:59:16 +00:00
Zuul 2d1f1762ef Merge "Deal with cross-cell resize in _remove_deleted_instances_allocations" 2019-12-14 01:59:07 +00:00
Zuul 01e5237fd0 Merge "Add revert_snapshot_based_resize_at_dest compute method" 2019-12-14 01:59:01 +00:00
Zuul 85abf26f4d Merge "Confirm cross-cell resize from the API" 2019-12-14 01:57:14 +00:00
Zuul b5a9f85226 Merge "nova-net: Remove unused 'stub_out_db_network_api'" 2019-12-13 22:21:34 +00:00
Zuul ee812e666c Merge "Move _update_pci_request_spec_with_allocated_interface_name" 2019-12-13 22:21:20 +00:00
Eric Fried bce0854959 DRY: Build ImageMetaPropsPayload from ImageMetaProps
ImageMetaPropsPayload (for notifications) was supposed to contain
exactly the same fields as ImageMetaProps itself; and the SCHEMA member
was those same keys in a trivially different shape. And we were having
trouble remembering to keep these two objects in sync before. So this
commit eliminates the repetition and just generates
ImageMetaPropsPayload's `fields` and `SCHEMA` from
ImageMetaProps.fields.

Change-Id: I7dc38f7f5a62098fb0c366736f27e23bd7b7ee86
2019-12-13 19:46:12 +00:00
Zuul 9428a1e53b Merge "Add confirm_snapshot_based_resize conductor RPC method" 2019-12-13 19:14:27 +00:00
Matt Riedemann 685dc60d58 api-ref: avoid mushy wording around server.image description
This disambiguates the description on the server.image parameter.
If the server is booted from volume (where boot from volume means
there is a bdm with boot_index=0 and destination_type=volume),
then the server.image will be an empty string [1] otherwise it
will be a dict.

[1] https://github.com/openstack/nova/blob/2f0f8b8cf13b7441ce6a7a524b33d30d40f1d468/nova/api/openstack/compute/views/servers.py#L540

Change-Id: Ia1ecd39a5636fa5a35cdbcafc03828b2925a9033
2019-12-13 12:39:01 -05:00
Sean Mooney 7dce615362 Sync ImageMetaPropsPayload fields
This change adds missing fields to the image metadata
notification object and adds a unit tests to assert
that the notification object and nova object stay in sync.

This change also adds unit tests to assert the notification
schema and fields are in sync and that the schema is
valid.

Change-Id: I36ea5d5e677ab3e6c88223b20f5377e9471c55db
Closes-Bug: #1856100
2019-12-13 10:08:07 -06:00
Zuul 2f0f8b8cf1 Merge "Move _get_request_group_mapping() to RequestSpec" 2019-12-13 15:34:11 +00:00
Balazs Gibizer deada11da1 Move _update_pci_request_spec_with_allocated_interface_name
This patch moves _update_pci_request_spec_with_allocated_interface_name
from the ComputeManager to nova.compute.utils as a later patch needs to
call it from outside of the ComputeManager.

This patch also changes the exception types raised from
update_pci_request_spec_with_allocated_interface_name as raising
BuildAbortException from a util method does not make too much
sense. This means that some of the callers also needed to be adjusted to
handle the new exception types.

In the _do_rebuild_instance_with_claim code path the exception type is
not translated back to BuildAbortException as the old and the new
exceptions are both handled by the except Exception branch in
rebuild_instance [1].

[1] https://github.com/openstack/nova/blob/ed503ce3e1a8598c6e8ee9d8b345c1d92df01539/nova/compute/manager.py#L3448

Change-Id: I5853a0f6e133044ffc1861d21008e568ad62ffc7
blueprint: support-move-ops-with-qos-ports-ussuri
2019-12-13 15:21:54 +01:00
Stephen Finucane 3dbdbb4e2b Revert "(Temporarily) readd bare support for py27"
This reverts commit 33a2a5f2e4. We're now
at M1 and the DevStack default has been changed. We no longer need to
pretend to support Python 2.7. This is slightly modified to drop an
additional Python 2.7-only dependency from lower-constraints.txt.

[1] I52b03caee0ba700da3a15035201ea6cd91baa06b

Change-Id: I1068850072e639ee268d68ca82249f569a40310e
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-12-13 12:45:52 +00:00
Zuul aa096fd183 Merge "Follow up to I5b9d41ef34385689d8da9b3962a1eac759eddf6a" 2019-12-13 08:32:07 +00:00
Zuul b6e353a2c8 Merge "support pci numa affinity policies in flavor and image" 2019-12-13 00:25:32 +00:00
Zuul 7a6349afb5 Merge "trivial: Remove dead code" 2019-12-13 00:25:26 +00:00
Zuul e954a05697 Merge "Keep pre-commit inline with hacking and fix whitespace" 2019-12-12 23:39:20 +00:00
Zuul cc6473d231 Merge "Don't hardcode Python versions in test" 2019-12-12 22:51:57 +00:00
Zuul 5b304bbdaf Merge "trivial: Resolve (most) flake8 3.x issues" 2019-12-12 22:24:40 +00:00
Matt Riedemann 85a1ac12e7 Refresh target cell instance after finish_snapshot_based_resize_at_dest
FinishResizeAtDestTask needs to refresh its local copy of the target
cell instance after finish_snapshot_based_resize_at_dest to make sure
it has the latest copy of the instance before updating it in
_update_instance_mapping otherwise if the instance is dirty conductor
could overwrite fields set by the compute, like the flavor.

Part of blueprint cross-cell-resize

Change-Id: If6e1acb0efe1d7bac460deff2d9572ef7170f79d
2019-12-12 12:08:08 -05:00
Matt Riedemann f1ac153b03 Add functional cross-cell revert test with detached volume
This implements one of the test todos where we create a server
and attach a volume to it, resize to another cell, detach the
volume while the instance is in VERIFY_RESIZE status, and then
revert the resize and make sure the volume is still detached
from the source cell after the revert.

A log message is added to prep_snapshot_based_resize_at_source
which was useful while debugging the new test.

Part of blueprint cross-cell-resize

Change-Id: I89aef20eebb817822d830db178527c370e532f54
2019-12-12 12:08:02 -05:00
Matt Riedemann 216640115c Revert cross-cell resize from the API
This adds the logic to the API revertResize
operation such that if the migration is a cross-cell
resize the API will RPC cast to conductor to
revert the resize rather than directly to the dest
compute service like a traditional resize. Conductor
will then orchestrate the revert process between the
source and target cell.

Now that the API has revertResize plumbed this change
builds on the cross-cell resize functional tests by
reverting the resize for the volume-backed server test
and adds a revert from stopped image-backed test.

Part of blueprint cross-cell-resize

Change-Id: Iad211a54719c5fde039c48072c58f3af96afc8b8
2019-12-12 12:06:20 -05:00
Matt Riedemann 74d18c412f Add revert_snapshot_based_resize conductor RPC method
This adds the conductor ComputeTaskManager method
revert_snapshot_based_resize along with the related conductor
RPC API client method which will be an RPC cast from the API
for a revertResize server action.

Part of blueprint cross-cell-resize

Change-Id: Ia6b6b25238963a5f60349267da6d07cb740982f4
2019-12-12 12:00:33 -05:00
Matt Riedemann 87ade6d0f0 Flesh out RevertResizeTask.rollback
This implements the TODO in the RevertResizeTask.rollback
method by logging an exception with some details and also
setting the instance to ERROR state, recording a fault
and sending an error notification, similar to the rollback
method in ConfirmResizeTask.

As noted inline, the exception message could be more detailed
but I've left that for a later change in case people want more
details.

Part of blueprint cross-cell-resize

Change-Id: I41296696da3226767d2bacba9345d829529ce4b6
2019-12-12 12:00:33 -05:00
Matt Riedemann f6f4657e9c Add RevertResizeTask
This adds the RevertResizeTask which will be used to orchestrate
the revert of a cross-cell resize. It is responsible for updating
the instance mapping and hidden fields to hide the target cell
instance and show the source cell instance, clean up the target
host / cell, destroy the target cell instance, and (re)spawn the
instance in the source cell.

Part of blueprint cross-cell-resize

Change-Id: I7069f8807f353fa63c96494395bbbf7cc44562fb
2019-12-12 12:00:33 -05:00
Matt Riedemann 750aef54b1 Add finish_revert_snapshot_based_resize_at_source compute method
This adds the finish_revert_snapshot_based_resize_at_source() method
to the compute service. This completes the cross-cell resize revert
on the source host by updating port bindings, re-connecting volumes
and spawning the guest and waiting for the network-vif-plugged
event from neutron.

If the resize started with a stopped instance, the revert ensures
the guest is powered off when it is spawned.

The instance record is updated with the old_flavor information,
allocations are reverted in placement, and the migration status in
the source cell database is updated to "reverted".

Notifications are not sent from this method like in the
finish_revert_resize() method because those will be sent from
conductor.

Note that this implementation tries to be a bit more graceful
about error handling than the old same-cell finish_revert_resize
method since there are a lot of moving parts and we want to try
to clean up as much as possible.

Part of blueprint cross-cell-resize

Change-Id: I7e7afddbd9e0f57dfb1175a0bb2b54f2ed5500f2
2019-12-12 12:00:33 -05:00
Matt Riedemann 26da4418a9 Deal with cross-cell resize in _remove_deleted_instances_allocations
When reverting a cross-cell resize, conductor will:

1. clean up the destination host
2. set instance.hidden=True and destroy the instance in the
   target cell database
3. finish the revert on the source host which will revert the
   allocations on the source host held by the migration record
   so the instance will hold those again and drop the allocations
   against the dest host which were held by the instance.

If the ResourceTracker.update_available_resource periodic task runs
between steps 2 and 3 it could see that the instance is deleted
from the target cell but there are still allocations held by it and
delete them. Step 3 is what handles deleting those allocations for
the destination node, so we want to leave it that way and take the
ResourceTracker out of the flow.

This change simply checks the instance.hidden value on the deleted
instance and if hidden=True, assumes the allocations will be cleaned
up elsehwere (finish_revert_snapshot_based_resize_at_source).

Ultimately this is probably not something we *have* to have since
finish_revert_snapshot_based_resize_at_source is going to drop the
destination node allocations anyway, but it is good to keep clear
which actor is doing what in this process.

Part of blueprint cross-cell-resize

Change-Id: Idb82b056c39fd167864cadd205d624cb87cbe9cb
2019-12-12 12:00:33 -05:00
Matt Riedemann 11b7bcd947 Add revert_snapshot_based_resize_at_dest compute method
This adds the revert_snapshot_based_resize_at_dest() compute
service method which will be called from conductor during
a cross-cell resize revert operation. This runs on the dest
host in the target cell and is similar to
confirm_snapshot_based_resize_at_source() except it destroys
the guest and works on dropping the new_flavor resource usage
rather than the old_flavor. It also sends the legacy
"compute.instance.exists" notification like a traditional
revert_resize().

As part of this cleanup, the dest host volume attachments
are deleted. The source host port bindings, which are inactive
when this runs, are activated and then the (previously active)
dest host port bindings are deleted. This is to make sure the
ports are not left unbound after the revert.

Part of blueprint cross-cell-resize

Change-Id: I200c51acbbda767c2d8ff90103eef54dbf35fb01
2019-12-12 12:00:33 -05:00
Matt Riedemann 386aa315a4 Confirm cross-cell resize from the API
This adds the logic to the API confirmResize
operation such that if the migration is a cross-cell
resize the API will RPC cast to conductor to
confirm the resize rather than directly to the source
compute service like a traditional resize. Conductor
will then orchestrate the confirm process between the
source and target cell.

Now that the API has confirmResize plumbed this change
builds on the cross-cell resize functional tests by
confirming the resize for the image-backed server test.
To make that extra fun, a volume is attached to the
server while it is in VERIFY_RESIZE status to assert it
remains attached to the instance in the target cell
after the resize is confirmed.

In addition, the FakeDriver.cleanup() method is updated
to guard against calling it before the guest is destroyed
from the "hypervisor". This is to make sure the cleanup()
method is called properly from
confirm_snapshot_based_resize_at_source() in the compute
service on the source host.

The _confirm_resize_on_deleting scenario will be
dealt with in a later change.

Part of blueprint cross-cell-resize

Change-Id: Ia5892e1d2cb7c7685e104466f83df7bb00b168c0
2019-12-12 12:00:29 -05:00
Matt Riedemann 6f74bc1e98 Add confirm_snapshot_based_resize conductor RPC method
This adds the conductor ComputeTaskManager method
confirm_snapshot_based_resize along with the related conductor
RPC API client method which by default will be an RPC cast
from the API for a confirmResize server action but can also
be RPC called in the case of deleting a server in VERIFY_RESIZE
status.

Part of blueprint cross-cell-resize

Change-Id: If4c4b23891bfc340deb18a2f500510a472a869c9
2019-12-12 11:13:52 -05:00
Matt Riedemann 3f11a9de2d Follow up to I5b9d41ef34385689d8da9b3962a1eac759eddf6a
This addresses the TODO based on the review comment here [1].

[1] https://review.opendev.org/#/c/637070/56/nova/conductor/tasks/cross_cell_migrate.py@970

Part of blueprint cross-cell-resize

Change-Id: Ic48a73cc7e25a8f639aaec3e7ca59224184c495b
2019-12-12 11:13:52 -05:00