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

def lib::bdev::DRBD8::_AssembleNet (   cls,
  minor,
  net_info,
  protocol,
  dual_pri = False,
  hmac = None,
  secret = None 
) [private]

Configure the network part of the device.

Definition at line 1855 of file bdev.py.

                                                          :
    """Configure the network part of the device.

    """
    lhost, lport, rhost, rport = net_info
    if None in net_info:
      # we don't want network connection and actually want to make
      # sure its shutdown
      return cls._ShutdownNet(minor)

    args = ["drbdsetup", cls._DevPath(minor), "net",
            "%s:%s" % (lhost, lport), "%s:%s" % (rhost, rport), protocol,
            "-A", "discard-zero-changes",
            "-B", "consensus",
            ]
    if dual_pri:
      args.append("-m")
    if hmac and secret:
      args.extend(["-a", hmac, "-x", secret])
    result = utils.RunCmd(args)
    if result.failed:
      logger.Error("Can't setup network for dbrd device: %s" %
                   result.fail_reason)
      return False

    timeout = time.time() + 10
    ok = False
    while time.time() < timeout:
      info = cls._GetDevInfo(minor)
      if not "local_addr" in info or not "remote_addr" in info:
        time.sleep(1)
        continue
      if (info["local_addr"] != (lhost, lport) or
          info["remote_addr"] != (rhost, rport)):
        time.sleep(1)
        continue
      ok = True
      break
    if not ok:
      logger.Error("Timeout while configuring network")
      return False
    return True

  def AddChildren(self, devices):


Generated by  Doxygen 1.6.0   Back to index