Merge "Rename get_lock() to _get_lock()."

This commit is contained in:
Jenkins 2012-07-18 22:19:29 +00:00 committed by Gerrit Code Review
commit 758356c512
2 changed files with 5 additions and 4 deletions

View File

@ -170,7 +170,7 @@ def checks_instance_lock(function):
context=context, instance_uuid=instance_uuid) context=context, instance_uuid=instance_uuid)
LOG.info(_("check_instance_lock: arguments: |%(self)s| |%(context)s|") LOG.info(_("check_instance_lock: arguments: |%(self)s| |%(context)s|")
% locals(), context=context, instance_uuid=instance_uuid) % locals(), context=context, instance_uuid=instance_uuid)
locked = self.get_lock(context, instance_uuid) locked = self._get_lock(context, instance_uuid)
admin = context.is_admin admin = context.is_admin
LOG.info(_("check_instance_lock: locked: |%s|"), locked, LOG.info(_("check_instance_lock: locked: |%s|"), locked,
context=context, instance_uuid=instance_uuid) context=context, instance_uuid=instance_uuid)
@ -1686,7 +1686,7 @@ class ComputeManager(manager.SchedulerDependentManager):
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id()) @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
@wrap_instance_fault @wrap_instance_fault
def get_lock(self, context, instance_uuid): def _get_lock(self, context, instance_uuid):
"""Return the boolean state of the given instance's lock.""" """Return the boolean state of the given instance's lock."""
context = context.elevated() context = context.elevated()
instance_ref = self.db.instance_get_by_uuid(context, instance_uuid) instance_ref = self.db.instance_get_by_uuid(context, instance_uuid)

View File

@ -1007,9 +1007,10 @@ class ComputeTestCase(BaseTestCase):
def test_get_lock(self): def test_get_lock(self):
instance = self._create_fake_instance() instance = self._create_fake_instance()
self.assertFalse(self.compute.get_lock(self.context, instance['uuid'])) self.assertFalse(self.compute._get_lock(self.context,
instance['uuid']))
db.instance_update(self.context, instance['uuid'], {'locked': True}) db.instance_update(self.context, instance['uuid'], {'locked': True})
self.assertTrue(self.compute.get_lock(self.context, instance['uuid'])) self.assertTrue(self.compute._get_lock(self.context, instance['uuid']))
def test_lock(self): def test_lock(self):
"""ensure locked instance cannot be changed""" """ensure locked instance cannot be changed"""