Revision 48126102
b/lib/cmdlib.py | ||
---|---|---|
6053 | 6053 |
|
6054 | 6054 |
def ExpandNames(self): |
6055 | 6055 |
if self.lock_all: |
6056 |
self.needed_locks = {locking.LEVEL_NODE: locking.ALL_SET} |
|
6056 |
self.needed_locks = { |
|
6057 |
locking.LEVEL_NODE: locking.ALL_SET, |
|
6058 |
|
|
6059 |
# Block allocations when all nodes are locked |
|
6060 |
locking.LEVEL_NODE_ALLOC: locking.ALL_SET, |
|
6061 |
} |
|
6057 | 6062 |
else: |
6058 |
self.needed_locks = {locking.LEVEL_NODE: self.op.node_name} |
|
6063 |
self.needed_locks = { |
|
6064 |
locking.LEVEL_NODE: self.op.node_name, |
|
6065 |
} |
|
6059 | 6066 |
|
6060 | 6067 |
# Since modifying a node can have severe effects on currently running |
6061 | 6068 |
# operations the resource lock is at least acquired in shared mode |
6062 | 6069 |
self.needed_locks[locking.LEVEL_NODE_RES] = \ |
6063 | 6070 |
self.needed_locks[locking.LEVEL_NODE] |
6064 | 6071 |
|
6065 |
# Get node resource and instance locks in shared mode; they are not used |
|
6066 |
# for anything but read-only access |
|
6067 |
self.share_locks[locking.LEVEL_NODE_RES] = 1 |
|
6068 |
self.share_locks[locking.LEVEL_INSTANCE] = 1 |
|
6072 |
# Get all locks except nodes in shared mode; they are not used for anything |
|
6073 |
# but read-only access |
|
6074 |
self.share_locks = _ShareAll() |
|
6075 |
self.share_locks[locking.LEVEL_NODE] = 0 |
|
6076 |
self.share_locks[locking.LEVEL_NODE_RES] = 0 |
|
6077 |
self.share_locks[locking.LEVEL_NODE_ALLOC] = 0 |
|
6069 | 6078 |
|
6070 | 6079 |
if self.lock_instances: |
6071 | 6080 |
self.needed_locks[locking.LEVEL_INSTANCE] = \ |
Also available in: Unified diff