From d65e5776c8f05478a2790859f1f15eb47954d091 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Wed, 10 Sep 2008 11:02:45 +0000 Subject: [PATCH] Add a way to export all node information at once The patch adds a new function to export all node information at once (i.e. atomically with respect to the configuration lock). Reviewed-by: ultrotter --- lib/config.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/config.py b/lib/config.py index adf57f3..510ddd4 100644 --- a/lib/config.py +++ b/lib/config.py @@ -539,6 +539,19 @@ class ConfigWriter: return self._UnlockedGetNodeList() @locking.ssynchronized(_config_lock, shared=1) + def GetAllNodesInfo(self): + """Get the configuration of all nodes. + + @rtype: dict + @returns: dict of (node, node_info), where node_info is what + would GetNodeInfo return for the node + + """ + my_dict = dict([(node, self._UnlockedGetNodeInfo(node)) + for node in self._UnlockedGetNodeList()]) + return my_dict + + @locking.ssynchronized(_config_lock, shared=1) def DumpConfig(self): """Return the entire configuration of the cluster. """ -- 1.7.10.4