Enable the use of shared secrets
authorIustin Pop <iustin@google.com>
Mon, 29 Sep 2008 13:15:20 +0000 (13:15 +0000)
committerIustin Pop <iustin@google.com>
Mon, 29 Sep 2008 13:15:20 +0000 (13:15 +0000)
This patch enables the use of the shared secrets for DRBD8 disks, using
(hardcoded in constants.py) the md5 digest algorithm.

For making this more flexible, either we implement a cluster parameter
(once the new model is in place), or we can make it ./configure-time
selectable.

Reviewed-by: imsnah

lib/bdev.py
lib/constants.py

index 3648a2c..8910f80 100644 (file)
@@ -1253,7 +1253,9 @@ class DRBD8(BaseDRBD):
         res_r = self._AssembleNet(minor,
                                   (self._lhost, self._lport,
                                    self._rhost, self._rport),
-                                  "C")
+                                  "C", hmac=constants.DRBD_HMAC_ALG,
+                                  secret=self._secret
+                                  )
         if res_r:
           if self._MatchesNet(self._GetDevInfo(self._GetShowData(minor))):
             break
@@ -1281,7 +1283,9 @@ class DRBD8(BaseDRBD):
         # local storage (i.e. one or more of the _[lr](host|port) is
         # None)
         if (self._AssembleNet(minor, (self._lhost, self._lport,
-                                      self._rhost, self._rport), "C") and
+                                      self._rhost, self._rport), "C",
+                              hmac=constants.DRBD_HMAC_ALG,
+                              secret=self._secret) and
             self._MatchesNet(self._GetDevInfo(self._GetShowData(minor)))):
           break
 
@@ -1333,7 +1337,8 @@ class DRBD8(BaseDRBD):
       result = self._AssembleNet(minor,
                                  (self._lhost, self._lport,
                                   self._rhost, self._rport),
-                                 "C")
+                                 "C", hmac=constants.DRBD_HMAC_ALG,
+                                 secret=self._secret)
       if not result:
         if need_localdev_teardown:
           # we will ignore failures from this
index ba0e1d7..f830f14 100644 (file)
@@ -176,6 +176,9 @@ LD_LV = "lvm"
 LD_DRBD8 = "drbd8"
 LD_FILE = "file"
 
+# drbd constants
+DRBD_HMAC_ALG = "md5"
+
 # file backend driver
 FD_LOOP = "loop"
 FD_BLKTAP = "blktap"