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)
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
"""
try:
- return drbd.DRBD8.GetUsermodeHelper()
+ return drbd.DRBD8Dev.GetUsermodeHelper()
except errors.BlockDeviceError, err:
_Fail(str(err))
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,
_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
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()
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
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)
- anyway, set the device parameters
"""
- super(DRBD8, self).Assemble()
+ super(DRBD8Dev, self).Assemble()
self.Attach()
if self.minor is None:
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
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"
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]
"""Get list of used DRBD minors.
"""
- return drbd.DRBD8.GetUsedDevs()
+ return drbd.DRBD8Dev.GetUsedDevs()
@classmethod
def DoMaintenance(cls, role):
# 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.
class TestDRBD8Runner(testutils.GanetiTestCase):
- """Testing case for drbd.DRBD8"""
+ """Testing case for drbd.DRBD8Dev"""
@staticmethod
def _has_disk(data, dname, mname):
class TestDRBD8Status(testutils.GanetiTestCase):
- """Testing case for DRBD8 /proc status"""
+ """Testing case for DRBD8Dev /proc status"""
def setUp(self):
"""Read in txt data"""
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):
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"""
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))
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))
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))