Revision 3ae259d3
b/lib/backend.py | ||
---|---|---|
605 | 605 |
|
606 | 606 |
""" |
607 | 607 |
_CheckStorageParams(params, 1) |
608 |
excl_stor = bool(params[0]) |
|
608 |
excl_stor = params[0] |
|
609 |
if not isinstance(params[0], bool): |
|
610 |
raise errors.ProgrammerError("Exclusive storage parameter is not" |
|
611 |
" boolean: '%s'." % excl_stor) |
|
609 | 612 |
return _GetVgInfo(name, excl_stor) |
610 | 613 |
|
611 | 614 |
|
b/test/py/ganeti.backend_unittest.py | ||
---|---|---|
650 | 650 |
storage_type, self._STORAGE_KEY, self._SOME_ARGS) |
651 | 651 |
|
652 | 652 |
|
653 |
class TestGetLvmVgSpaceInfo(unittest.TestCase): |
|
654 |
|
|
655 |
def testValid(self): |
|
656 |
path = "somepath" |
|
657 |
excl_stor = True |
|
658 |
backend._GetVgInfo = mock.Mock() |
|
659 |
backend._GetLvmVgSpaceInfo(path, [excl_stor]) |
|
660 |
backend._GetVgInfo.assert_called_with(path, excl_stor) |
|
661 |
|
|
662 |
def testNoExclStorageNotBool(self): |
|
663 |
path = "somepath" |
|
664 |
excl_stor = "123" |
|
665 |
self.assertRaises(errors.ProgrammerError, backend._GetLvmVgSpaceInfo, |
|
666 |
path, [excl_stor]) |
|
667 |
|
|
668 |
def testNoExclStorageNotInList(self): |
|
669 |
path = "somepath" |
|
670 |
excl_stor = "123" |
|
671 |
self.assertRaises(errors.ProgrammerError, backend._GetLvmVgSpaceInfo, |
|
672 |
path, excl_stor) |
|
673 |
|
|
674 |
|
|
653 | 675 |
class TestCheckStorageParams(unittest.TestCase): |
654 | 676 |
|
655 | 677 |
def testParamsNone(self): |
Also available in: Unified diff