Merge "Correct Instance type check to work with InstanceV1"
This commit is contained in:
commit
56dccd04be
@ -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,
|
||||
|
@ -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):
|
||||
|
@ -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.
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user