Revision 6c0a75db lib/locking.py
b/lib/locking.py | ||
---|---|---|
1477 | 1477 |
#: Level for node resources, used for operations with possibly high impact on |
1478 | 1478 |
#: the node's disks. |
1479 | 1479 |
LEVEL_NODE_RES = 4 |
1480 |
LEVEL_NETWORK = 5 |
|
1480 | 1481 |
|
1481 | 1482 |
LEVELS = [ |
1482 | 1483 |
LEVEL_CLUSTER, |
... | ... | |
1484 | 1485 |
LEVEL_NODEGROUP, |
1485 | 1486 |
LEVEL_NODE, |
1486 | 1487 |
LEVEL_NODE_RES, |
1488 |
LEVEL_NETWORK, |
|
1487 | 1489 |
] |
1488 | 1490 |
|
1489 | 1491 |
# Lock levels which are modifiable |
... | ... | |
1492 | 1494 |
LEVEL_NODE, |
1493 | 1495 |
LEVEL_NODEGROUP, |
1494 | 1496 |
LEVEL_INSTANCE, |
1497 |
LEVEL_NETWORK, |
|
1495 | 1498 |
]) |
1496 | 1499 |
|
1497 | 1500 |
#: Lock level names (make sure to use singular form) |
... | ... | |
1501 | 1504 |
LEVEL_NODEGROUP: "nodegroup", |
1502 | 1505 |
LEVEL_NODE: "node", |
1503 | 1506 |
LEVEL_NODE_RES: "node-res", |
1507 |
LEVEL_NETWORK: "network", |
|
1504 | 1508 |
} |
1505 | 1509 |
|
1506 | 1510 |
# Constant for the big ganeti lock |
... | ... | |
1518 | 1522 |
""" |
1519 | 1523 |
_instance = None |
1520 | 1524 |
|
1521 |
def __init__(self, nodes, nodegroups, instances): |
|
1525 |
def __init__(self, nodes, nodegroups, instances, networks):
|
|
1522 | 1526 |
"""Constructs a new GanetiLockManager object. |
1523 | 1527 |
|
1524 | 1528 |
There should be only a GanetiLockManager object at any time, so this |
... | ... | |
1543 | 1547 |
LEVEL_NODE: LockSet(nodes, "node", monitor=self._monitor), |
1544 | 1548 |
LEVEL_NODE_RES: LockSet(nodes, "node-res", monitor=self._monitor), |
1545 | 1549 |
LEVEL_NODEGROUP: LockSet(nodegroups, "nodegroup", monitor=self._monitor), |
1546 |
LEVEL_INSTANCE: LockSet(instances, "instance", |
|
1547 |
monitor=self._monitor),
|
|
1550 |
LEVEL_INSTANCE: LockSet(instances, "instance", monitor=self._monitor),
|
|
1551 |
LEVEL_NETWORK: LockSet(networks, "network", monitor=self._monitor),
|
|
1548 | 1552 |
} |
1549 | 1553 |
|
1550 | 1554 |
assert compat.all(ls.name == LEVEL_NAMES[level] |
Also available in: Unified diff