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

def lib::bdev::DRBDev::_AssembleNet (   cls,
  minor,
  net_info,
  protocol 
) [private]

Configure the network part of the device.

This operation can be, in theory, done multiple times, but there
have been cases (in lab testing) in which the network part of the
device had become stuck and couldn't be shut down because activity
from the new peer (also stuck) triggered a timer re-init and
needed remote peer interface shutdown in order to clear. So please
don't change online the net config.

Definition at line 1298 of file bdev.py.

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

    This operation can be, in theory, done multiple times, but there
    have been cases (in lab testing) in which the network part of the
    device had become stuck and couldn't be shut down because activity
    from the new peer (also stuck) triggered a timer re-init and
    needed remote peer interface shutdown in order to clear. So please
    don't change online the net config.

    """
    lhost, lport, rhost, rport = net_info
    result = utils.RunCmd(["drbdsetup", cls._DevPath(minor), "net",
                           "%s:%s" % (lhost, lport), "%s:%s" % (rhost, rport),
                           protocol])
    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

  @classmethod
  def _ShutdownNet(cls, minor):


Generated by  Doxygen 1.6.0   Back to index