On Apr 14 14:29, Ilias Tsitsimpis wrote: > This property returns the nodes covered by a disk. > > Signed-off-by: Ilias Tsitsimpis <[email protected]> > --- > lib/objects.py | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/lib/objects.py b/lib/objects.py > index 874951e..2a4290d 100644 > --- a/lib/objects.py > +++ b/lib/objects.py > @@ -537,6 +537,23 @@ class Disk(ConfigObject): > # is sent to, and should not be persisted. > ["dynamic_params"]) > > + def _ComputeAllNodes(self): > + """Compute the list of all nodes covered by a device and its children.""" > + nodes = list() > + > + if self.dev_type in constants.DTS_DRBD: > + nodea, nodeb = self.logical_id[:2] > + nodes.append(nodea) > + nodes.append(nodeb) > + if self.children: > + for child in self.children: > + nodes.extend(child.all_nodes)
Doesn't this need to be done recursively through the children? Also, why not nodes.extend(self.logical_id[:2]) > + > + return tuple(set(nodes)) > + > + all_nodes = property(_ComputeAllNodes, None, None, > + "List of names of all the nodes of a disk") > + > def CreateOnSecondary(self): > """Test if this device needs to be created on a secondary node.""" > return self.dev_type in (constants.DT_DRBD8, constants.DT_PLAIN) > -- > 1.9.1 > -- Jose Antonio Lopes Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370
