From 9e33896b0503fa8ae6b54fb1e23475524927d25d Mon Sep 17 00:00:00 2001
From: Luca Bigliardi <shammash@google.com>
Date: Fri, 25 Jun 2010 10:57:55 +0100
Subject: [PATCH] Add drbd_usermode_helper to configuration

Signed-off-by: Luca Bigliardi <shammash@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/config.py                  | 16 ++++++++++++++++
 lib/objects.py                 |  1 +
 test/ganeti.config_unittest.py |  1 +
 3 files changed, 18 insertions(+)

diff --git a/lib/config.py b/lib/config.py
index 98cb0fd5d..c81f201d5 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -1419,6 +1419,22 @@ class ConfigWriter:
     self._config_data.cluster.serial_no += 1
     self._WriteConfig()
 
+  @locking.ssynchronized(_config_lock, shared=1)
+  def GetDRBDHelper(self):
+    """Return DRBD usermode helper.
+
+    """
+    return self._config_data.cluster.drbd_usermode_helper
+
+  @locking.ssynchronized(_config_lock)
+  def SetDRBDHelper(self, drbd_helper):
+    """Set DRBD usermode helper.
+
+    """
+    self._config_data.cluster.drbd_usermode_helper = drbd_helper
+    self._config_data.cluster.serial_no += 1
+    self._WriteConfig()
+
   @locking.ssynchronized(_config_lock, shared=1)
   def GetMACPrefix(self):
     """Return the mac prefix.
diff --git a/lib/objects.py b/lib/objects.py
index 185bb4848..adb2756b1 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -862,6 +862,7 @@ class Cluster(TaggableObject):
     "tcpudp_port_pool",
     "mac_prefix",
     "volume_group_name",
+    "drbd_usermode_helper",
     "default_bridge",
     "default_hypervisor",
     "master_node",
diff --git a/test/ganeti.config_unittest.py b/test/ganeti.config_unittest.py
index 6f3b0654f..3cbace234 100755
--- a/test/ganeti.config_unittest.py
+++ b/test/ganeti.config_unittest.py
@@ -68,6 +68,7 @@ class TestConfigRunner(unittest.TestCase):
       highest_used_port=(constants.FIRST_DRBD_PORT - 1),
       mac_prefix="aa:00:00",
       volume_group_name="xenvg",
+      drbd_usermode_helper="/bin/true",
       nicparams={constants.PP_DEFAULT: constants.NICC_DEFAULTS},
       tcpudp_port_pool=set(),
       enabled_hypervisors=[constants.HT_FAKE],
-- 
GitLab