Revision 5d7a899e
b/lib/locking.py | ||
---|---|---|
1407 | 1407 |
LEVEL_INSTANCE, |
1408 | 1408 |
]) |
1409 | 1409 |
|
1410 |
#: Lock level names (make sure to use singular form) |
|
1410 | 1411 |
LEVEL_NAMES = { |
1411 | 1412 |
LEVEL_CLUSTER: "cluster", |
1412 | 1413 |
LEVEL_INSTANCE: "instance", |
1413 | 1414 |
LEVEL_NODEGROUP: "nodegroup", |
1414 | 1415 |
LEVEL_NODE: "node", |
1415 |
LEVEL_NODE_RES: "nodes-res",
|
|
1416 |
LEVEL_NODE_RES: "node-res", |
|
1416 | 1417 |
} |
1417 | 1418 |
|
1418 | 1419 |
# Constant for the big ganeti lock |
... | ... | |
1451 | 1452 |
# The keyring contains all the locks, at their level and in the correct |
1452 | 1453 |
# locking order. |
1453 | 1454 |
self.__keyring = { |
1454 |
LEVEL_CLUSTER: LockSet([BGL], "BGL", monitor=self._monitor),
|
|
1455 |
LEVEL_NODE: LockSet(nodes, "nodes", monitor=self._monitor),
|
|
1456 |
LEVEL_NODE_RES: LockSet(nodes, "nodes-res", monitor=self._monitor),
|
|
1457 |
LEVEL_NODEGROUP: LockSet(nodegroups, "nodegroups", monitor=self._monitor),
|
|
1458 |
LEVEL_INSTANCE: LockSet(instances, "instances",
|
|
1455 |
LEVEL_CLUSTER: LockSet([BGL], "cluster", monitor=self._monitor),
|
|
1456 |
LEVEL_NODE: LockSet(nodes, "node", monitor=self._monitor), |
|
1457 |
LEVEL_NODE_RES: LockSet(nodes, "node-res", monitor=self._monitor), |
|
1458 |
LEVEL_NODEGROUP: LockSet(nodegroups, "nodegroup", monitor=self._monitor), |
|
1459 |
LEVEL_INSTANCE: LockSet(instances, "instance", |
|
1459 | 1460 |
monitor=self._monitor), |
1460 | 1461 |
} |
1461 | 1462 |
|
1463 |
assert compat.all(ls.name == LEVEL_NAMES[level] |
|
1464 |
for (level, ls) in self.__keyring.items()) |
|
1465 |
|
|
1462 | 1466 |
def AddToLockMonitor(self, provider): |
1463 | 1467 |
"""Registers a new lock with the monitor. |
1464 | 1468 |
|
Also available in: Unified diff