Revision 7996a135
b/lib/jqueue.py | ||
---|---|---|
28 | 28 |
from ganeti import workerpool |
29 | 29 |
from ganeti import errors |
30 | 30 |
from ganeti import mcpu |
31 |
from ganeti import utils |
|
31 | 32 |
|
32 | 33 |
|
33 | 34 |
JOBQUEUE_THREADS = 5 |
b/lib/utils.py | ||
---|---|---|
1063 | 1063 |
return ("volume group '%s' too small (%s MiB required, %d MiB found)" % |
1064 | 1064 |
(vgname, minsize, vgsize)) |
1065 | 1065 |
return None |
1066 |
|
|
1067 |
|
|
1068 |
def LockedMethod(fn): |
|
1069 |
"""Synchronized object access decorator. |
|
1070 |
|
|
1071 |
This decorator is intended to protect access to an object using the |
|
1072 |
object's own lock which is hardcoded to '_lock'. |
|
1073 |
|
|
1074 |
""" |
|
1075 |
def wrapper(self, *args, **kwargs): |
|
1076 |
assert hasattr(self, '_lock') |
|
1077 |
lock = self._lock |
|
1078 |
lock.acquire() |
|
1079 |
try: |
|
1080 |
result = fn(self, *args, **kwargs) |
|
1081 |
finally: |
|
1082 |
lock.release() |
|
1083 |
return result |
|
1084 |
return wrapper |
Also available in: Unified diff