Revision 6b2a2942 lib/config.py
b/lib/config.py | ||
---|---|---|
237 | 237 |
return self._config_data.cluster.FillND(node, nodegroup) |
238 | 238 |
|
239 | 239 |
@locking.ssynchronized(_config_lock, shared=1) |
240 |
def GetNdGroupParams(self, nodegroup): |
|
241 |
"""Get the node groups params populated with cluster defaults. |
|
242 |
|
|
243 |
@type nodegroup: L{objects.NodeGroup} |
|
244 |
@param nodegroup: The node group we want to know the params for |
|
245 |
@return: A dict with the filled in node group params |
|
246 |
|
|
247 |
""" |
|
248 |
return self._config_data.cluster.FillNDGroup(nodegroup) |
|
249 |
|
|
250 |
@locking.ssynchronized(_config_lock, shared=1) |
|
240 | 251 |
def GetInstanceDiskParams(self, instance): |
241 | 252 |
"""Get the disk params populated with inherit chain. |
242 | 253 |
|
... | ... | |
1349 | 1360 |
""" |
1350 | 1361 |
return self._UnlockedGetNodeGroup(uuid) |
1351 | 1362 |
|
1363 |
def _UnlockedGetAllNodeGroupsInfo(self): |
|
1364 |
"""Get the configuration of all node groups. |
|
1365 |
|
|
1366 |
""" |
|
1367 |
return dict(self._config_data.nodegroups) |
|
1368 |
|
|
1352 | 1369 |
@locking.ssynchronized(_config_lock, shared=1) |
1353 | 1370 |
def GetAllNodeGroupsInfo(self): |
1354 | 1371 |
"""Get the configuration of all node groups. |
1355 | 1372 |
|
1356 | 1373 |
""" |
1357 |
return dict(self._config_data.nodegroups)
|
|
1374 |
return self._UnlockedGetAllNodeGroupsInfo()
|
|
1358 | 1375 |
|
1359 | 1376 |
@locking.ssynchronized(_config_lock, shared=1) |
1360 | 1377 |
def GetNodeGroupList(self): |
... | ... | |
2024 | 2041 |
""" |
2025 | 2042 |
return self._UnlockedGetNodeInfoByName(node_name) |
2026 | 2043 |
|
2044 |
@locking.ssynchronized(_config_lock, shared=1) |
|
2045 |
def GetNodeGroupInfoByName(self, nodegroup_name): |
|
2046 |
"""Get the L{objects.NodeGroup} object for a named node group. |
|
2047 |
|
|
2048 |
@param nodegroup_name: name of the node group to get information for |
|
2049 |
@type nodegroup_name: string |
|
2050 |
@return: the corresponding L{objects.NodeGroup} instance or None if no |
|
2051 |
information is available |
|
2052 |
|
|
2053 |
""" |
|
2054 |
for nodegroup in self._UnlockedGetAllNodeGroupsInfo().values(): |
|
2055 |
if nodegroup.name == nodegroup_name: |
|
2056 |
return nodegroup |
|
2057 |
return None |
|
2058 |
|
|
2027 | 2059 |
def _UnlockedGetNodeName(self, node_spec): |
2028 | 2060 |
if isinstance(node_spec, objects.Node): |
2029 | 2061 |
return node_spec.name |
Also available in: Unified diff