diff --git a/nova/compute/manager.py b/nova/compute/manager.py index c701d200530f..8faa980cb78a 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -82,6 +82,7 @@ from nova.network import model as network_model from nova.network.security_group import openstack_driver from nova import objects from nova.objects import base as obj_base +from nova.objects import instance as obj_instance from nova import paths from nova import rpc from nova import safe_utils @@ -1768,7 +1769,7 @@ class ComputeManager(manager.Manager): """ if not self.send_instance_updates: return - if isinstance(instance, objects.Instance): + if isinstance(instance, obj_instance._BaseInstance): instance = objects.InstanceList(objects=[instance]) context = context.elevated() self.scheduler_client.update_instance_info(context, self.host, diff --git a/nova/objects/request_spec.py b/nova/objects/request_spec.py index a8f7e64d5e4b..09cf954ab193 100644 --- a/nova/objects/request_spec.py +++ b/nova/objects/request_spec.py @@ -17,6 +17,7 @@ import six from nova import objects from nova.objects import base from nova.objects import fields +from nova.objects import instance as obj_instance @base.NovaObjectRegistry.register @@ -96,7 +97,7 @@ class RequestSpec(base.NovaObject): self.image = None def _from_instance(self, instance): - if isinstance(instance, objects.Instance): + if isinstance(instance, obj_instance._BaseInstance): # NOTE(sbauza): Instance should normally be a NovaObject... getter = getattr elif isinstance(instance, dict): diff --git a/nova/scheduler/utils.py b/nova/scheduler/utils.py index 93b107c22671..27cb053e985e 100644 --- a/nova/scheduler/utils.py +++ b/nova/scheduler/utils.py @@ -29,6 +29,7 @@ from nova import exception from nova.i18n import _, _LE, _LW from nova import objects from nova.objects import base as obj_base +from nova.objects import instance as obj_instance from nova import rpc @@ -56,12 +57,12 @@ def build_request_spec(ctxt, image, instances, instance_type=None): """ instance = instances[0] if instance_type is None: - if isinstance(instance, objects.Instance): + if isinstance(instance, obj_instance._BaseInstance): instance_type = instance.get_flavor() else: instance_type = flavors.extract_flavor(instance) - if isinstance(instance, objects.Instance): + if isinstance(instance, obj_instance._BaseInstance): instance = obj_base.obj_to_primitive(instance) # obj_to_primitive doesn't copy this enough, so be sure # to detach our metadata blob because we modify it below. diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index b67a8c6e0518..1681683b11cc 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -26,6 +26,7 @@ from nova import context from nova import exception from nova.i18n import _ from nova import objects +from nova.objects import instance as obj_instance virt_cpu_opts = [ cfg.StrOpt('vcpu_pin_set', @@ -1174,7 +1175,7 @@ def instance_topology_from_instance(instance): Instance object, this makes sure we get beck either None, or an instance of objects.InstanceNUMATopology class. """ - if isinstance(instance, objects.Instance): + if isinstance(instance, obj_instance._BaseInstance): # NOTE (ndipanov): This may cause a lazy-load of the attribute instance_numa_topology = instance.numa_topology else: