nova/nova/objects
Matt Riedemann 8f1773a7af 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/conductor/test_conductor.py
      nova/tests/unit/objects/test_request_spec.py

NOTE(mriedem): The (test_)request_spec.py conflicts are due to not
having change I2131558f0edfe603ee1e8d8bae66a3caf5182a58 in Queens.
test_save_does_not_persist_requested_fields from that change is
ported and modified here to just deal with the ignore_hosts field.
The test_conductor.py conflict is due to not having change
I640562b8dd049ff5b6fea9286dc3082b9d837ed3 in Queens.

Change-Id: I3f488be6f3c399f23ccf2b9ee0d76cd000da0e3e
Closes-Bug: #1669054
(cherry picked from commit e4c998e573)
(cherry picked from commit 76dfb9d0b6)
(cherry picked from commit 31c08d0c7d)
2019-04-02 11:07:52 -04:00
..
__init__.py Add ConsoleAuthToken object 2018-01-06 02:03:50 +00:00
agent.py Remove obj_relationships from objects 2015-10-30 00:22:23 +00:00
aggregate.py Remove translation of log messages 2017-06-21 13:01:19 +07:00
bandwidth_usage.py Cleanup NovaObjectDictCompat from BandwidthUsage 2016-04-04 10:26:55 +00:00
base.py [placement] Object changes to support last-modified headers 2017-12-07 18:47:17 +00:00
block_device.py Add an online migration for BDM.uuid 2018-01-02 17:29:36 +00:00
build_request.py Fix incompatible version handling in BuildRequest 2019-02-01 16:38:55 +01:00
cell_mapping.py Sort CellMappingList.get_all() for safety 2017-04-24 12:00:22 -07:00
compute_node.py Filter deleted computes from get_all_by_uuids() 2018-09-21 14:46:35 -04:00
console_auth_token.py Add ConsoleAuthToken object 2018-01-06 02:03:50 +00:00
diagnostics.py Added nova objects for intance diagnostics 2017-05-30 00:39:44 +04:00
dns_domain.py Remove DictCompat from DNSDomain 2016-01-11 16:38:06 +00:00
ec2.py Remove DictCompat from S3 object 2016-04-04 18:22:59 +00:00
external_event.py Add ability to signal and perform online volume size change 2017-07-12 11:53:20 -04:00
fields.py Added ability to configure default architecture for ImagePropertiesFilter 2018-05-15 12:28:43 +00:00
fixed_ip.py Add FixedIPList.get_count_by_project() 2017-06-19 21:51:46 +00:00
flavor.py Add Flavor.description attribute 2017-11-05 01:24:01 -05:00
floating_ip.py Add FloatingIPList.get_count_by_project() 2017-06-19 21:51:46 +00:00
host_mapping.py Add --by-service to discover_hosts 2018-03-21 07:26:29 -07:00
hv_spec.py objects: Move 'hv_type' to 'fields.HVType' 2016-11-25 16:19:43 +00:00
image_meta.py Add `img_hide_hypervisor_id` image property 2017-05-29 16:03:43 +00:00
instance.py Default embedded instance.flavor.is_public attribute 2018-11-21 15:25:12 -05:00
instance_action.py Add instance action db and obj pagination support. 2017-12-11 11:01:42 -05:00
instance_fault.py Remove translation of log messages 2017-06-21 13:01:19 +07:00
instance_group.py Make scheduler.utils.setup_instance_group query all cells 2018-09-05 16:36:22 +00:00
instance_info_cache.py Remove translation of log messages 2017-06-21 13:01:19 +07:00
instance_mapping.py cleanup mapping/reqspec after archive instance 2017-11-21 15:28:07 +01:00
instance_numa_topology.py Merge "objects: remove cpu_topology from __init__ of InstanceNUMATopology" 2017-05-17 12:53:41 +00:00
instance_pci_requests.py objects: Add PCI NUMA policy fields 2017-12-20 14:59:10 +00:00
keypair.py Remove translation of log messages 2017-06-21 13:01:19 +07:00
migrate_data.py Avoid redundant initialize_connection on source post live migration 2019-02-19 11:46:07 +00:00
migration.py Add migration db and object pagination support. 2018-01-08 12:01:58 -05:00
migration_context.py pci: Move PCI devices and PCI requests into migration context 2016-06-03 02:09:33 +03:00
monitor_metric.py Fix MonitorMetric obj_make_compatible 2016-09-12 14:10:41 +00:00
network.py Remove deprecated configuration option network_device_mtu 2016-09-07 12:31:57 +00:00
network_request.py Merge "Remove DictCompat from NetworkRequest" 2016-06-30 10:23:36 +00:00
numa.py Fix incorrect known vcpuset when CPUPinningUnknown raised 2017-11-24 15:41:22 +08:00
pci_device.py Fix ValueError when loading old pci device record 2017-11-29 12:49:49 -05:00
pci_device_pool.py [2/3]Replace six.iteritems() with .items() 2017-01-09 09:11:00 +00:00
quotas.py Follow up on removing old-style quotas code 2017-12-08 22:11:24 +00:00
request_spec.py Do not persist RequestSpec.ignore_hosts 2019-04-02 11:07:52 -04:00
resource_provider.py [placement] Retry allocation writes server side 2018-08-03 14:41:15 +01:00
security_group.py Add SecurityGroupList.get_counts() 2017-06-19 21:51:46 +00:00
security_group_rule.py Cleanup NovaObjectDictCompat from security_group_rule 2016-01-05 16:21:08 +00:00
selection.py Move the to_dict() method to the Selection object 2017-12-07 15:01:09 +00:00
service.py Make service all-cells min version helper use scatter-gather 2019-02-18 18:05:08 +01:00
tag.py Added server tags controller 2016-04-06 16:37:22 +03:00
task_log.py Remove obj_relationships from objects 2015-10-30 00:22:23 +00:00
vcpu_model.py Untie subobject versions 2015-11-10 15:56:14 +00:00
virt_cpu_topology.py cleanup NovaObjectDictCompat from virt_cpu_topology 2015-08-05 08:56:30 +05:30
virt_device_metadata.py XenAPI: device tagging 2017-06-14 01:53:06 +00:00
virtual_interface.py Merge "trivial: comment about vif object address field" 2016-07-13 19:24:58 +00:00
volume_usage.py Add a VolumeUsage object 2015-08-23 18:45:38 +02:00