diff --git a/lib/rapi/client.py b/lib/rapi/client.py index 090ec54d288ecf5213fdc4e3ebf852027a884845..72e3a51b8a7e017184c0b7a58cc9d3cd813e5096 100644 --- a/lib/rapi/client.py +++ b/lib/rapi/client.py @@ -54,7 +54,6 @@ VALID_REPLACEMENT_MODES = frozenset([ VALID_NODE_ROLES = frozenset([ "drained", "master", "master-candidate", "offline", "regular", ]) -VALID_STORAGE_TYPES = frozenset(["file", "lvm-pv", "lvm-vg"]) class Error(Exception): @@ -87,13 +86,6 @@ class InvalidReplacementMode(Error): pass -class InvalidStorageType(Error): - """Raised when an invalid storage type is used. - - """ - pass - - class InvalidNodeRole(Error): """Raised when an invalid node role is used. @@ -421,14 +413,6 @@ class GanetiRapiClient(object): return response_content - @staticmethod - def _CheckStorageType(storage_type): - """Checks a storage type for validity. - - """ - if storage_type not in VALID_STORAGE_TYPES: - raise InvalidStorageType("%s is an invalid storage type" % storage_type) - def GetVersion(self): """Gets the Remote API version running on the cluster. @@ -965,12 +949,7 @@ class GanetiRapiClient(object): @rtype: int @return: job id where results can be retrieved - @raise InvalidStorageType: If an invalid storage type is specified - """ - # TODO: Add default for storage_type & output_fields - self._CheckStorageType(storage_type) - query = [ ("storage_type", storage_type), ("output_fields", output_fields), @@ -995,11 +974,7 @@ class GanetiRapiClient(object): @rtype: int @return: job id - @raise InvalidStorageType: If an invalid storage type is specified - """ - self._CheckStorageType(storage_type) - query = [ ("storage_type", storage_type), ("name", name), @@ -1023,11 +998,7 @@ class GanetiRapiClient(object): @rtype: int @return: job id - @raise InvalidStorageType: If an invalid storage type is specified - """ - self._CheckStorageType(storage_type) - query = [ ("storage_type", storage_type), ("name", name), diff --git a/test/ganeti.rapi.client_unittest.py b/test/ganeti.rapi.client_unittest.py index 6089352ada296f450e004d5c09fec9f200c3f678..8bf9f463b6003d847db8db529474c5ecfcb55702 100755 --- a/test/ganeti.rapi.client_unittest.py +++ b/test/ganeti.rapi.client_unittest.py @@ -418,10 +418,6 @@ class GanetiRapiClientTests(testutils.GanetiTestCase): self.assertQuery("storage_type", ["lvm-pv"]) self.assertQuery("output_fields", ["fields"]) - self.assertRaises(client.InvalidStorageType, - self.client.GetNodeStorageUnits, - "node-y", "floppy-disk", "fields") - def testModifyNodeStorageUnits(self): self.rapi.AddResponse("14") self.assertEqual(14, @@ -431,10 +427,6 @@ class GanetiRapiClientTests(testutils.GanetiTestCase): self.assertQuery("storage_type", ["lvm-pv"]) self.assertQuery("name", ["hda"]) - self.assertRaises(client.InvalidStorageType, - self.client.ModifyNodeStorageUnits, - "node-n", "floppy-disk", "hdc") - def testRepairNodeStorageUnits(self): self.rapi.AddResponse("99") self.assertEqual(99, self.client.RepairNodeStorageUnits("node-z", "lvm-pv", @@ -444,10 +436,6 @@ class GanetiRapiClientTests(testutils.GanetiTestCase): self.assertQuery("storage_type", ["lvm-pv"]) self.assertQuery("name", ["hda"]) - self.assertRaises(client.InvalidStorageType, - self.client.RepairNodeStorageUnits, - "node-n", "floppy-disk", "hdc") - def testGetNodeTags(self): self.rapi.AddResponse("[\"fry\", \"bender\"]") self.assertEqual(["fry", "bender"], self.client.GetNodeTags("node-k"))