Merge "Rename get_lock() to _get_lock()."
This commit is contained in:
commit
758356c512
@ -170,7 +170,7 @@ def checks_instance_lock(function):
|
||||
context=context, instance_uuid=instance_uuid)
|
||||
LOG.info(_("check_instance_lock: arguments: |%(self)s| |%(context)s|")
|
||||
% 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
|
||||
LOG.info(_("check_instance_lock: locked: |%s|"), locked,
|
||||
context=context, instance_uuid=instance_uuid)
|
||||
@ -1686,7 +1686,7 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
|
||||
@exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())
|
||||
@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."""
|
||||
context = context.elevated()
|
||||
instance_ref = self.db.instance_get_by_uuid(context, instance_uuid)
|
||||
|
@ -1007,9 +1007,10 @@ class ComputeTestCase(BaseTestCase):
|
||||
|
||||
def test_get_lock(self):
|
||||
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})
|
||||
self.assertTrue(self.compute.get_lock(self.context, instance['uuid']))
|
||||
self.assertTrue(self.compute._get_lock(self.context, instance['uuid']))
|
||||
|
||||
def test_lock(self):
|
||||
"""ensure locked instance cannot be changed"""
|
||||
|
Loading…
Reference in New Issue
Block a user