Revision fc1dc9d7

b/lib/backend.py
722 722
  """
723 723
  children = []
724 724
  if disk.children:
725
    mcn = disk.ChildrenNeeded()
726
    if mcn == -1:
727
      mcn = 0 # max number of Nones allowed
728
    else:
729
      mcn = len(disk.children) - mcn # max number of Nones
725 730
    for chld_disk in disk.children:
726
      children.append(_RecursiveAssembleBD(chld_disk, owner, as_primary))
731
      try:
732
        cdev = _RecursiveAssembleBD(chld_disk, owner, as_primary)
733
      except errors.BlockDeviceError, err:
734
        if children.count(None) > mcn:
735
          raise
736
        cdev = None
737
        logger.Debug("Error in child activation: %s" % str(err))
738
      children.append(cdev)
727 739

  
728 740
  if as_primary or disk.AssembleOnSecondary():
729 741
    r_dev = bdev.AttachOrAssemble(disk.dev_type, disk.physical_id, children)
b/lib/bdev.py
1566 1566
  _PARSE_SHOW = None
1567 1567

  
1568 1568
  def __init__(self, unique_id, children):
1569
    if children and children.count(None) > 0:
1570
      children = []
1569 1571
    super(DRBD8, self).__init__(unique_id, children)
1570 1572
    self.major = self._DRBD_MAJOR
1571 1573
    [kmaj, kmin, kfix, api, proto] = self._GetVersion()
......
2030 2032
                                  "C")
2031 2033
        if res_r and self._MatchesNet(self._GetDevInfo(minor)):
2032 2034
          break
2035
      # the weakest case: we find something that is only net attached
2036
      # even though we were passed some children at init time
2037
      if match_r and "local_dev" not in info:
2038
        break
2033 2039
    else:
2034 2040
      minor = None
2035 2041

  
......
2066 2072

  
2067 2073
    minor = self._FindUnusedMinor()
2068 2074
    need_localdev_teardown = False
2069
    if self._children[0]:
2075
    if self._children and self._children[0] and self._children[1]:
2070 2076
      result = self._AssembleLocal(minor, self._children[0].dev_path,
2071 2077
                                   self._children[1].dev_path)
2072 2078
      if not result:
b/lib/objects.py
338 338
      return "/dev/%s/%s" % (self.logical_id[0], self.logical_id[1])
339 339
    return None
340 340

  
341
  def ChildrenNeeded(self):
342
    """Compute the needed number of children for activation.
343

  
344
    This method will return either -1 (all children) or a positive
345
    number denoting the minimum number of children needed for
346
    activation (only mirrored devices will usually return >=0).
347

  
348
    Currently, only DRBD8 supports diskless activation (therefore we
349
    return 0), for all other we keep the previous semantics and return
350
    -1.
351

  
352
    """
353
    if self.dev_type == constants.LD_DRBD8:
354
      return 0
355
    return -1
356

  
341 357
  def GetNodes(self, node):
342 358
    """This function returns the nodes this device lives on.
343 359

  

Also available in: Unified diff