Revision fde28316
b/lib/rapi/client.py | ||
---|---|---|
987 | 987 |
("/%s/nodes/%s/storage" % |
988 | 988 |
(GANETI_RAPI_VERSION, node)), query, None) |
989 | 989 |
|
990 |
def ModifyNodeStorageUnits(self, node, storage_type, name, allocatable=True):
|
|
990 |
def ModifyNodeStorageUnits(self, node, storage_type, name, allocatable=None):
|
|
991 | 991 |
"""Modifies parameters of storage units on the node. |
992 | 992 |
|
993 | 993 |
@type node: str |
... | ... | |
996 | 996 |
@param storage_type: storage type whose units to modify |
997 | 997 |
@type name: str |
998 | 998 |
@param name: name of the storage unit |
999 |
@type allocatable: bool |
|
1000 |
@param allocatable: TODO: Document me |
|
999 |
@type allocatable: bool or None |
|
1000 |
@param allocatable: Whether to set the "allocatable" flag on the storage |
|
1001 |
unit (None=no modification, True=set, False=unset) |
|
1001 | 1002 |
|
1002 | 1003 |
@rtype: int |
1003 | 1004 |
@return: job id |
... | ... | |
1006 | 1007 |
query = [ |
1007 | 1008 |
("storage_type", storage_type), |
1008 | 1009 |
("name", name), |
1009 |
("allocatable", allocatable), |
|
1010 | 1010 |
] |
1011 | 1011 |
|
1012 |
if allocatable is not None: |
|
1013 |
query.append(("allocatable", allocatable)) |
|
1014 |
|
|
1012 | 1015 |
return self._SendRequest(HTTP_PUT, |
1013 | 1016 |
("/%s/nodes/%s/storage/modify" % |
1014 | 1017 |
(GANETI_RAPI_VERSION, node)), query, None) |
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
450 | 450 |
self.assertItems(["node-z"]) |
451 | 451 |
self.assertQuery("storage_type", ["lvm-pv"]) |
452 | 452 |
self.assertQuery("name", ["hda"]) |
453 |
self.assertQuery("allocatable", None) |
|
454 |
|
|
455 |
for allocatable, query_allocatable in [(True, "1"), (False, "0")]: |
|
456 |
self.rapi.AddResponse("7205") |
|
457 |
job_id = self.client.ModifyNodeStorageUnits("node-z", "lvm-pv", "hda", |
|
458 |
allocatable=allocatable) |
|
459 |
self.assertEqual(7205, job_id) |
|
460 |
self.assertHandler(rlib2.R_2_nodes_name_storage_modify) |
|
461 |
self.assertItems(["node-z"]) |
|
462 |
self.assertQuery("storage_type", ["lvm-pv"]) |
|
463 |
self.assertQuery("name", ["hda"]) |
|
464 |
self.assertQuery("allocatable", [query_allocatable]) |
|
453 | 465 |
|
454 | 466 |
def testRepairNodeStorageUnits(self): |
455 | 467 |
self.rapi.AddResponse("99") |
Also available in: Unified diff