diff --git a/lib/opcodes.py b/lib/opcodes.py index 47216ccd4417c80e68a732ea495906ec2670d74b..fd616395319fd2329b79018ba6f8bf4ba0baf3e6 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -207,10 +207,12 @@ _TSetParamsResult = \ ht.TListOf(ht.TAnd(ht.TIsLength(len(_TSetParamsResultItemItems)), ht.TItems(_TSetParamsResultItemItems))) -# TODO: Generate check from constants.IDISK_PARAMS_TYPES (however, not all users -# of this check support all parameters) +# In the disks option we can provide arbitrary parameters too, which +# we may not be able to validate at this level, so we just check the +# format of the dict here and the checks concerning IDISK_PARAMS will +# happen at the LU level _TDiskParams = \ - ht.Comment("Disk parameters")(ht.TDictOf(ht.TElemOf(constants.IDISK_PARAMS), + ht.Comment("Disk parameters")(ht.TDictOf(ht.TNonEmptyString, ht.TOr(ht.TNonEmptyString, ht.TInt))) _TQueryRow = \ diff --git a/test/ganeti.rapi.rlib2_unittest.py b/test/ganeti.rapi.rlib2_unittest.py index c26bf5d8ef6bf24164003e204c74b10edae8ec64..0f2c735e3abe3fb5916df44b6006285a5bf80e4c 100755 --- a/test/ganeti.rapi.rlib2_unittest.py +++ b/test/ganeti.rapi.rlib2_unittest.py @@ -1003,7 +1003,7 @@ class TestInstanceCreation(testutils.GanetiTestCase): # Invalid disks and nics for field in ["disks", "nics"]: invalid_values = [None, 1, "", {}, [1, 2, 3], ["hda1", "hda2"], - [{"_unknown_": 999, }]] + [{"_unknown_": False, }]] for invvalue in invalid_values: data = reqfields.copy()