Hide lock_prefix argument using synchronized_with_prefix()

The lockfile module has a new convenience API which sets the lockfile prefix.
Using this API, the prefix is not required everytime synchronized is used.

Change-Id: Iac1cfcc83b59108164de924d20127c1cf4dd7dcd
This commit is contained in:
Zhongyue Luo
2013-05-11 21:25:16 +08:00
parent 3d8d18304e
commit 3c09821ba9
2 changed files with 4 additions and 4 deletions

View File

@@ -161,7 +161,7 @@ class RawTestCase(_ImageTestCase, test.TestCase):
def prepare_mocks(self):
fn = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(imagebackend.lockutils.synchronized,
self.mox.StubOutWithMock(imagebackend.utils.synchronized,
'__call__')
self.mox.StubOutWithMock(imagebackend.libvirt_utils, 'copy_image')
self.mox.StubOutWithMock(imagebackend.disk, 'extend')
@@ -230,7 +230,7 @@ class Qcow2TestCase(_ImageTestCase, test.TestCase):
def prepare_mocks(self):
fn = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(imagebackend.lockutils.synchronized,
self.mox.StubOutWithMock(imagebackend.utils.synchronized,
'__call__')
self.mox.StubOutWithMock(imagebackend.libvirt_utils,
'create_cow_image')

View File

@@ -59,10 +59,10 @@ import sqlalchemy.exc
from nova.db.sqlalchemy import api as db
import nova.db.sqlalchemy.migrate_repo
from nova.db.sqlalchemy import utils as db_utils
from nova.openstack.common import lockutils
from nova.openstack.common import log as logging
from nova.openstack.common import timeutils
from nova import test
from nova import utils
import nova.virt.baremetal.db.sqlalchemy.migrate_repo
@@ -246,7 +246,7 @@ class BaseMigrationTestCase(test.TestCase):
self.assertEqual(0, status,
"Failed to run: %s\n%s" % (cmd, output))
@lockutils.synchronized('pgadmin', 'nova-', external=True)
@utils.synchronized('pgadmin', external=True)
def _reset_pg(self, conn_pieces):
(user, password, database, host) = \
get_pgsql_connection_info(conn_pieces)