projects
/
ganeti-local
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small improvements for cluster verify
[ganeti-local]
/
lib
/
cmdlib.py
diff --git
a/lib/cmdlib.py
b/lib/cmdlib.py
index
d04aec4
..
1e0ac3e
100644
(file)
--- a/
lib/cmdlib.py
+++ b/
lib/cmdlib.py
@@
-1574,6
+1574,7
@@
class LUClusterVerifyConfig(NoHooksLU, _VerifyErrors):
def ExpandNames(self):
# Information can be safely retrieved as the BGL is acquired in exclusive
# mode
def ExpandNames(self):
# Information can be safely retrieved as the BGL is acquired in exclusive
# mode
+ assert locking.BGL in self.owned_locks(locking.LEVEL_CLUSTER)
self.all_group_info = self.cfg.GetAllNodeGroupsInfo()
self.all_node_info = self.cfg.GetAllNodesInfo()
self.all_inst_info = self.cfg.GetAllInstancesInfo()
self.all_group_info = self.cfg.GetAllNodeGroupsInfo()
self.all_node_info = self.cfg.GetAllNodesInfo()
self.all_inst_info = self.cfg.GetAllInstancesInfo()
@@
-1635,7
+1636,7
@@
class LUClusterVerifyConfig(NoHooksLU, _VerifyErrors):
"the following instances have a non-existing primary-node:"
" %s", utils.CommaJoin(no_node_instances))
"the following instances have a non-existing primary-node:"
" %s", utils.CommaJoin(no_node_instances))
- return (not self.bad, [g.name for g in self.all_group_info.values()])
+ return not self.bad
class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
@@
-1733,7
+1734,10
@@
class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
self.needed_locks[locking.LEVEL_NODE] = nodes
def CheckPrereq(self):
self.needed_locks[locking.LEVEL_NODE] = nodes
def CheckPrereq(self):
- group_nodes = set(self.cfg.GetNodeGroup(self.group_uuid).members)
+ assert self.group_uuid in self.owned_locks(locking.LEVEL_NODEGROUP)
+ self.group_info = self.cfg.GetNodeGroup(self.group_uuid)
+
+ group_nodes = set(self.group_info.members)
group_instances = self.cfg.GetNodeGroupInstances(self.group_uuid)
unlocked_nodes = \
group_instances = self.cfg.GetNodeGroupInstances(self.group_uuid)
unlocked_nodes = \
@@
-2565,6
+2569,7
@@
class LUClusterVerifyGroup(LogicalUnit, _VerifyErrors):
"""
# This method has too many local variables. pylint: disable-msg=R0914
"""
# This method has too many local variables. pylint: disable-msg=R0914
+ feedback_fn("* Verifying group '%s'" % self.group_info.name)
if not self.my_node_names:
# empty node group
if not self.my_node_names:
# empty node group
@@
-4338,7
+4343,7
@@
class _NodeQuery(_QueryBase):
def ExpandNames(self, lu):
lu.needed_locks = {}
def ExpandNames(self, lu):
lu.needed_locks = {}
- lu.share_locks[locking.LEVEL_NODE] = 1
+ lu.share_locks = _ShareAll()
if self.names:
self.wanted = _GetWantedNodes(lu, self.names)
if self.names:
self.wanted = _GetWantedNodes(lu, self.names)
@@
-4349,7
+4354,7
@@
class _NodeQuery(_QueryBase):
query.NQ_LIVE in self.requested_data)
if self.do_locking:
query.NQ_LIVE in self.requested_data)
if self.do_locking:
- # if we don't request only static fields, we need to lock the nodes
+ # If any non-static field is requested we need to lock the nodes
lu.needed_locks[locking.LEVEL_NODE] = self.wanted
def DeclareLocks(self, lu, level):
lu.needed_locks[locking.LEVEL_NODE] = self.wanted
def DeclareLocks(self, lu, level):
@@
-4721,7
+4726,7
@@
class LUQuery(NoHooksLU):
def CheckArguments(self):
qcls = _GetQueryImplementation(self.op.what)
def CheckArguments(self):
qcls = _GetQueryImplementation(self.op.what)
- self.impl = qcls(self.op.filter, self.op.fields, False)
+ self.impl = qcls(self.op.filter, self.op.fields, self.op.use_locking)
def ExpandNames(self):
self.impl.ExpandNames(self)
def ExpandNames(self):
self.impl.ExpandNames(self)
@@
-12057,6
+12062,9
@@
class LUGroupQuery(NoHooksLU):
def ExpandNames(self):
self.gq.ExpandNames(self)
def ExpandNames(self):
self.gq.ExpandNames(self)
+ def DeclareLocks(self, level):
+ self.gq.DeclareLocks(self, level)
+
def Exec(self, feedback_fn):
return self.gq.OldStyleQuery(self)
def Exec(self, feedback_fn):
return self.gq.OldStyleQuery(self)