Add COMPUTE_SAME_HOST_COLD_MIGRATE trait

This adds a compute capability trait to model the
nova ComputeDriver supports_migrate_to_same_host capability [1].

There is a latent bug in nova where configuring the
allow_resize_to_same_host option to True can potentially
lead the scheduler to pick the same host the server is on
to start a cold migration which is only supported by the
(in-tree) vCenter driver (since that driver manages a vCenter
cluster of ESXi hosts). This can lead to at best the cold migration
flow picking an alternate host and at worst failing the cold migration.
Either is not desirable if nova could make a better decision during
scheduling by asking placement for only compute nodes that support
this type of operation.

In absence of the trait, nova can workaround the issue with a
config option [2] such that when cold migrating the API can determine
if the current host that the instance is on should be ignored during
scheduling. With the trait, nova could deprecate and remove that workaround
by having the compute API determine if the host that the instance is on
is suitable for same-host cold migration by finding the provider using
the ComputeNode related to the instance (via host/node on the instance)
and if that provider has the COMPUTE_SAME_HOST_COLD_MIGRATE trait [3]. That
would still leave the nova scheduler to filter out allocation candidates
using the RequestSpec.ignore_hosts list as it does today but it's better
than using a global config option in the API which could be wrong for a
mixed hypervisor deployment.

[1] https://github.com/openstack/nova/blob/19.0.0/nova/virt/driver.py#L153
[2] https://review.opendev.org/676022/
[3] https://review.opendev.org/695220/

Change-Id: I29ef5c402e0d006518bfce14f616e58f85ce7c9d
Related-Bug: #1748697
This commit is contained in:
Matt Riedemann 2019-06-20 10:51:58 -04:00 committed by Stephen Finucane
parent c7468b0bad
commit f6c8636bd8
1 changed files with 7 additions and 0 deletions

View File

@ -21,4 +21,11 @@ TRAITS = [
'NODE',
# The virt driver supports trusted image certificate validation
'TRUSTED_CERTS',
# The virt driver supports cold migrating to the same compute service host.
# This really only works for a cluster-type hypervisor driver like the
# vCenter driver which is a single compute service host managing a vCenter
# cluster of potentially hundreds of ESXi hosts. Note that this trait will
# not make sense to use in GET /allocation_candidates until/unless there is
# a way to tie it to the condition of SAME_HOST-ness.
'SAME_HOST_COLD_MIGRATE',
]