Commit 9bb31ea8 authored by Iustin Pop's avatar Iustin Pop
Browse files

LURemoveNode safety in face of wrong node list



LURemoveNode runs under the BGL, which means we're guaranteed that the
list of nodes as retrieved in CheckPrereq is still valid in
BuildHooksEnv. However, we can make Ganeti handle failures in case the
locking is broken (or the node list has been modified otherwise) easily,
which is better than crashing hard in such a case.

This will also fix issue 79, even though that is due to an out-of-tree
patch.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 62579388
......@@ -1940,7 +1940,11 @@ class LURemoveNode(LogicalUnit):
"NODE_NAME": self.op.node_name,
}
all_nodes = self.cfg.GetNodeList()
all_nodes.remove(self.op.node_name)
try:
all_nodes.remove(self.op.node_name)
except ValueError:
logging.warning("Node %s which is about to be removed not found"
" in the all nodes list", self.op.node_name)
return env, all_nodes, all_nodes
def CheckPrereq(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment