Rename DRBD8 to DRBD8Dev
authorThomas Thrainer <thomasth@google.com>
Thu, 25 Apr 2013 06:47:57 +0000 (08:47 +0200)
committerThomas Thrainer <thomasth@google.com>
Mon, 6 May 2013 08:30:14 +0000 (10:30 +0200)
Right now the DRBD8 class has multiple responsibilities: a) it
reprensents a device which can be set up, grown, etc. and b) it
represents the whole DRBD system on a node which has a usermode helper,
which knows how to shut down _all_ devices, etc. Therefore, the DRBD8Dev
class will only be responsible for a device, whereas the soon to be
extraced DRBD8 class is responsible for the DRBD system.

Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/backend.py
lib/block/bdev.py
lib/block/drbd.py
lib/block/drbd_info.py
lib/bootstrap.py
lib/cmdlib.py
lib/watcher/nodemaint.py
test/py/ganeti.block.drbd_unittest.py

index a4f1e71..147f35c 100644 (file)
@@ -841,7 +841,7 @@ def VerifyNode(what, cluster_name):
 
   if constants.NV_DRBDLIST in what and vm_capable:
     try:
-      used_minors = drbd.DRBD8.GetUsedDevs()
+      used_minors = drbd.DRBD8Dev.GetUsedDevs()
     except errors.BlockDeviceError, err:
       logging.warning("Can't get used minors list", exc_info=True)
       used_minors = str(err)
@@ -850,7 +850,7 @@ def VerifyNode(what, cluster_name):
   if constants.NV_DRBDHELPER in what and vm_capable:
     status = True
     try:
-      payload = drbd.DRBD8.GetUsermodeHelper()
+      payload = drbd.DRBD8Dev.GetUsermodeHelper()
     except errors.BlockDeviceError, err:
       logging.error("Can't get DRBD usermode helper: %s", str(err))
       status = False
@@ -3692,7 +3692,7 @@ def GetDrbdUsermodeHelper():
 
   """
   try:
-    return drbd.DRBD8.GetUsermodeHelper()
+    return drbd.DRBD8Dev.GetUsermodeHelper()
   except errors.BlockDeviceError, err:
     _Fail(str(err))
 
index cf3b9a8..f533918 100644 (file)
@@ -1719,7 +1719,7 @@ def _VolumeLogName(kind, es_name, volume):
 
 DEV_MAP = {
   constants.LD_LV: LogicalVolume,
-  constants.LD_DRBD8: drbd.DRBD8,
+  constants.LD_DRBD8: drbd.DRBD8Dev,
   constants.LD_BLOCKDEV: PersistentBlockDevice,
   constants.LD_RBD: RADOSBlockDevice,
   constants.LD_EXT: ExtStorageDevice,
index b69a821..3912f3d 100644 (file)
@@ -42,7 +42,7 @@ from ganeti.block import drbd_cmdgen
 _DEVICE_READ_SIZE = 128 * 1024
 
 
-class DRBD8(base.BlockDev):
+class DRBD8Dev(base.BlockDev):
   """DRBD v8.x block device.
 
   This implements the local host part of the DRBD device, i.e. it
@@ -78,7 +78,7 @@ class DRBD8(base.BlockDev):
       if not _CanReadDevice(children[1].dev_path):
         logging.info("drbd%s: Ignoring unreadable meta device", self._aminor)
         children = []
-    super(DRBD8, self).__init__(unique_id, children, size, params)
+    super(DRBD8Dev, self).__init__(unique_id, children, size, params)
     self.major = self._DRBD_MAJOR
 
     drbd_info = DRBD8Info.CreateFromFile()
@@ -471,7 +471,7 @@ class DRBD8(base.BlockDev):
       logging.info(err)
       return [err]
 
-    children_result = super(DRBD8, self).SetSyncParams(params)
+    children_result = super(DRBD8Dev, self).SetSyncParams(params)
     children_result.extend(self._SetMinorSyncParams(self.minor, params))
     return children_result
 
@@ -486,7 +486,7 @@ class DRBD8(base.BlockDev):
       logging.info("Not attached during PauseSync")
       return False
 
-    children_result = super(DRBD8, self).PauseResumeSync(pause)
+    children_result = super(DRBD8Dev, self).PauseResumeSync(pause)
 
     if pause:
       cmd = self._cmd_gen.GenPauseSyncCmd(self.minor)
