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

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

Get details about a given DRBD minor.

This return, if available, the local backing device in (major,
minor) formant and the local and remote (ip, port) information.

Definition at line 1154 of file bdev.py.

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

    This return, if available, the local backing device in (major,
    minor) formant 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 out == "Not configured\n":
      return data
    for line in out.splitlines():
      if "local_dev" not in data:
        match = re.match("^Lower device: ([0-9]+):([0-9]+) .*$", line)
        if match:
          data["local_dev"] = (int(match.group(1)), int(match.group(2)))
          continue
      if "meta_dev" not in data:
        match = re.match("^Meta device: (([0-9]+):([0-9]+)|internal).*$", line)
        if match:
          if match.group(2) is not None and match.group(3) is not None:
            # matched on the major/minor
            data["meta_dev"] = (int(match.group(2)), int(match.group(3)))
          else:
            # matched on the "internal" string
            data["meta_dev"] = match.group(1)
            # in this case, no meta_index is in the output
            data["meta_index"] = -1
          continue
      if "meta_index" not in data:
        match = re.match("^Meta index: ([0-9]+).*$", line)
        if match:
          data["meta_index"] = int(match.group(1))
          continue
      if "local_addr" not in data:
        match = re.match("^Local address: ([0-9.]+):([0-9]+)$", line)
        if match:
          data["local_addr"] = (match.group(1), int(match.group(2)))
          continue
      if "remote_addr" not in data:
        match = re.match("^Remote address: ([0-9.]+):([0-9]+)$", line)
        if match:
          data["remote_addr"] = (match.group(1), int(match.group(2)))
          continue
    return data

  def _MatchesLocal(self, info):


Generated by  Doxygen 1.6.0   Back to index