Merge "Move migration_get_..._by_host_and_node to conductor"
This commit is contained in:
commit
b709a9a808
@ -259,7 +259,8 @@ class ResourceTracker(object):
|
|||||||
self._update_usage_from_instances(resources, instances)
|
self._update_usage_from_instances(resources, instances)
|
||||||
|
|
||||||
# Grab all in-progress migrations:
|
# Grab all in-progress migrations:
|
||||||
migrations = db.migration_get_in_progress_by_host_and_node(context,
|
capi = self.conductor_api
|
||||||
|
migrations = capi.migration_get_in_progress_by_host_and_node(context,
|
||||||
self.host, self.nodename)
|
self.host, self.nodename)
|
||||||
|
|
||||||
self._update_usage_from_migrations(resources, migrations)
|
self._update_usage_from_migrations(resources, migrations)
|
||||||
|
@ -134,6 +134,10 @@ class LocalAPI(object):
|
|||||||
return self._manager.migration_get_unconfirmed_by_dest_compute(
|
return self._manager.migration_get_unconfirmed_by_dest_compute(
|
||||||
context, confirm_window, dest_compute)
|
context, confirm_window, dest_compute)
|
||||||
|
|
||||||
|
def migration_get_in_progress_by_host_and_node(self, context, host, node):
|
||||||
|
return self._manager.migration_get_in_progress_by_host_and_node(
|
||||||
|
context, host, node)
|
||||||
|
|
||||||
def migration_create(self, context, instance, values):
|
def migration_create(self, context, instance, values):
|
||||||
return self._manager.migration_create(context, instance, values)
|
return self._manager.migration_create(context, instance, values)
|
||||||
|
|
||||||
@ -370,6 +374,11 @@ class API(object):
|
|||||||
return crpcapi.migration_get_unconfirmed_by_dest_compute(
|
return crpcapi.migration_get_unconfirmed_by_dest_compute(
|
||||||
context, confirm_window, dest_compute)
|
context, confirm_window, dest_compute)
|
||||||
|
|
||||||
|
def migration_get_in_progress_by_host_and_node(self, context, host, node):
|
||||||
|
crpcapi = self.conductor_rpcapi
|
||||||
|
return crpcapi.migration_get_in_progress_by_host_and_node(context,
|
||||||
|
host, node)
|
||||||
|
|
||||||
def migration_create(self, context, instance, values):
|
def migration_create(self, context, instance, values):
|
||||||
return self.conductor_rpcapi.migration_create(context, instance,
|
return self.conductor_rpcapi.migration_create(context, instance,
|
||||||
values)
|
values)
|
||||||
|
@ -43,7 +43,7 @@ datetime_fields = ['launched_at', 'terminated_at']
|
|||||||
class ConductorManager(manager.SchedulerDependentManager):
|
class ConductorManager(manager.SchedulerDependentManager):
|
||||||
"""Mission: TBD."""
|
"""Mission: TBD."""
|
||||||
|
|
||||||
RPC_API_VERSION = '1.30'
|
RPC_API_VERSION = '1.31'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(ConductorManager, self).__init__(service_name='conductor',
|
super(ConductorManager, self).__init__(service_name='conductor',
|
||||||
@ -100,6 +100,12 @@ class ConductorManager(manager.SchedulerDependentManager):
|
|||||||
context, confirm_window, dest_compute)
|
context, confirm_window, dest_compute)
|
||||||
return jsonutils.to_primitive(migrations)
|
return jsonutils.to_primitive(migrations)
|
||||||
|
|
||||||
|
def migration_get_in_progress_by_host_and_node(self, context,
|
||||||
|
host, node):
|
||||||
|
migrations = self.db.migration_get_in_progress_by_host_and_node(
|
||||||
|
context, host, node)
|
||||||
|
return jsonutils.to_primitive(migrations)
|
||||||
|
|
||||||
def migration_create(self, context, instance, values):
|
def migration_create(self, context, instance, values):
|
||||||
values.update({'instance_uuid': instance['uuid'],
|
values.update({'instance_uuid': instance['uuid'],
|
||||||
'source_compute': instance['host'],
|
'source_compute': instance['host'],
|
||||||
|
@ -63,6 +63,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
|||||||
1.28 - Added binary arg to service_get_all_by
|
1.28 - Added binary arg to service_get_all_by
|
||||||
1.29 - Added service_destroy
|
1.29 - Added service_destroy
|
||||||
1.30 - Added migration_create
|
1.30 - Added migration_create
|
||||||
|
1.31 - Added migration_get_in_progress_by_host_and_node
|
||||||
"""
|
"""
|
||||||
|
|
||||||
BASE_RPC_API_VERSION = '1.0'
|
BASE_RPC_API_VERSION = '1.0'
|
||||||
@ -106,6 +107,12 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
|||||||
dest_compute=dest_compute)
|
dest_compute=dest_compute)
|
||||||
return self.call(context, msg, version='1.20')
|
return self.call(context, msg, version='1.20')
|
||||||
|
|
||||||
|
def migration_get_in_progress_by_host_and_node(self, context,
|
||||||
|
host, node):
|
||||||
|
msg = self.make_msg('migration_get_in_progress_by_host_and_node',
|
||||||
|
host=host, node=node)
|
||||||
|
return self.call(context, msg, version='1.31')
|
||||||
|
|
||||||
def migration_create(self, context, instance, values):
|
def migration_create(self, context, instance, values):
|
||||||
instance_p = jsonutils.to_primitive(instance)
|
instance_p = jsonutils.to_primitive(instance)
|
||||||
msg = self.make_msg('migration_create', instance=instance_p,
|
msg = self.make_msg('migration_create', instance=instance_p,
|
||||||
|
@ -80,6 +80,9 @@ class MultiNodeComputeTestCase(BaseTestCase):
|
|||||||
super(MultiNodeComputeTestCase, self).setUp()
|
super(MultiNodeComputeTestCase, self).setUp()
|
||||||
self.flags(compute_driver='nova.virt.fake.FakeDriver')
|
self.flags(compute_driver='nova.virt.fake.FakeDriver')
|
||||||
self.compute = importutils.import_object(CONF.compute_manager)
|
self.compute = importutils.import_object(CONF.compute_manager)
|
||||||
|
self.flags(use_local=True, group='conductor')
|
||||||
|
self.conductor = self.start_service('conductor',
|
||||||
|
manager=CONF.conductor.manager)
|
||||||
|
|
||||||
def test_update_available_resource_add_remove_node(self):
|
def test_update_available_resource_add_remove_node(self):
|
||||||
ctx = context.get_admin_context()
|
ctx = context.get_admin_context()
|
||||||
|
@ -130,6 +130,16 @@ class _BaseTestCase(object):
|
|||||||
'fake-window',
|
'fake-window',
|
||||||
'fake-host')
|
'fake-host')
|
||||||
|
|
||||||
|
def test_migration_get_in_progress_by_host_and_node(self):
|
||||||
|
self.mox.StubOutWithMock(db,
|
||||||
|
'migration_get_in_progress_by_host_and_node')
|
||||||
|
db.migration_get_in_progress_by_host_and_node(
|
||||||
|
self.context, 'fake-host', 'fake-node').AndReturn('fake-result')
|
||||||
|
self.mox.ReplayAll()
|
||||||
|
result = self.conductor.migration_get_in_progress_by_host_and_node(
|
||||||
|
self.context, 'fake-host', 'fake-node')
|
||||||
|
self.assertEqual(result, 'fake-result')
|
||||||
|
|
||||||
def test_migration_create(self):
|
def test_migration_create(self):
|
||||||
inst = {'uuid': 'fake-uuid',
|
inst = {'uuid': 'fake-uuid',
|
||||||
'host': 'fake-host',
|
'host': 'fake-host',
|
||||||
|
Loading…
Reference in New Issue
Block a user