Logo Search packages:      
Sourcecode: ganeti version File versions  Download package

def lib::bdev::DRBD8::_GetDevInfo (   cls,
  minor 
) [private]

Get details about a given DRBD minor.

This return, if available, the local backing device (as a path)
and the local and remote (ip, port) information.

Definition at line 1740 of file bdev.py.

01740                              :
    """Get details about a given DRBD minor.

    This return, if available, the local backing device (as a path)
    and the local and remote (ip, port) information.

    """
    data = {}
    result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "show"])
    if result.failed:
      logger.Error("Can't display the drbd config: %s" % result.fail_reason)
      return data
    out = result.stdout
    if not out:
      return data

    bnf = cls._GetShowParser()
    # run pyparse

    try:
      results = bnf.parseString(out)
    except pyp.ParseException, err:
      raise errors.BlockDeviceError("Can't parse drbdsetup show output: %s" %
                                    str(err))

    # and massage the results into our desired format
    for section in results:
      sname = section[0]
      if sname == "_this_host":
        for lst in section[1:]:
          if lst[0] == "disk":
            data["local_dev"] = lst[1]
          elif lst[0] == "meta-disk":
            data["meta_dev"] = lst[1]
            data["meta_index"] = lst[2]
          elif lst[0] == "address":
            data["local_addr"] = tuple(lst[1:])
      elif sname == "_remote_host":
        for lst in section[1:]:
          if lst[0] == "address":
            data["remote_addr"] = tuple(lst[1:])
    return data

  def _MatchesLocal(self, info):


Generated by  Doxygen 1.6.0   Back to index