nova/nova/tests/unit/objects
Matt Riedemann 31c08d0c7d Do not persist RequestSpec.ignore_hosts
Change Ic3968721d257a167f3f946e5387cd227a7eeec6c in Newton
started setting the RequestSpec.ignore_hosts field to the
source instance.host during resize/cold migrate if
allow_resize_to_same_host=False in config, which it is by
default.

Change I8abdf58a6537dd5e15a012ea37a7b48abd726579 also in
Newton persists changes to the RequestSpec in conductor
in order to save the RequestSpec.flavor for the new flavor.
This inadvertently persists the ignore_hosts field as well.

Later if you try to evacuate or unshelve the server it will ignore
the original source host because of the persisted ignore_hosts
value. This is obviously a problem in a small deployment with only
a few compute nodes (like an edge deployment). As a result, an
evacuation can fail if the only available host is the one being
ignored.

This change does two things:

1. In order to deal with existing corrupted RequestSpecs in the DB,
   this change simply makes conductor overwrite RequestSpec.ignore_hosts
   rather than append during evacuate before calling the scheduler so
   the current instance host (which is down) is filtered out.

   This evacuate code dealing with ignore_hosts goes back to Mitaka:

     I7fe694175bb47f53d281bd62ac200f1c8416682b

   The test_rebuild_instance_with_request_spec unit test is updated
   and renamed to actually be doing an evacuate which is what it was
   intended for, i.e. the host would not change during rebuild.

2. This change makes the RequestSpec no longer persist the ignore_hosts
   field like several other per-operation fields in the RequestSpec.
   The only operations that use ignore_hosts are resize (if
   allow_resize_to_same_host=False), evacuate and live migration, and
   the field gets reset in each case to ignore the source instance.host.

The related functional recreate test is also updated to show the
bug is fixed. Note that as part of that, the confirm_migration method
in the fake virt driver needed to be implemented otherwise trying to
evacuate back to the source host fails with an InstanceExists error since
the confirmResize operation did not remove the guest from the source host.

Conflicts:
      nova/objects/request_spec.py
      nova/tests/unit/objects/test_request_spec.py

NOTE(mriedem): The conflict is due to not having change
I53e5debcffd6de2b3a2ff838e7f5da33fa1a82b8 in Rocky which added
the requested_resources field to the RequestSpec object.

Change-Id: I3f488be6f3c399f23ccf2b9ee0d76cd000da0e3e
Closes-Bug: #1669054
(cherry picked from commit e4c998e573)
(cherry picked from commit 76dfb9d0b6)
2019-04-02 09:36:10 -04:00
..
__init__.py
test_agent.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_aggregate.py Transform aggregate.update_prop notification 2018-07-15 23:36:31 +09:00
test_bandwidth_usage.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_block_device.py Fix all invalid obj_make_compatible test case 2018-07-27 02:20:46 +00:00
test_build_request.py Fix incompatible version handling in BuildRequest 2019-01-18 09:55:11 +01:00
test_cell_mapping.py Fix formatting non-templated cell URLs with no config 2018-10-17 16:07:56 +02:00
test_compute_node.py Ignore uuid if already set in ComputeNode.update_from_virt_driver 2018-10-17 16:24:10 +02:00
test_console_auth_token.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_diagnostics.py Added nova objects for intance diagnostics 2017-05-30 00:39:44 +04:00
test_dns_domain.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_ec2.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_external_event.py Use EnumField for instance external event name 2015-05-20 22:16:52 +00:00
test_fields.py Add VIFMigrateData object for live migration 2018-07-19 09:08:12 -04:00
test_fixed_ip.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_flavor.py Fix all invalid obj_make_compatible test case 2018-07-27 02:20:46 +00:00
test_floating_ip.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_host_mapping.py Add --by-service to discover_hosts 2018-03-16 15:55:19 -07:00
test_hv_spec.py objects: Move 'vm_mode' to 'fields.VMMode' 2016-11-25 16:19:44 +00:00
test_image_meta.py Update ImageMetaProp object to expose traits 2018-04-05 16:18:59 -07:00
test_instance.py Default embedded instance.flavor.is_public attribute 2018-11-21 15:10:57 -05:00
test_instance_action.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_instance_device_metadata.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_instance_fault.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_instance_group.py Make scheduler.utils.setup_instance_group query all cells 2018-09-05 16:32:42 +00:00
test_instance_info_cache.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_instance_mapping.py Fix InstanceMapping to always default queued_for_delete=False 2019-02-07 16:16:17 +01:00
test_instance_numa_topology.py Fix all invalid obj_make_compatible test case 2018-07-27 02:20:46 +00:00
test_instance_pci_requests.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_keypair.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_migrate_data.py Add VIFMigrateData.get_dest_vif 2018-07-19 09:08:12 -04:00
test_migration.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_migration_context.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_monitor_metric.py Fix MonitorMetric obj_make_compatible 2016-09-12 14:10:41 +00:00
test_network.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_network_request.py Fix all invalid obj_make_compatible test case 2018-07-27 02:20:46 +00:00
test_numa.py Fix overcommit for NUMA-based instances 2019-01-25 12:57:49 +00:00
test_objects.py Merge "Add queued_for_delete field to InstanceMapping object" 2018-07-25 04:59:45 +00:00
test_pci_device.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_pci_device_pool.py Return empty PciDevicePoolList obj instead of None 2015-09-11 21:20:01 +02:00
test_quotas.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_request_spec.py Do not persist RequestSpec.ignore_hosts 2019-04-02 09:36:10 -04:00
test_security_group.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_security_group_rule.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_selection.py objects: Add NUMATopologyLimits.network_metadata 2018-07-09 10:08:08 +01:00
test_service.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_tag.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_task_log.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_trusted_certs.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00
test_vcpu_model.py objects: Move 'cpumodel' to 'fields.CPU*' 2016-11-25 16:19:43 +00:00
test_virt_cpu_topology.py Convert hardware.VirtCPUTopology to nova object 2014-11-20 09:14:25 -05:00
test_virtual_interface.py Fix all invalid obj_make_compatible test case 2018-07-27 02:20:46 +00:00
test_volume_usage.py Use nova.db.api directly 2018-07-10 14:56:27 +00:00