Revision 08a6c581 lib/locking.py
b/lib/locking.py | ||
---|---|---|
669 | 669 |
# - at levels LEVEL_NODE and LEVEL_INSTANCE reside node and instance locks. |
670 | 670 |
# If you need more than one node, or more than one instance, acquire them at |
671 | 671 |
# the same time. |
672 |
# - level LEVEL_CONFIG contains the configuration lock, which you must acquire |
|
673 |
# before reading or changing the config file. |
|
674 | 672 |
LEVEL_CLUSTER = 0 |
675 | 673 |
LEVEL_NODE = 1 |
676 | 674 |
LEVEL_INSTANCE = 2 |
677 |
LEVEL_CONFIG = 3 |
|
678 | 675 |
|
679 | 676 |
LEVELS = [LEVEL_CLUSTER, |
680 | 677 |
LEVEL_NODE, |
681 |
LEVEL_INSTANCE, |
|
682 |
LEVEL_CONFIG] |
|
678 |
LEVEL_INSTANCE] |
|
683 | 679 |
|
684 | 680 |
# Lock levels which are modifiable |
685 | 681 |
LEVELS_MOD = [LEVEL_NODE, LEVEL_INSTANCE] |
686 | 682 |
|
687 |
# Constant for the big ganeti lock and config lock
|
|
683 |
# Constant for the big ganeti lock |
|
688 | 684 |
BGL = 'BGL' |
689 |
CONFIG = 'config' |
|
690 | 685 |
|
691 | 686 |
|
692 | 687 |
class GanetiLockManager: |
... | ... | |
720 | 715 |
LEVEL_CLUSTER: LockSet([BGL]), |
721 | 716 |
LEVEL_NODE: LockSet(nodes), |
722 | 717 |
LEVEL_INSTANCE: LockSet(instances), |
723 |
LEVEL_CONFIG: LockSet([CONFIG]), |
|
724 | 718 |
} |
725 | 719 |
|
726 | 720 |
def _names(self, level): |
Also available in: Unified diff