Merge "Fix instance evacuation with PCI devices"
This commit is contained in:
commit
a40c00957e
|
@ -2880,7 +2880,8 @@ class ComputeManager(manager.Manager):
|
|||
self._do_rebuild_instance_with_claim(
|
||||
claim_ctxt, context, instance, orig_image_ref,
|
||||
image_ref, injected_files, new_pass, orig_sys_metadata,
|
||||
bdms, recreate, on_shared_storage, preserve_ephemeral)
|
||||
bdms, recreate, on_shared_storage, preserve_ephemeral,
|
||||
migration)
|
||||
except exception.ComputeResourcesUnavailable as e:
|
||||
LOG.debug("Could not rebuild instance on this host, not "
|
||||
"enough resources available.", instance=instance)
|
||||
|
@ -2942,7 +2943,8 @@ class ComputeManager(manager.Manager):
|
|||
def _do_rebuild_instance(self, context, instance, orig_image_ref,
|
||||
image_ref, injected_files, new_pass,
|
||||
orig_sys_metadata, bdms, recreate,
|
||||
on_shared_storage, preserve_ephemeral):
|
||||
on_shared_storage, preserve_ephemeral,
|
||||
migration):
|
||||
orig_vm_state = instance.vm_state
|
||||
|
||||
if recreate:
|
||||
|
@ -3015,7 +3017,7 @@ class ComputeManager(manager.Manager):
|
|||
# TODO(cfriesen): this network_api call and the one above
|
||||
# are so similar, we should really try to unify them.
|
||||
self.network_api.setup_instance_network_on_host(
|
||||
context, instance, self.host)
|
||||
context, instance, self.host, migration)
|
||||
|
||||
allocations = self.reportclient.get_allocations_for_consumer(
|
||||
instance.uuid)
|
||||
|
|
|
@ -512,7 +512,8 @@ class API(base_api.NetworkAPI):
|
|||
|
||||
self.network_rpcapi.migrate_instance_finish(context, **args)
|
||||
|
||||
def setup_instance_network_on_host(self, context, instance, host):
|
||||
def setup_instance_network_on_host(self, context, instance, host,
|
||||
migration=None):
|
||||
"""Setup network for specified instance on host."""
|
||||
self.migrate_instance_finish(context, instance,
|
||||
{'source_compute': None,
|
||||
|
|
|
@ -333,12 +333,15 @@ class NetworkAPI(base.Base):
|
|||
"""Finish migrating the network of an instance."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def setup_instance_network_on_host(self, context, instance, host):
|
||||
def setup_instance_network_on_host(self, context, instance, host,
|
||||
migration=None):
|
||||
"""Setup network for specified instance on host.
|
||||
|
||||
:param context: The request context.
|
||||
:param instance: nova.objects.instance.Instance object.
|
||||
:param host: The host which network should be setup for instance.
|
||||
:param migration: The migration object if the instance is being
|
||||
tracked with a migration.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
|
|
@ -2503,9 +2503,11 @@ class API(base_api.NetworkAPI):
|
|||
"""Create a private DNS domain with optional nova project."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def setup_instance_network_on_host(self, context, instance, host):
|
||||
def setup_instance_network_on_host(self, context, instance, host,
|
||||
migration=None):
|
||||
"""Setup network for specified instance on host."""
|
||||
self._update_port_binding_for_instance(context, instance, host)
|
||||
self._update_port_binding_for_instance(context, instance, host,
|
||||
migration)
|
||||
|
||||
def cleanup_instance_network_on_host(self, context, instance, host):
|
||||
"""Cleanup network for specified instance on host."""
|
||||
|
|
|
@ -12485,7 +12485,7 @@ class EvacuateHostTestCase(BaseTestCase):
|
|||
mock_setup_networks_on_host.assert_called_once_with(
|
||||
ctxt, self.inst, self.inst.host)
|
||||
mock_setup_instance_network_on_host.assert_called_once_with(
|
||||
ctxt, self.inst, self.inst.host)
|
||||
ctxt, self.inst, self.inst.host, migration)
|
||||
|
||||
_test_rebuild(vm_is_stopped=vm_states_is_stopped)
|
||||
|
||||
|
|
Loading…
Reference in New Issue