Signed-off-by: Luca Bigliardi <[email protected]>
---
 lib/config.py    |   11 +++++++++++
 lib/constants.py |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/lib/config.py b/lib/config.py
index c81f201..f34eac0 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -1249,6 +1249,17 @@ class ConfigWriter:
       if item.uuid is None:
         item.uuid = self._GenerateUniqueID(_UPGRADE_CONFIG_JID)
         modified = True
+    cluster_conf = self._config_data.cluster
+    if cluster_conf.drbd_usermode_helper is None:
+      # To decide if we set an helper let's check if at least one instance is
+      # has a DRBD disk. This doesn't cover all the possible scenarios but it
+      # gives a good approximation.
+      for instance in self._config_data.instances.values():
+        for disk in instance.disks:
+          if disk.RecursiveCheckIfLogicalDiskBased(constants.LD_DRBD8):
+            cluster_conf.drbd_usermode_helper = constants.DEFAULT_DRBD_HELPER
+            break
+      modified = True
     if modified:
       self._WriteConfig()
       # This is ok even if it acquires the internal lock, as _UpgradeConfig is
diff --git a/lib/constants.py b/lib/constants.py
index 58354aa..37e8869 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -441,6 +441,7 @@ IP6_ADDRESS_ANY = "::"
 TCP_PING_TIMEOUT = 10
 GANETI_RUNAS = "root"
 DEFAULT_VG = "xenvg"
+DEFAULT_DRBD_HELPER = "/bin/true"
 MIN_VG_SIZE = 20480
 DEFAULT_MAC_PREFIX = "aa:00:00"
 LVM_STRIPECOUNT = _autoconf.LVM_STRIPECOUNT
-- 
1.7.1

Reply via email to