Change prep_resize paths to use objects
Converts calls to compute's prep_resize to pass a new-world instance object. This does not convert the scheduler prep_resize method which is still called on reschedules. It will soon be deprecated anyway. Related to blueprint unified-object-model Change-Id: I7a150f119547595aec962d5e5a8d2ab815d0b6c5
This commit is contained in:
committed by
Mark McLoughlin
parent
26065f581f
commit
f8bd56540d
@@ -32,6 +32,7 @@ from nova.conductor.tasks import live_migrate
|
||||
import nova.context
|
||||
from nova import exception
|
||||
from nova import manager
|
||||
from nova.objects import instance as instance_obj
|
||||
from nova.openstack.common import excutils
|
||||
from nova.openstack.common import importutils
|
||||
from nova.openstack.common import jsonutils
|
||||
@@ -185,8 +186,13 @@ class SchedulerManager(manager.Manager):
|
||||
filter_properties.pop('context', None)
|
||||
|
||||
(host, node) = (host_state['host'], host_state['nodename'])
|
||||
attrs = ['metadata', 'system_metadata', 'info_cache',
|
||||
'security_groups']
|
||||
inst_obj = instance_obj.Instance._from_db_object(
|
||||
context, instance_obj.Instance(), instance,
|
||||
expected_attrs=attrs)
|
||||
self.compute_rpcapi.prep_resize(
|
||||
context, image, instance, instance_type, host,
|
||||
context, image, inst_obj, instance_type, host,
|
||||
reservations, request_spec=request_spec,
|
||||
filter_properties=filter_properties, node=node)
|
||||
|
||||
|
||||
@@ -31,12 +31,14 @@ from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova.image import glance
|
||||
from nova.objects import instance as instance_obj
|
||||
from nova.openstack.common.notifier import api as notifier
|
||||
from nova.openstack.common.rpc import common as rpc_common
|
||||
from nova.scheduler import driver
|
||||
from nova.scheduler import manager
|
||||
from nova import servicegroup
|
||||
from nova import test
|
||||
from nova.tests import fake_instance
|
||||
from nova.tests import fake_instance_actions
|
||||
from nova.tests.image import fake as fake_image
|
||||
from nova.tests import matchers
|
||||
@@ -459,7 +461,7 @@ class SchedulerManagerTestCase(test.NoDBTestCase):
|
||||
|
||||
image = 'image'
|
||||
instance_uuid = 'fake-instance-id'
|
||||
instance = {'uuid': instance_uuid}
|
||||
instance = fake_instance.fake_db_instance(uuid=instance_uuid)
|
||||
|
||||
instance_properties = {'project_id': 'fake', 'os_type': 'Linux'}
|
||||
instance_type = "m1.tiny"
|
||||
@@ -477,7 +479,8 @@ class SchedulerManagerTestCase(test.NoDBTestCase):
|
||||
self.context, request_spec, filter_properties).AndReturn(hosts)
|
||||
|
||||
self.mox.StubOutWithMock(self.manager.compute_rpcapi, 'prep_resize')
|
||||
self.manager.compute_rpcapi.prep_resize(self.context, image, instance,
|
||||
self.manager.compute_rpcapi.prep_resize(self.context, image,
|
||||
mox.IsA(instance_obj.Instance),
|
||||
instance_type, 'host', reservations, request_spec=request_spec,
|
||||
filter_properties=filter_properties, node='node')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user