Cleanup conductor unused methods
There are some conductor api methods left unused that can be removed together with two very old manager methods that were deprecated and scheduled for removal with the rpc api version bump to 2.0. This change removes the following unused api client methods: - instance_get_all_by_host() - instance_get_all_by_host_and_node() - migration_get_in_progress_by_host_and_node() - aggregate_metadata_get_by_host() - block_device_mapping_create() - block_device_mapping_update() - block_device_mapping_update_or_create() - block_device_mapping_get_all_by_instance() - compute_node_update() - compute_node_delete() - security_groups_trigger_handler() Furthermore, it removes these previously deprecated manager methods: - ping() - instance_get_active_by_window() Manager methods that are deprecated and scheduled for removal on the next rpc version bump are annotated with a todo comment if not there already. Change-Id: Ia825cee94e6ba9431a85c1b6f64cb26e7c83c95f
This commit is contained in:
parent
0b23bce359
commit
e5de12f2e6
|
@ -66,48 +66,9 @@ class LocalAPI(object):
|
|||
return self._manager.instance_update(context, instance_uuid,
|
||||
updates, 'compute')
|
||||
|
||||
def instance_get_all_by_host(self, context, host, columns_to_join=None):
|
||||
return self._manager.instance_get_all_by_host(
|
||||
context, host, None, columns_to_join=columns_to_join)
|
||||
|
||||
def instance_get_all_by_host_and_node(self, context, host, node):
|
||||
return self._manager.instance_get_all_by_host(context, host, node,
|
||||
None)
|
||||
|
||||
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 aggregate_metadata_get_by_host(self, context, host,
|
||||
key='availability_zone'):
|
||||
return self._manager.aggregate_metadata_get_by_host(context,
|
||||
host,
|
||||
key)
|
||||
|
||||
def provider_fw_rule_get_all(self, context):
|
||||
return self._manager.provider_fw_rule_get_all(context)
|
||||
|
||||
def block_device_mapping_create(self, context, values):
|
||||
return self._manager.block_device_mapping_update_or_create(context,
|
||||
values,
|
||||
create=True)
|
||||
|
||||
def block_device_mapping_update(self, context, bdm_id, values):
|
||||
values = dict(values)
|
||||
values['id'] = bdm_id
|
||||
return self._manager.block_device_mapping_update_or_create(
|
||||
context, values, create=False)
|
||||
|
||||
def block_device_mapping_update_or_create(self, context, values):
|
||||
return self._manager.block_device_mapping_update_or_create(context,
|
||||
values,
|
||||
create=None)
|
||||
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy=True):
|
||||
return self._manager.block_device_mapping_get_all_by_instance(
|
||||
context, instance, legacy)
|
||||
|
||||
def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
|
||||
wr_bytes, instance, last_refreshed=None,
|
||||
update_totals=False):
|
||||
|
@ -120,13 +81,6 @@ class LocalAPI(object):
|
|||
def compute_node_create(self, context, values):
|
||||
return self._manager.compute_node_create(context, values)
|
||||
|
||||
def compute_node_update(self, context, node, values, prune_stats=False):
|
||||
# NOTE(belliott) ignore prune_stats param, it's no longer relevant
|
||||
return self._manager.compute_node_update(context, node, values)
|
||||
|
||||
def compute_node_delete(self, context, node):
|
||||
return self._manager.compute_node_delete(context, node)
|
||||
|
||||
def task_log_get(self, context, task_name, begin, end, host, state=None):
|
||||
return self._manager.task_log_get(context, task_name, begin, end,
|
||||
host, state)
|
||||
|
@ -143,10 +97,6 @@ class LocalAPI(object):
|
|||
begin, end, host,
|
||||
errors, message)
|
||||
|
||||
def security_groups_trigger_handler(self, context, event, *args):
|
||||
return self._manager.security_groups_trigger_handler(context,
|
||||
event, args)
|
||||
|
||||
def security_groups_trigger_members_refresh(self, context, group_ids):
|
||||
return self._manager.security_groups_trigger_members_refresh(context,
|
||||
group_ids)
|
||||
|
|
|
@ -106,11 +106,6 @@ class ConductorManager(manager.Manager):
|
|||
self._compute_api = compute_api.API()
|
||||
return self._compute_api
|
||||
|
||||
def ping(self, context, arg):
|
||||
# NOTE(russellb) This method can be removed in 2.0 of this API. It is
|
||||
# now a part of the base rpc API.
|
||||
return jsonutils.to_primitive({'service': 'conductor', 'arg': arg})
|
||||
|
||||
@messaging.expected_exceptions(KeyError, ValueError,
|
||||
exception.InvalidUUID,
|
||||
exception.InstanceNotFound,
|
||||
|
@ -138,6 +133,7 @@ class ConductorManager(manager.Manager):
|
|||
notifications.send_update(context, old_ref, inst_obj, service)
|
||||
return jsonutils.to_primitive(instance_ref)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
@messaging.expected_exceptions(exception.InstanceNotFound)
|
||||
def instance_get_by_uuid(self, context, instance_uuid,
|
||||
columns_to_join):
|
||||
|
@ -145,6 +141,7 @@ class ConductorManager(manager.Manager):
|
|||
self.db.instance_get_by_uuid(context, instance_uuid,
|
||||
columns_to_join))
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def instance_get_all_by_host(self, context, host, node,
|
||||
columns_to_join):
|
||||
if node is not None:
|
||||
|
@ -155,12 +152,14 @@ class ConductorManager(manager.Manager):
|
|||
columns_to_join)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
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)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
@messaging.expected_exceptions(exception.AggregateHostExists)
|
||||
def aggregate_host_add(self, context, aggregate, host):
|
||||
host_ref = self.db.aggregate_host_add(context.elevated(),
|
||||
|
@ -168,11 +167,13 @@ class ConductorManager(manager.Manager):
|
|||
|
||||
return jsonutils.to_primitive(host_ref)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
@messaging.expected_exceptions(exception.AggregateHostNotFound)
|
||||
def aggregate_host_delete(self, context, aggregate, host):
|
||||
self.db.aggregate_host_delete(context.elevated(),
|
||||
aggregate['id'], host)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def aggregate_metadata_get_by_host(self, context, host,
|
||||
key='availability_zone'):
|
||||
result = self.db.aggregate_metadata_get_by_host(context, host, key)
|
||||
|
@ -216,6 +217,7 @@ class ConductorManager(manager.Manager):
|
|||
self.cells_rpcapi.bdm_update_or_create_at_top(context, bdm_obj,
|
||||
create=create)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy):
|
||||
bdms = self.db.block_device_mapping_get_all_by_instance(
|
||||
|
@ -224,6 +226,7 @@ class ConductorManager(manager.Manager):
|
|||
bdms = block_device.legacy_mapping(bdms)
|
||||
return jsonutils.to_primitive(bdms)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def instance_get_all_by_filters(self, context, filters, sort_key,
|
||||
sort_dir, columns_to_join,
|
||||
use_slave):
|
||||
|
@ -232,23 +235,19 @@ class ConductorManager(manager.Manager):
|
|||
columns_to_join=columns_to_join, use_slave=use_slave)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
def instance_get_active_by_window(self, context, begin, end,
|
||||
project_id, host):
|
||||
# Unused, but cannot remove until major RPC version bump
|
||||
result = self.db.instance_get_active_by_window(context, begin, end,
|
||||
project_id, host)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def instance_get_active_by_window_joined(self, context, begin, end,
|
||||
project_id, host):
|
||||
result = self.db.instance_get_active_by_window_joined(
|
||||
context, begin, end, project_id, host)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def instance_destroy(self, context, instance):
|
||||
result = self.db.instance_destroy(context, instance['uuid'])
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def instance_fault_create(self, context, values):
|
||||
result = self.db.instance_fault_create(context, values)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
@ -300,11 +299,13 @@ class ConductorManager(manager.Manager):
|
|||
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
@messaging.expected_exceptions(exception.InstanceActionNotFound)
|
||||
def action_event_start(self, context, values):
|
||||
evt = self.db.action_event_start(context, values)
|
||||
return jsonutils.to_primitive(evt)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
@messaging.expected_exceptions(exception.InstanceActionNotFound,
|
||||
exception.InstanceActionEventNotFound)
|
||||
def action_event_finish(self, context, values):
|
||||
|
@ -325,10 +326,12 @@ class ConductorManager(manager.Manager):
|
|||
result = self.db.compute_node_create(context, values)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def compute_node_update(self, context, node, values):
|
||||
result = self.db.compute_node_update(context, node['id'], values)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def compute_node_delete(self, context, node):
|
||||
result = self.db.compute_node_delete(context, node['id'])
|
||||
return jsonutils.to_primitive(result)
|
||||
|
@ -372,23 +375,28 @@ class ConductorManager(manager.Manager):
|
|||
ignore_missing_network_data,
|
||||
system_metadata, extra_usage_info)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def security_groups_trigger_handler(self, context, event, args):
|
||||
self.security_group_api.trigger_handler(event, context, *args)
|
||||
|
||||
def security_groups_trigger_members_refresh(self, context, group_ids):
|
||||
self.security_group_api.trigger_members_refresh(context, group_ids)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def network_migrate_instance_start(self, context, instance, migration):
|
||||
self.network_api.migrate_instance_start(context, instance, migration)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def network_migrate_instance_finish(self, context, instance, migration):
|
||||
self.network_api.migrate_instance_finish(context, instance, migration)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def quota_commit(self, context, reservations, project_id=None,
|
||||
user_id=None):
|
||||
quota.QUOTAS.commit(context, reservations, project_id=project_id,
|
||||
user_id=user_id)
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def quota_rollback(self, context, reservations, project_id=None,
|
||||
user_id=None):
|
||||
quota.QUOTAS.rollback(context, reservations, project_id=project_id,
|
||||
|
@ -411,6 +419,7 @@ class ConductorManager(manager.Manager):
|
|||
|
||||
return ec2_ids
|
||||
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def compute_unrescue(self, context, instance):
|
||||
self.compute_api.unrescue(context, instance)
|
||||
|
||||
|
|
|
@ -169,6 +169,14 @@ class ConductorAPI(object):
|
|||
* Remove service_create()
|
||||
* Remove service_destroy()
|
||||
* Remove service_update()
|
||||
* Remove migration_get_in_progress_by_host_and_node()
|
||||
* Remove aggregate_metadata_get_by_host()
|
||||
* Remove block_device_mapping_update_or_create()
|
||||
* Remove block_device_mapping_get_all_by_instance()
|
||||
* Remove instance_get_all_by_host()
|
||||
* Remove compute_node_update()
|
||||
* Remove compute_node_delete()
|
||||
* Remove security_groups_trigger_handler()
|
||||
|
||||
"""
|
||||
|
||||
|
@ -199,36 +207,10 @@ class ConductorAPI(object):
|
|||
updates=updates_p,
|
||||
service=service)
|
||||
|
||||
def migration_get_in_progress_by_host_and_node(self, context,
|
||||
host, node):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context,
|
||||
'migration_get_in_progress_by_host_and_node',
|
||||
host=host, node=node)
|
||||
|
||||
def aggregate_metadata_get_by_host(self, context, host, key):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'aggregate_metadata_get_by_host',
|
||||
host=host,
|
||||
key=key)
|
||||
|
||||
def provider_fw_rule_get_all(self, context):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'provider_fw_rule_get_all')
|
||||
|
||||
def block_device_mapping_update_or_create(self, context, values,
|
||||
create=None):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'block_device_mapping_update_or_create',
|
||||
values=values, create=create)
|
||||
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy=True):
|
||||
instance_p = jsonutils.to_primitive(instance)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'block_device_mapping_get_all_by_instance',
|
||||
instance=instance_p, legacy=legacy)
|
||||
|
||||
def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
|
||||
wr_bytes, instance, last_refreshed=None,
|
||||
update_totals=False):
|
||||
|
@ -241,28 +223,10 @@ class ConductorAPI(object):
|
|||
instance=instance_p, last_refreshed=last_refreshed,
|
||||
update_totals=update_totals)
|
||||
|
||||
def instance_get_all_by_host(self, context, host, node=None,
|
||||
columns_to_join=None):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'instance_get_all_by_host',
|
||||
host=host, node=node,
|
||||
columns_to_join=columns_to_join)
|
||||
|
||||
def compute_node_create(self, context, values):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'compute_node_create', values=values)
|
||||
|
||||
def compute_node_update(self, context, node, values):
|
||||
node_p = jsonutils.to_primitive(node)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'compute_node_update',
|
||||
node=node_p, values=values)
|
||||
|
||||
def compute_node_delete(self, context, node):
|
||||
node_p = jsonutils.to_primitive(node)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'compute_node_delete', node=node_p)
|
||||
|
||||
def task_log_get(self, context, task_name, begin, end, host, state=None):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'task_log_get',
|
||||
|
@ -284,12 +248,6 @@ class ConductorAPI(object):
|
|||
task_name=task_name, begin=begin, end=end,
|
||||
host=host, errors=errors, message=message)
|
||||
|
||||
def security_groups_trigger_handler(self, context, event, args):
|
||||
args_p = jsonutils.to_primitive(args)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'security_groups_trigger_handler',
|
||||
event=event, args=args_p)
|
||||
|
||||
def security_groups_trigger_members_refresh(self, context, group_ids):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'security_groups_trigger_members_refresh',
|
||||
|
|
|
@ -401,12 +401,6 @@ class ComputeVolumeTestCase(BaseTestCase):
|
|||
self.cinfo = jsonutils.loads(args[-1].get('connection_info'))
|
||||
return self.fake_volume
|
||||
|
||||
self.stubs.Set(self.compute.conductor_api,
|
||||
'block_device_mapping_update',
|
||||
store_cinfo)
|
||||
self.stubs.Set(self.compute.conductor_api,
|
||||
'block_device_mapping_update_or_create',
|
||||
store_cinfo)
|
||||
self.stubs.Set(db, 'block_device_mapping_create', store_cinfo)
|
||||
self.stubs.Set(db, 'block_device_mapping_update', store_cinfo)
|
||||
|
||||
|
|
|
@ -136,25 +136,6 @@ class _BaseTestCase(object):
|
|||
self.assertRaises(KeyError,
|
||||
self._do_update, 'any-uuid', foobar=1)
|
||||
|
||||
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_aggregate_metadata_get_by_host(self):
|
||||
self.mox.StubOutWithMock(db, 'aggregate_metadata_get_by_host')
|
||||
db.aggregate_metadata_get_by_host(self.context, 'host',
|
||||
'key').AndReturn('result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.aggregate_metadata_get_by_host(self.context,
|
||||
'host', 'key')
|
||||
self.assertEqual(result, 'result')
|
||||
|
||||
def test_provider_fw_rule_get_all(self):
|
||||
fake_rules = ['a', 'b', 'c']
|
||||
self.mox.StubOutWithMock(db, 'provider_fw_rule_get_all')
|
||||
|
@ -163,17 +144,6 @@ class _BaseTestCase(object):
|
|||
result = self.conductor.provider_fw_rule_get_all(self.context)
|
||||
self.assertEqual(result, fake_rules)
|
||||
|
||||
def test_block_device_mapping_get_all_by_instance(self):
|
||||
fake_inst = {'uuid': 'fake-uuid'}
|
||||
self.mox.StubOutWithMock(db,
|
||||
'block_device_mapping_get_all_by_instance')
|
||||
db.block_device_mapping_get_all_by_instance(
|
||||
self.context, fake_inst['uuid']).AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.block_device_mapping_get_all_by_instance(
|
||||
self.context, fake_inst, legacy=False)
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_vol_usage_update(self):
|
||||
self.mox.StubOutWithMock(db, 'vol_usage_update')
|
||||
self.mox.StubOutWithMock(compute_utils, 'usage_volume_info')
|
||||
|
@ -214,24 +184,6 @@ class _BaseTestCase(object):
|
|||
'fake-values')
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_compute_node_update(self):
|
||||
node = {'id': 'fake-id'}
|
||||
self.mox.StubOutWithMock(db, 'compute_node_update')
|
||||
db.compute_node_update(self.context, node['id'], {'fake': 'values'}).\
|
||||
AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.compute_node_update(self.context, node,
|
||||
{'fake': 'values'})
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_compute_node_delete(self):
|
||||
node = {'id': 'fake-id'}
|
||||
self.mox.StubOutWithMock(db, 'compute_node_delete')
|
||||
db.compute_node_delete(self.context, node['id']).AndReturn(None)
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.compute_node_delete(self.context, node)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_task_log_get(self):
|
||||
self.mox.StubOutWithMock(db, 'task_log_get')
|
||||
db.task_log_get(self.context, 'task', 'begin', 'end', 'host',
|
||||
|
@ -425,7 +377,7 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
|
|||
dict(topic='compute', host='host', binary=None),
|
||||
db_result_listified=True)
|
||||
|
||||
def test_service_get_by_args(self):
|
||||
def test_service_get_by_host_and_binary(self):
|
||||
self._test_stubbed('service_get_by_host_and_binary',
|
||||
('host', 'binary'),
|
||||
dict(host='host', binary='binary', topic=None))
|
||||
|
@ -436,7 +388,7 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
|
|||
dict(topic='compute', host='host', binary=None),
|
||||
db_exception=exc.ComputeHostNotFound(host='host'))
|
||||
|
||||
def test_service_get_by_args_not_found(self):
|
||||
def test_service_get_by_host_and_binary_not_found(self):
|
||||
self._test_stubbed('service_get_by_host_and_binary',
|
||||
('host', 'binary'),
|
||||
dict(host='host', binary='binary', topic=None),
|
||||
|
@ -767,6 +719,54 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
|
|||
result = self.conductor.get_ec2_ids(self.context, inst)
|
||||
self.assertEqual(result, expected)
|
||||
|
||||
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_aggregate_metadata_get_by_host(self):
|
||||
self.mox.StubOutWithMock(db, 'aggregate_metadata_get_by_host')
|
||||
db.aggregate_metadata_get_by_host(self.context, 'host',
|
||||
'key').AndReturn('result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.aggregate_metadata_get_by_host(self.context,
|
||||
'host', 'key')
|
||||
self.assertEqual(result, 'result')
|
||||
|
||||
def test_block_device_mapping_get_all_by_instance(self):
|
||||
fake_inst = {'uuid': 'fake-uuid'}
|
||||
self.mox.StubOutWithMock(db,
|
||||
'block_device_mapping_get_all_by_instance')
|
||||
db.block_device_mapping_get_all_by_instance(
|
||||
self.context, fake_inst['uuid']).AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.block_device_mapping_get_all_by_instance(
|
||||
self.context, fake_inst, legacy=False)
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_compute_node_update(self):
|
||||
node = {'id': 'fake-id'}
|
||||
self.mox.StubOutWithMock(db, 'compute_node_update')
|
||||
db.compute_node_update(self.context, node['id'], {'fake': 'values'}).\
|
||||
AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.compute_node_update(self.context, node,
|
||||
{'fake': 'values'})
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_compute_node_delete(self):
|
||||
node = {'id': 'fake-id'}
|
||||
self.mox.StubOutWithMock(db, 'compute_node_delete')
|
||||
db.compute_node_delete(self.context, node['id']).AndReturn(None)
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.compute_node_delete(self.context, node)
|
||||
self.assertIsNone(result)
|
||||
|
||||
|
||||
class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
|
||||
"""Conductor RPC API Tests."""
|
||||
|
@ -777,42 +777,6 @@ class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
|
|||
self.conductor_manager = self.conductor_service.manager
|
||||
self.conductor = conductor_rpcapi.ConductorAPI()
|
||||
|
||||
def test_block_device_mapping_update_or_create(self):
|
||||
fake_bdm = {'id': 'fake-id'}
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_create')
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_update')
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_update_or_create')
|
||||
self.mox.StubOutWithMock(block_device_obj.BlockDeviceMapping,
|
||||
'_from_db_object')
|
||||
db.block_device_mapping_create(self.context, fake_bdm)
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
db.block_device_mapping_update(self.context, fake_bdm['id'], fake_bdm)
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
db.block_device_mapping_update_or_create(self.context, fake_bdm)
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
self.mox.ReplayAll()
|
||||
self.conductor.block_device_mapping_update_or_create(self.context,
|
||||
fake_bdm,
|
||||
create=True)
|
||||
self.conductor.block_device_mapping_update_or_create(self.context,
|
||||
fake_bdm,
|
||||
create=False)
|
||||
self.conductor.block_device_mapping_update_or_create(self.context,
|
||||
fake_bdm)
|
||||
|
||||
def test_security_groups_trigger_handler(self):
|
||||
self.mox.StubOutWithMock(self.conductor_manager.security_group_api,
|
||||
'trigger_handler')
|
||||
self.conductor_manager.security_group_api.trigger_handler('event',
|
||||
self.context,
|
||||
'arg')
|
||||
self.mox.ReplayAll()
|
||||
self.conductor.security_groups_trigger_handler(self.context,
|
||||
'event', ['arg'])
|
||||
|
||||
|
||||
class ConductorAPITestCase(_BaseTestCase, test.TestCase):
|
||||
"""Conductor API Tests."""
|
||||
|
@ -830,49 +794,6 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
|
|||
return self.conductor.instance_update(self.context, instance_uuid,
|
||||
**updates)
|
||||
|
||||
def test_block_device_mapping_update_or_create(self):
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_create')
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_update')
|
||||
self.mox.StubOutWithMock(db, 'block_device_mapping_update_or_create')
|
||||
self.mox.StubOutWithMock(block_device_obj.BlockDeviceMapping,
|
||||
'_from_db_object')
|
||||
db.block_device_mapping_create(self.context, 'fake-bdm')
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
db.block_device_mapping_update(self.context,
|
||||
'fake-id', {'id': 'fake-id'})
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
db.block_device_mapping_update_or_create(self.context, 'fake-bdm')
|
||||
block_device_obj.BlockDeviceMapping._from_db_object(
|
||||
self.context, mox.IgnoreArg(), mox.IgnoreArg())
|
||||
|
||||
self.mox.ReplayAll()
|
||||
self.conductor.block_device_mapping_create(self.context, 'fake-bdm')
|
||||
self.conductor.block_device_mapping_update(self.context, 'fake-id', {})
|
||||
self.conductor.block_device_mapping_update_or_create(self.context,
|
||||
'fake-bdm')
|
||||
|
||||
def test_instance_get_all_by_host_and_node(self):
|
||||
self.mox.StubOutWithMock(db, 'instance_get_all_by_host_and_node')
|
||||
db.instance_get_all_by_host_and_node(self.context.elevated(), 'host',
|
||||
'node').AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.instance_get_all_by_host_and_node(
|
||||
self.context, 'host', 'node')
|
||||
|
||||
self.assertEqual('fake-result', result)
|
||||
|
||||
def test_instance_get_all_by_host(self):
|
||||
self.mox.StubOutWithMock(db, 'instance_get_all_by_host')
|
||||
self.mox.StubOutWithMock(db, 'instance_get_all_by_host_and_node')
|
||||
db.instance_get_all_by_host(self.context.elevated(), 'host',
|
||||
None).AndReturn('fake-result')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.instance_get_all_by_host(self.context,
|
||||
'host', None)
|
||||
self.assertEqual(result, 'fake-result')
|
||||
|
||||
def test_wait_until_ready(self):
|
||||
timeouts = []
|
||||
calls = dict(count=0)
|
||||
|
@ -890,16 +811,6 @@ class ConductorAPITestCase(_BaseTestCase, test.TestCase):
|
|||
self.assertEqual(timeouts.count(10), 10)
|
||||
self.assertIn(None, timeouts)
|
||||
|
||||
def test_security_groups_trigger_handler(self):
|
||||
self.mox.StubOutWithMock(self.conductor_manager.security_group_api,
|
||||
'trigger_handler')
|
||||
self.conductor_manager.security_group_api.trigger_handler('event',
|
||||
self.context,
|
||||
'arg')
|
||||
self.mox.ReplayAll()
|
||||
self.conductor.security_groups_trigger_handler(self.context,
|
||||
'event', 'arg')
|
||||
|
||||
|
||||
class ConductorLocalAPITestCase(ConductorAPITestCase):
|
||||
"""Conductor LocalAPI Tests."""
|
||||
|
|
Loading…
Reference in New Issue