Skip to content

Commit

Permalink
Remove unused quota_* calls from conductor
Browse files Browse the repository at this point in the history
Compute manager's use of quota calls has been converted to using
objects internally and conductor's quota_commit and quota_rollback
methods are no longer used.

Change-Id: I6f43cb7f94775632e97d40e65ca08a3ba5dc195f
  • Loading branch information
comstud committed Mar 23, 2014
1 parent 0a717d7 commit 2f36085
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 51 deletions.
12 changes: 0 additions & 12 deletions nova/conductor/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,18 +258,6 @@ def network_migrate_instance_finish(self, context, instance, migration):
instance,
migration)

def quota_commit(self, context, reservations, project_id=None,
user_id=None):
return self._manager.quota_commit(context, reservations,
project_id=project_id,
user_id=user_id)

def quota_rollback(self, context, reservations, project_id=None,
user_id=None):
return self._manager.quota_rollback(context, reservations,
project_id=project_id,
user_id=user_id)

def get_ec2_ids(self, context, instance):
return self._manager.get_ec2_ids(context, instance)

Expand Down
2 changes: 2 additions & 0 deletions nova/conductor/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,10 +1019,12 @@ def network_migrate_instance_finish(self, context, instance, migration):
return self.manager.network_migrate_instance_finish(context, instance,
migration)

# TODO(comstud): This can be removed in version 3.0 of RPCAPI
def quota_commit(self, context, reservations, project_id, user_id):
return self.manager.quota_commit(context, reservations, project_id,
user_id)

# TODO(comstud): This can be removed in version 3.0 of RPCAPI
def quota_rollback(self, context, reservations, project_id, user_id):
return self.manager.quota_rollback(context, reservations, project_id,
user_id)
Expand Down
17 changes: 1 addition & 16 deletions nova/conductor/rpcapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class ConductorAPI(object):
... - Remove block_device_mapping_destroy()
2.0 - Drop backwards compatibility
... - Remove quota_rollback() and quota_commit()
"""

VERSION_ALIASES = {
Expand Down Expand Up @@ -390,22 +391,6 @@ def network_migrate_instance_finish(self, context, instance, migration):
return cctxt.call(context, 'network_migrate_instance_finish',
instance=instance_p, migration=migration_p)

def quota_commit(self, context, reservations, project_id=None,
user_id=None):
reservations_p = jsonutils.to_primitive(reservations)
cctxt = self.client.prepare()
return cctxt.call(context, 'quota_commit',
reservations=reservations_p,
project_id=project_id, user_id=user_id)

def quota_rollback(self, context, reservations, project_id=None,
user_id=None):
reservations_p = jsonutils.to_primitive(reservations)
cctxt = self.client.prepare()
return cctxt.call(context, 'quota_rollback',
reservations=reservations_p,
project_id=project_id, user_id=user_id)

def get_ec2_ids(self, context, instance):
instance_p = jsonutils.to_primitive(instance)
cctxt = self.client.prepare()
Expand Down
23 changes: 0 additions & 23 deletions nova/tests/conductor/test_conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
from nova.objects import migration as migration_obj
from nova.openstack.common import jsonutils
from nova.openstack.common import timeutils
from nova import quota
from nova import rpc
from nova.scheduler import utils as scheduler_utils
from nova import test
Expand Down Expand Up @@ -453,28 +452,6 @@ def test_network_migrate_instance_finish(self):
'instance',
'migration')

def test_quota_commit(self):
self.mox.StubOutWithMock(quota.QUOTAS, 'commit')
quota.QUOTAS.commit(self.context, 'reservations', project_id=None,
user_id=None)
quota.QUOTAS.commit(self.context, 'reservations', project_id='proj',
user_id='user')
self.mox.ReplayAll()
self.conductor.quota_commit(self.context, 'reservations')
self.conductor.quota_commit(self.context, 'reservations', 'proj',
'user')

def test_quota_rollback(self):
self.mox.StubOutWithMock(quota.QUOTAS, 'rollback')
quota.QUOTAS.rollback(self.context, 'reservations', project_id=None,
user_id=None)
quota.QUOTAS.rollback(self.context, 'reservations', project_id='proj',
user_id='user')
self.mox.ReplayAll()
self.conductor.quota_rollback(self.context, 'reservations')
self.conductor.quota_rollback(self.context, 'reservations', 'proj',
'user')

def test_get_ec2_ids(self):
expected = {
'instance-id': 'ec2-inst-id',
Expand Down

0 comments on commit 2f36085

Please sign in to comment.