Remove and deprecate unused conductor method vol_usage_update()
Now that all calls that previously used conductor vol_usage_update() have been converted to objects, lets clean out the unused code in conductor. Change-Id: I7d7930fbcc748587d3278c128802dcebedbba892
This commit is contained in:
parent
b1a3183a69
commit
3140842b83
|
@ -69,15 +69,6 @@ class LocalAPI(object):
|
|||
def provider_fw_rule_get_all(self, context):
|
||||
return self._manager.provider_fw_rule_get_all(context)
|
||||
|
||||
def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
|
||||
wr_bytes, instance, last_refreshed=None,
|
||||
update_totals=False):
|
||||
return self._manager.vol_usage_update(context, vol_id,
|
||||
rd_req, rd_bytes,
|
||||
wr_req, wr_bytes,
|
||||
instance, last_refreshed,
|
||||
update_totals)
|
||||
|
||||
def compute_node_create(self, context, values):
|
||||
return self._manager.compute_node_create(context, values)
|
||||
|
||||
|
|
|
@ -255,8 +255,7 @@ class ConductorManager(manager.Manager):
|
|||
result = self.db.instance_fault_create(context, values)
|
||||
return jsonutils.to_primitive(result)
|
||||
|
||||
# NOTE(kerrin): The last_refreshed argument is unused by this method
|
||||
# and can be removed in v3.0 of the RPC API.
|
||||
# NOTE(hanlind): This can be removed in version 3.0 of the RPC API
|
||||
def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
|
||||
wr_bytes, instance, last_refreshed, update_totals):
|
||||
vol_usage = self.db.vol_usage_update(context, vol_id,
|
||||
|
|
|
@ -181,6 +181,7 @@ class ConductorAPI(object):
|
|||
* Remove task_log_begin_task()
|
||||
* Remove task_log_end_task()
|
||||
* Remove security_groups_trigger_members_refresh()
|
||||
* Remove vol_usage_update()
|
||||
|
||||
"""
|
||||
|
||||
|
@ -215,18 +216,6 @@ class ConductorAPI(object):
|
|||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'provider_fw_rule_get_all')
|
||||
|
||||
def vol_usage_update(self, context, vol_id, rd_req, rd_bytes, wr_req,
|
||||
wr_bytes, instance, last_refreshed=None,
|
||||
update_totals=False):
|
||||
instance_p = jsonutils.to_primitive(instance)
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'vol_usage_update',
|
||||
vol_id=vol_id, rd_req=rd_req,
|
||||
rd_bytes=rd_bytes, wr_req=wr_req,
|
||||
wr_bytes=wr_bytes,
|
||||
instance=instance_p, last_refreshed=last_refreshed,
|
||||
update_totals=update_totals)
|
||||
|
||||
def compute_node_create(self, context, values):
|
||||
cctxt = self.client.prepare()
|
||||
return cctxt.call(context, 'compute_node_create', values=values)
|
||||
|
|
|
@ -145,38 +145,6 @@ class _BaseTestCase(object):
|
|||
result = self.conductor.provider_fw_rule_get_all(self.context)
|
||||
self.assertEqual(result, fake_rules)
|
||||
|
||||
def test_vol_usage_update(self):
|
||||
self.mox.StubOutWithMock(db, 'vol_usage_update')
|
||||
self.mox.StubOutWithMock(compute_utils, 'usage_volume_info')
|
||||
|
||||
fake_inst = {'uuid': 'fake-uuid',
|
||||
'project_id': 'fake-project',
|
||||
'user_id': 'fake-user',
|
||||
'availability_zone': 'fake-az',
|
||||
}
|
||||
|
||||
db.vol_usage_update(self.context, 'fake-vol', 22, 33, 44, 55,
|
||||
fake_inst['uuid'],
|
||||
fake_inst['project_id'],
|
||||
fake_inst['user_id'],
|
||||
fake_inst['availability_zone'],
|
||||
False).AndReturn(test_volume_usage.fake_vol_usage)
|
||||
compute_utils.usage_volume_info(
|
||||
mox.IsA(objects.VolumeUsage)).AndReturn('fake-info')
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.conductor.vol_usage_update(self.context, 'fake-vol',
|
||||
22, 33, 44, 55, fake_inst, None, False)
|
||||
|
||||
self.assertEqual(1, len(fake_notifier.NOTIFICATIONS))
|
||||
msg = fake_notifier.NOTIFICATIONS[0]
|
||||
self.assertEqual('conductor.%s' % self.conductor_manager.host,
|
||||
msg.publisher_id)
|
||||
self.assertEqual('volume.usage', msg.event_type)
|
||||
self.assertEqual('INFO', msg.priority)
|
||||
self.assertEqual('fake-info', msg.payload)
|
||||
|
||||
def test_compute_node_create(self):
|
||||
self.mox.StubOutWithMock(db, 'compute_node_create')
|
||||
db.compute_node_create(self.context, 'fake-values').AndReturn(
|
||||
|
@ -779,6 +747,38 @@ class ConductorTestCase(_BaseTestCase, test.TestCase):
|
|||
self.conductor.security_groups_trigger_members_refresh(self.context,
|
||||
[1, 2, 3])
|
||||
|
||||
def test_vol_usage_update(self):
|
||||
self.mox.StubOutWithMock(db, 'vol_usage_update')
|
||||
self.mox.StubOutWithMock(compute_utils, 'usage_volume_info')
|
||||
|
||||
fake_inst = {'uuid': 'fake-uuid',
|
||||
'project_id': 'fake-project',
|
||||
'user_id': 'fake-user',
|
||||
'availability_zone': 'fake-az',
|
||||
}
|
||||
|
||||
db.vol_usage_update(self.context, 'fake-vol', 22, 33, 44, 55,
|
||||
fake_inst['uuid'],
|
||||
fake_inst['project_id'],
|
||||
fake_inst['user_id'],
|
||||
fake_inst['availability_zone'],
|
||||
False).AndReturn(test_volume_usage.fake_vol_usage)
|
||||
compute_utils.usage_volume_info(
|
||||
mox.IsA(objects.VolumeUsage)).AndReturn('fake-info')
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.conductor.vol_usage_update(self.context, 'fake-vol',
|
||||
22, 33, 44, 55, fake_inst, None, False)
|
||||
|
||||
self.assertEqual(1, len(fake_notifier.NOTIFICATIONS))
|
||||
msg = fake_notifier.NOTIFICATIONS[0]
|
||||
self.assertEqual('conductor.%s' % self.conductor_manager.host,
|
||||
msg.publisher_id)
|
||||
self.assertEqual('volume.usage', msg.event_type)
|
||||
self.assertEqual('INFO', msg.priority)
|
||||
self.assertEqual('fake-info', msg.payload)
|
||||
|
||||
|
||||
class ConductorRPCAPITestCase(_BaseTestCase, test.TestCase):
|
||||
"""Conductor RPC API Tests."""
|
||||
|
|
Loading…
Reference in New Issue