From 2899d9de6d928f3c3e3f7292b739c1a2076fa408 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Mon, 29 Sep 2008 13:15:20 +0000 Subject: [PATCH] Enable the use of shared secrets 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 | 11 ++++++++--- lib/constants.py | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/bdev.py b/lib/bdev.py index 3648a2c03..8910f8006 100644 --- a/lib/bdev.py +++ b/lib/bdev.py @@ -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 diff --git a/lib/constants.py b/lib/constants.py index ba0e1d76e..f830f1437 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -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" -- GitLab