Deprecate conductor instance_type_get() and remove from VirtAPI
The flavor_get() in VirtAPI and instance_type_get() in conductor are no longer needed by the virt drivers. This patch deprecates the function in conductor's API and removes it everywhere else. Related to blueprint compute-manager-objects Change-Id: I782ee449df98a198f625b946c650ebff56711b8e
This commit is contained in:
@@ -401,10 +401,6 @@ class ComputeVirtAPI(virtapi.VirtAPI):
|
||||
return self._compute.conductor_api.agent_build_get_by_triple(
|
||||
context, hypervisor, os, architecture)
|
||||
|
||||
def flavor_get(self, context, flavor_id):
|
||||
return self._compute.conductor_api.instance_type_get(context,
|
||||
flavor_id)
|
||||
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy=True):
|
||||
capi = self._compute.conductor_api
|
||||
|
||||
@@ -103,9 +103,6 @@ class LocalAPI(object):
|
||||
def instance_info_cache_delete(self, context, instance):
|
||||
return self._manager.instance_info_cache_delete(context, instance)
|
||||
|
||||
def instance_type_get(self, context, instance_type_id):
|
||||
return self._manager.instance_type_get(context, instance_type_id)
|
||||
|
||||
def instance_fault_create(self, context, values):
|
||||
return self._manager.instance_fault_create(context, values)
|
||||
|
||||
|
||||
@@ -380,6 +380,8 @@ class ConductorManager(manager.Manager):
|
||||
self.db.instance_info_cache_update(context, instance['uuid'],
|
||||
values)
|
||||
|
||||
# NOTE(danms): This method is now deprecated and can be removed in
|
||||
# version v2.0 of the RPC API.
|
||||
def instance_type_get(self, context, instance_type_id):
|
||||
result = self.db.flavor_get(context, instance_type_id)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
@@ -125,6 +125,7 @@ class ConductorAPI(object):
|
||||
1.63 - Changed the format of values['stats'] from a dict to a JSON string
|
||||
in compute_node_update()
|
||||
1.64 - Added use_slave to instance_get_all_filters()
|
||||
... - Remove instance_type_get()
|
||||
"""
|
||||
|
||||
VERSION_ALIASES = {
|
||||
@@ -306,11 +307,6 @@ class ConductorAPI(object):
|
||||
cctxt = self.client.prepare(version='1.17')
|
||||
cctxt.call(context, 'instance_info_cache_delete', instance=instance_p)
|
||||
|
||||
def instance_type_get(self, context, instance_type_id):
|
||||
cctxt = self.client.prepare(version='1.18')
|
||||
return cctxt.call(context, 'instance_type_get',
|
||||
instance_type_id=instance_type_id)
|
||||
|
||||
def vol_get_usage_by_time(self, context, start_time):
|
||||
start_time_p = jsonutils.to_primitive(start_time)
|
||||
cctxt = self.client.prepare(version='1.19')
|
||||
|
||||
@@ -50,9 +50,6 @@ class VirtAPIBaseTest(test.NoDBTestCase, test.APICoverage):
|
||||
self.assertExpected('agent_build_get_by_triple',
|
||||
'fake-hv', 'gnu/hurd', 'fake-arch')
|
||||
|
||||
def test_flavor_get(self):
|
||||
self.assertExpected('flavor_get', 'fake-flavor')
|
||||
|
||||
def test_block_device_mapping_get_all_by_instance(self):
|
||||
self.assertExpected('block_device_mapping_get_all_by_instance',
|
||||
{'uuid': 'fake_uuid'}, legacy=False)
|
||||
@@ -117,14 +114,8 @@ class ComputeVirtAPITest(VirtAPIBaseTest):
|
||||
self.virtapi = compute_manager.ComputeVirtAPI(self.compute)
|
||||
|
||||
def assertExpected(self, method, *args, **kwargs):
|
||||
if method == 'flavor_get':
|
||||
# TODO(mriedem): Remove this when conductor_api.instance_type_get
|
||||
# is renamed to flavor_get.
|
||||
cond_api_method = 'instance_type_get'
|
||||
else:
|
||||
cond_api_method = method
|
||||
self.mox.StubOutWithMock(self.compute.conductor_api, cond_api_method)
|
||||
getattr(self.compute.conductor_api, cond_api_method)(
|
||||
self.mox.StubOutWithMock(self.compute.conductor_api, method)
|
||||
getattr(self.compute.conductor_api, method)(
|
||||
self.context, *args, **kwargs).AndReturn('it worked')
|
||||
self.mox.ReplayAll()
|
||||
result = getattr(self.virtapi, method)(self.context, *args, **kwargs)
|
||||
|
||||
@@ -287,13 +287,6 @@ class _BaseTestCase(object):
|
||||
self.conductor.instance_info_cache_delete(self.context,
|
||||
{'uuid': 'fake-uuid'})
|
||||
|
||||
def test_flavor_get(self):
|
||||
self.mox.StubOutWithMock(db, 'flavor_get')
|
||||
db.flavor_get(self.context, 'fake-id').AndReturn('fake-type')
|
||||
self.mox.ReplayAll()
|
||||
result = self.conductor.instance_type_get(self.context, 'fake-id')
|
||||
self.assertEqual(result, 'fake-type')
|
||||
|
||||
def test_vol_get_usage_by_time(self):
|
||||
self.mox.StubOutWithMock(db, 'vol_get_usage_by_time')
|
||||
db.vol_get_usage_by_time(self.context, 'fake-time').AndReturn(
|
||||
|
||||
@@ -479,9 +479,6 @@ class FakeVirtAPI(virtapi.VirtAPI):
|
||||
return db.agent_build_get_by_triple(context,
|
||||
hypervisor, os, architecture)
|
||||
|
||||
def flavor_get(self, context, flavor_id):
|
||||
return db.flavor_get(context, flavor_id)
|
||||
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy=True):
|
||||
bdms = db.block_device_mapping_get_all_by_instance(context,
|
||||
|
||||
@@ -40,13 +40,6 @@ class VirtAPI(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def flavor_get(self, context, flavor_id):
|
||||
"""Get information about a flavor
|
||||
:param context: security context
|
||||
:param flavor_id: the id of the flavor in question
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def block_device_mapping_get_all_by_instance(self, context, instance,
|
||||
legacy=True):
|
||||
"""Get block device mappings for an instance
|
||||
|
||||
Reference in New Issue
Block a user