Revision 239364d0
b/lib/backend.py | ||
---|---|---|
841 | 841 |
|
842 | 842 |
if constants.NV_DRBDLIST in what and vm_capable: |
843 | 843 |
try: |
844 |
used_minors = drbd.DRBD8.GetUsedDevs() |
|
844 |
used_minors = drbd.DRBD8Dev.GetUsedDevs()
|
|
845 | 845 |
except errors.BlockDeviceError, err: |
846 | 846 |
logging.warning("Can't get used minors list", exc_info=True) |
847 | 847 |
used_minors = str(err) |
... | ... | |
850 | 850 |
if constants.NV_DRBDHELPER in what and vm_capable: |
851 | 851 |
status = True |
852 | 852 |
try: |
853 |
payload = drbd.DRBD8.GetUsermodeHelper() |
|
853 |
payload = drbd.DRBD8Dev.GetUsermodeHelper()
|
|
854 | 854 |
except errors.BlockDeviceError, err: |
855 | 855 |
logging.error("Can't get DRBD usermode helper: %s", str(err)) |
856 | 856 |
status = False |
... | ... | |
3692 | 3692 |
|
3693 | 3693 |
""" |
3694 | 3694 |
try: |
3695 |
return drbd.DRBD8.GetUsermodeHelper() |
|
3695 |
return drbd.DRBD8Dev.GetUsermodeHelper()
|
|
3696 | 3696 |
except errors.BlockDeviceError, err: |
3697 | 3697 |
_Fail(str(err)) |
3698 | 3698 |
|
b/lib/block/bdev.py | ||
---|---|---|
1719 | 1719 |
|
1720 | 1720 |
DEV_MAP = { |
1721 | 1721 |
constants.LD_LV: LogicalVolume, |
1722 |
constants.LD_DRBD8: drbd.DRBD8, |
|
1722 |
constants.LD_DRBD8: drbd.DRBD8Dev,
|
|
1723 | 1723 |
constants.LD_BLOCKDEV: PersistentBlockDevice, |
1724 | 1724 |
constants.LD_RBD: RADOSBlockDevice, |
1725 | 1725 |
constants.LD_EXT: ExtStorageDevice, |
b/lib/block/drbd.py | ||
---|---|---|
42 | 42 |
_DEVICE_READ_SIZE = 128 * 1024 |
43 | 43 |
|
44 | 44 |
|
45 |
class DRBD8(base.BlockDev): |
|
45 |
class DRBD8Dev(base.BlockDev):
|
|
46 | 46 |
"""DRBD v8.x block device. |
47 | 47 |
|
48 | 48 |
This implements the local host part of the DRBD device, i.e. it |
... | ... | |
78 | 78 |
if not _CanReadDevice(children[1].dev_path): |
79 | 79 |
logging.info("drbd%s: Ignoring unreadable meta device", self._aminor) |
80 | 80 |
children = [] |
81 |
super(DRBD8, self).__init__(unique_id, children, size, params) |
|
81 |
super(DRBD8Dev, self).__init__(unique_id, children, size, params)
|
|
82 | 82 |
self.major = self._DRBD_MAJOR |
83 | 83 |
|
84 | 84 |
drbd_info = DRBD8Info.CreateFromFile() |
... | ... | |
471 | 471 |
logging.info(err) |
472 | 472 |
return [err] |
473 | 473 |
|
474 |
children_result = super(DRBD8, self).SetSyncParams(params) |
|
474 |
children_result = super(DRBD8Dev, self).SetSyncParams(params)
|
|
475 | 475 |
children_result.extend(self._SetMinorSyncParams(self.minor, params)) |
476 | 476 |
return children_result |
477 | 477 |
|
... | ... | |
486 | 486 |
logging.info("Not attached during PauseSync") |
487 | 487 |
return False |
488 | 488 |
|
489 |
children_result = super(DRBD8, self).PauseResumeSync(pause) |
|
489 |
children_result = super(DRBD8Dev, self).PauseResumeSync(pause)
|
|
490 | 490 |
|
491 | 491 |
if pause: |
492 | 492 |
cmd = self._cmd_gen.GenPauseSyncCmd(self.minor) |
... | ... | |
704 | 704 |
- anyway, set the device parameters |
705 | 705 |
|
706 | 706 |
""" |
707 |
super(DRBD8, self).Assemble() |
|
707 |
super(DRBD8Dev, self).Assemble()
|
|
708 | 708 |
|
709 | 709 |
self.Attach() |
710 | 710 |
if self.minor is None: |
b/lib/block/drbd_info.py | ||
---|---|---|
326 | 326 |
This returns, if available, the local backing device (as a path) |
327 | 327 |
and the local and remote (ip, port) information from a string |
328 | 328 |
containing the output of the `drbdsetup show` command as returned |
329 |
by DRBD8._GetShowData. |
|
329 |
by DRBD8Dev._GetShowData.
|
|
330 | 330 |
|
331 | 331 |
This will return a dict with keys: |
332 | 332 |
- local_dev |
b/lib/bootstrap.py | ||
---|---|---|
470 | 470 |
|
471 | 471 |
if drbd_helper is not None: |
472 | 472 |
try: |
473 |
curr_helper = drbd.DRBD8.GetUsermodeHelper() |
|
473 |
curr_helper = drbd.DRBD8Dev.GetUsermodeHelper()
|
|
474 | 474 |
except errors.BlockDeviceError, err: |
475 | 475 |
raise errors.OpPrereqError("Error while checking drbd helper" |
476 | 476 |
" (specify --no-drbd-storage if you are not" |
b/lib/cmdlib.py | ||
---|---|---|
11611 | 11611 |
self.op.remote_node = _ExpandNodeName(self.cfg, self.op.remote_node) |
11612 | 11612 |
|
11613 | 11613 |
# Warning: do not remove the locking of the new secondary here |
11614 |
# unless DRBD8.AddChildren is changed to work in parallel; |
|
11614 |
# unless DRBD8Dev.AddChildren is changed to work in parallel;
|
|
11615 | 11615 |
# currently it doesn't since parallel invocations of |
11616 | 11616 |
# FindUnusedMinor will conflict |
11617 | 11617 |
self.needed_locks[locking.LEVEL_NODE] = [self.op.remote_node] |
b/lib/watcher/nodemaint.py | ||
---|---|---|
80 | 80 |
"""Get list of used DRBD minors. |
81 | 81 |
|
82 | 82 |
""" |
83 |
return drbd.DRBD8.GetUsedDevs() |
|
83 |
return drbd.DRBD8Dev.GetUsedDevs()
|
|
84 | 84 |
|
85 | 85 |
@classmethod |
86 | 86 |
def DoMaintenance(cls, role): |
... | ... | |
124 | 124 |
# pylint: disable=W0212 |
125 | 125 |
# using the private method as is, pending enhancements to the DRBD |
126 | 126 |
# interface |
127 |
drbd.DRBD8._ShutdownAll(minor) |
|
127 |
drbd.DRBD8Dev._ShutdownAll(minor)
|
|
128 | 128 |
|
129 | 129 |
def Exec(self): |
130 | 130 |
"""Check node status versus cluster desired state. |
b/test/py/ganeti.block.drbd_unittest.py | ||
---|---|---|
82 | 82 |
|
83 | 83 |
|
84 | 84 |
class TestDRBD8Runner(testutils.GanetiTestCase): |
85 |
"""Testing case for drbd.DRBD8""" |
|
85 |
"""Testing case for drbd.DRBD8Dev"""
|
|
86 | 86 |
|
87 | 87 |
@staticmethod |
88 | 88 |
def _has_disk(data, dname, mname): |
... | ... | |
257 | 257 |
|
258 | 258 |
|
259 | 259 |
class TestDRBD8Status(testutils.GanetiTestCase): |
260 |
"""Testing case for DRBD8 /proc status""" |
|
260 |
"""Testing case for DRBD8Dev /proc status"""
|
|
261 | 261 |
|
262 | 262 |
def setUp(self): |
263 | 263 |
"""Read in txt data""" |
... | ... | |
295 | 295 |
def testHelper(self): |
296 | 296 |
"""Test reading usermode_helper in /sys.""" |
297 | 297 |
sys_drbd_helper = testutils.TestDataFilename("sys_drbd_usermode_helper.txt") |
298 |
drbd_helper = drbd.DRBD8.GetUsermodeHelper(filename=sys_drbd_helper) |
|
298 |
drbd_helper = drbd.DRBD8Dev.GetUsermodeHelper(filename=sys_drbd_helper)
|
|
299 | 299 |
self.failUnlessEqual(drbd_helper, "/bin/true") |
300 | 300 |
|
301 | 301 |
def testHelperIOErrors(self): |
... | ... | |
303 | 303 |
temp_file = self._CreateTempFile() |
304 | 304 |
os.unlink(temp_file) |
305 | 305 |
self.failUnlessRaises(errors.BlockDeviceError, |
306 |
drbd.DRBD8.GetUsermodeHelper, filename=temp_file) |
|
306 |
drbd.DRBD8Dev.GetUsermodeHelper, filename=temp_file)
|
|
307 | 307 |
|
308 | 308 |
def testMinorNotFound(self): |
309 | 309 |
"""Test not-found-minor in /proc""" |
... | ... | |
405 | 405 |
def testConstructionWith80Data(self, mock_create_from_file): |
406 | 406 |
mock_create_from_file.return_value = self.proc80_info |
407 | 407 |
|
408 |
inst = drbd.DRBD8(self.test_unique_id, [], 123, {}) |
|
408 |
inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
|
|
409 | 409 |
self.assertEqual(inst._show_info_cls, drbd_info.DRBD83ShowInfo) |
410 | 410 |
self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD83CmdGenerator)) |
411 | 411 |
|
... | ... | |
413 | 413 |
def testConstructionWith83Data(self, mock_create_from_file): |
414 | 414 |
mock_create_from_file.return_value = self.proc83_info |
415 | 415 |
|
416 |
inst = drbd.DRBD8(self.test_unique_id, [], 123, {}) |
|
416 |
inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
|
|
417 | 417 |
self.assertEqual(inst._show_info_cls, drbd_info.DRBD83ShowInfo) |
418 | 418 |
self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD83CmdGenerator)) |
419 | 419 |
|
... | ... | |
421 | 421 |
def testConstructionWith84Data(self, mock_create_from_file): |
422 | 422 |
mock_create_from_file.return_value = self.proc84_info |
423 | 423 |
|
424 |
inst = drbd.DRBD8(self.test_unique_id, [], 123, {}) |
|
424 |
inst = drbd.DRBD8Dev(self.test_unique_id, [], 123, {})
|
|
425 | 425 |
self.assertEqual(inst._show_info_cls, drbd_info.DRBD84ShowInfo) |
426 | 426 |
self.assertTrue(isinstance(inst._cmd_gen, drbd_cmdgen.DRBD84CmdGenerator)) |
427 | 427 |
|
Also available in: Unified diff