@@ -704,7 +704,7 @@ class DRBD8(base.BlockDev):
       - anyway, set the device parameters
 
     """
-    super(DRBD8, self).Assemble()
+    super(DRBD8Dev, self).Assemble()
 
     self.Attach()
     if self.minor is None:
index ef6eda2..9ebc7bd 100644 (file)
@@ -326,7 +326,7 @@ class BaseShowInfo(object):
     This returns, if available, the local backing device (as a path)
     and the local and remote (ip, port) information from a string
     containing the output of the `drbdsetup show` command as returned
-    by DRBD8._GetShowData.
+    by DRBD8Dev._GetShowData.
 
     This will return a dict with keys:
       - local_dev
index d648c77..fba3315 100644 (file)
@@ -470,7 +470,7 @@ def InitCluster(cluster_name, mac_prefix, # pylint: disable=R0913, R0914
 
   if drbd_helper is not None:
     try:
-      curr_helper = drbd.DRBD8.GetUsermodeHelper()
+      curr_helper = drbd.DRBD8Dev.GetUsermodeHelper()
     except errors.BlockDeviceError, err:
       raise errors.OpPrereqError("Error while checking drbd helper"
                                  " (specify --no-drbd-storage if you are not"
index 82f7b2e..5ebe2d0 100644 (file)
@@ -11611,7 +11611,7 @@ class LUInstanceReplaceDisks(LogicalUnit):
       self.op.remote_node = _ExpandNodeName(self.cfg, self.op.remote_node)
 
       # Warning: do not remove the locking of the new secondary here
-      # unless DRBD8.AddChildren is changed to work in parallel;
+      # unless DRBD8Dev.AddChildren is changed to work in parallel;
       # currently it doesn't since parallel invocations of
       # FindUnusedMinor will conflict
       self.needed_locks[locking.LEVEL_NODE] = [self.op.remote_node]
index da8f095..ed4157e 100644 (file)
@@ -80,7 +80,7 @@ class NodeMaintenance(object):
     """Get list of used DRBD minors.
 
     """
-    return drbd.DRBD8.GetUsedDevs()
+    return drbd.DRBD8Dev.GetUsedDevs()
 
   @classmethod
   def DoMaintenance(cls, role):
@@ -124,7 +124,7 @@ class NodeMaintenance(object):
         # pylint: disable=W0212
         # using the private method as is, pending enhancements to the DRBD
         # interface
-        drbd.DRBD8._ShutdownAll(minor)
+        drbd.DRBD8Dev._ShutdownAll(minor)
 
   def Exec(self):
     """Check node status versus cluster desired state.
index 757a286..ace363f 100755 (executable)
@@ -82,7 +82,7 @@ class TestDRBD8(testutils.GanetiTestCase):
 
 
 class TestDRBD8Runner(testutils.GanetiTestCase):
-  """Testing case for drbd.DRBD8"""
+  """Testing case for drbd.DRBD8Dev"""
 
   @staticmethod
   def _has_disk(data, dname, mname):
@@ -257,7 +257,7 @@ class TestDRBD8Runner(testutils.GanetiTestCase):
 
 
 class TestDRBD8Status(testutils.GanetiTestCase):
-  """Testing case for DRBD8 /proc status"""
+  """Testing case for DRBD8Dev /proc status"""
 
   def setUp(self):
     """Read in txt data"""
@@ -295,7 +295,7 @@ class TestDRBD8Status(testutils.GanetiTestCase):
   def testHelper(self):
     """Test reading usermode_helper in /sys."""
     sys_drbd_helper = testutils.TestDataFilename("sys_drbd_usermode_helper.txt")
-    drbd_helper = drbd.DRBD8.GetUsermodeHelper(filename=sys_drbd_helper)
+    drbd_helper = drbd.DRBD8Dev.GetUsermodeHelper(filename=sys_drbd_helper)
     self.failUnlessEqual(drbd_helper, "/bin/true")
 
   def testHelperIOErrors(self):
@@ -303,7 +303,7 @@ class TestDRBD8Status(testutils.GanetiTestCase):
     temp_file = self._CreateTempFile()
     os.unlink(temp_file)
     self.failUnlessRaises(errors.BlockDeviceError,
-                          drbd.DRBD8.GetUsermodeHelper, filename=temp_file)
+                          drbd.DRBD8Dev.GetUsermodeHelper, filename=temp_file)
 
   def testMinorNotFound(self):
     """Test not-found-minor in /proc"""
@@ -405,7 +405,7 @@ class TestDRBD8Construction(testutils.GanetiTestCase):
   def testConstructionWith80Data(self, mock_create_from_file):
     mock_create_from_file.return_value = self.proc80_info
 
-    inst = drbd.DRBD8(self.test_unique_id, [], 123, {})
+    inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
     self.assertEqual(inst._show_info_cls, drbd_info.DRBD83ShowInfo)
     self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD83CmdGenerator))
 
@@ -413,7 +413,7 @@ class TestDRBD8Construction(testutils.GanetiTestCase):
   def testConstructionWith83Data(self, mock_create_from_file):
     mock_create_from_file.return_value = self.proc83_info
 
-    inst = drbd.DRBD8(self.test_unique_id, [], 123, {})
+    inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
     self.assertEqual(inst._show_info_cls, drbd_info.DRBD83ShowInfo)
     self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD83CmdGenerator))
 
@@ -421,7 +421,7 @@ class TestDRBD8Construction(testutils.GanetiTestCase):
   def testConstructionWith84Data(self, mock_create_from_file):
     mock_create_from_file.return_value = self.proc84_info
 
-    inst = drbd.DRBD8(self.test_unique_id, [], 123, {})
+    inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
     self.assertEqual(inst._show_info_cls, drbd_info.DRBD84ShowInfo)
     self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD84CmdGenerator))