Revision 65fc2388 lib/storage/drbd.py

b/lib/storage/drbd.py
377 377
        base.ThrowError("drbd%d: can't attach local disk: %s",
378 378
                        minor, result.output)
379 379

  
380
  def _AssembleNet(self, minor, net_info, protocol,
381
                   dual_pri=False, hmac=None, secret=None):
380
  def _AssembleNet(self, minor, net_info, dual_pri=False, hmac=None,
381
                   secret=None):
382 382
    """Configure the network part of the device.
383 383

  
384 384
    @type minor: int
......
386 386
    @type net_info: (string, int, string, int)
387 387
    @param net_info: tuple containing the local address, local port, remote
388 388
      address and remote port
389
    @type protocol: string
390
    @param protocol: either "ipv4" or "ipv6"
391 389
    @type dual_pri: boolean
392 390
    @param dual_pri: whether two primaries should be allowed or not
393 391
    @type hmac: string
......
403 401
      self._ShutdownNet(minor)
404 402
      return
405 403

  
404
    if dual_pri:
405
      protocol = constants.DRBD_MIGRATION_NET_PROTOCOL
406
    else:
407
      protocol = self.params[constants.LDP_PROTOCOL]
408

  
406 409
    # Workaround for a race condition. When DRBD is doing its dance to
407 410
    # establish a connection with its peer, it also sends the
408 411
    # synchronization speed over the wire. In some cases setting the
......
747 750

  
748 751
    self._AssembleNet(self.minor,
749 752
                      (self._lhost, self._lport, self._rhost, self._rport),
750
                      constants.DRBD_NET_PROTOCOL, dual_pri=multimaster,
751
                      hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
753
                      dual_pri=multimaster, hmac=constants.DRBD_HMAC_ALG,
754
                      secret=self._secret)
752 755

  
753 756
  def Attach(self):
754 757
    """Check if our minor is configured.
......
818 821

  
819 822
      if match_l and not match_r and "local_addr" not in info:
820 823
        # disk matches, but not attached to network, attach and recheck
821
        self._AssembleNet(minor, net_data, constants.DRBD_NET_PROTOCOL,
822
                          hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
824
        self._AssembleNet(minor, net_data, hmac=constants.DRBD_HMAC_ALG,
825
                          secret=self._secret)
823 826
        if self._MatchesNet(self._GetShowInfo(minor)):
824 827
          break
825 828
        else:
......
855 858
        # note: _AssembleNet also handles the case when we don't want
856 859
        # local storage (i.e. one or more of the _[lr](host|port) is
857 860
        # None)
858
        self._AssembleNet(minor, net_data, constants.DRBD_NET_PROTOCOL,
859
                          hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
861
        self._AssembleNet(minor, net_data, hmac=constants.DRBD_HMAC_ALG,
862
                          secret=self._secret)
860 863
        if self._MatchesNet(self._GetShowInfo(minor)):
861 864
          break
862 865
        else:
......
884 887
    if self._lhost and self._lport and self._rhost and self._rport:
885 888
      self._AssembleNet(minor,
886 889
                        (self._lhost, self._lport, self._rhost, self._rport),
887
                        constants.DRBD_NET_PROTOCOL,
888 890
                        hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
889 891
    self._SetFromMinor(minor)
890 892

  

Also available in: Unified diff