Revision 4e7f986e lib/objects.py
b/lib/objects.py | ||
---|---|---|
1108 | 1108 |
"serial_no", |
1109 | 1109 |
] + _TIMESTAMPS + _UUID |
1110 | 1110 |
|
1111 |
def _ComputeAllNodes(self): |
|
1112 |
"""Compute the list of all nodes. |
|
1113 |
|
|
1114 |
Since the data is already there (in the drbd disks), keeping it as |
|
1115 |
a separate normal attribute is redundant and if not properly |
|
1116 |
synchronised can cause problems. Thus it's better to compute it |
|
1117 |
dynamically. |
|
1118 |
|
|
1119 |
""" |
|
1120 |
def _Helper(nodes, device): |
|
1121 |
"""Recursively computes nodes given a top device.""" |
|
1122 |
if device.dev_type in constants.DTS_DRBD: |
|
1123 |
nodea, nodeb = device.logical_id[:2] |
|
1124 |
nodes.add(nodea) |
|
1125 |
nodes.add(nodeb) |
|
1126 |
if device.children: |
|
1127 |
for child in device.children: |
|
1128 |
_Helper(nodes, child) |
|
1129 |
|
|
1130 |
all_nodes = set() |
|
1131 |
all_nodes.add(self.primary_node) |
|
1132 |
for device in self.disks: |
|
1133 |
_Helper(all_nodes, device) |
|
1134 |
return tuple(all_nodes) |
|
1135 |
|
|
1136 |
all_nodes = property(_ComputeAllNodes, None, None, |
|
1137 |
"List of names of all the nodes of the instance") |
|
1138 |
|
|
1139 | 1111 |
def MapLVsByNode(self, lvmap=None, devs=None, node_uuid=None): |
1140 | 1112 |
"""Provide a mapping of nodes to LVs this instance owns. |
1141 | 1113 |
|
Also available in: Unified diff