Revision 62e999a5
b/doc/rapi.rst | ||
---|---|---|
332 | 332 |
Instance reinstall supports body parameters. |
333 | 333 |
|
334 | 334 |
|
335 |
``/2/modify`` |
|
336 |
++++++++++++++++++++++++++++++++++++++++ |
|
337 |
|
|
338 |
Modifies cluster parameters. |
|
339 |
|
|
340 |
Supports the following commands: ``PUT``. |
|
341 |
|
|
342 |
``PUT`` |
|
343 |
~~~~~~~ |
|
344 |
|
|
345 |
Returns a job ID. |
|
346 |
|
|
347 |
Body parameters: |
|
348 |
|
|
349 |
``vg_name`` (string) |
|
350 |
Volume group name. |
|
351 |
``enabled_hypervisors`` (list) |
|
352 |
List of enabled hypervisors. |
|
353 |
``hvparams`` (dict) |
|
354 |
Cluster-wide hypervisor parameter defaults, hypervisor-dependent. |
|
355 |
``beparams`` (dict) |
|
356 |
Cluster-wide backend parameter defaults. |
|
357 |
``os_hvp`` (dict) |
|
358 |
Cluster-wide per-OS hypervisor parameter defaults. |
|
359 |
``osparams`` (dict) |
|
360 |
Dictionary with OS parameters. |
|
361 |
``candidate_pool_size`` (int) |
|
362 |
Master candidate pool size. |
|
363 |
``uid_pool`` (list) |
|
364 |
Set UID pool. Must be list of lists describing UID ranges (two items, |
|
365 |
start and end inclusive). |
|
366 |
``add_uids`` |
|
367 |
Extend UID pool. Must be list of lists describing UID ranges (two |
|
368 |
items, start and end inclusive) to be added. |
|
369 |
``remove_uids`` |
|
370 |
Shrink UID pool. Must be list of lists describing UID ranges (two |
|
371 |
items, start and end inclusive) to be removed. |
|
372 |
``maintain_node_health`` (bool) |
|
373 |
Whether to automatically maintain node health. |
|
374 |
``prealloc_wipe_disks`` (bool) |
|
375 |
Whether to wipe disks before allocating them to instances. |
|
376 |
``nicparams`` (dict) |
|
377 |
Cluster-wide NIC parameter defaults. |
|
378 |
``ndparams`` (dict) |
|
379 |
Cluster-wide node parameter defaults. |
|
380 |
``drbd_helper`` (string) |
|
381 |
DRBD helper program. |
|
382 |
``default_iallocator`` (string) |
|
383 |
Default iallocator for cluster. |
|
384 |
``master_netdev`` (string) |
|
385 |
Master network device. |
|
386 |
``reserved_lvs`` (list) |
|
387 |
List of reserved LVs (strings). |
|
388 |
``hidden_os`` (list) |
|
389 |
List of modifications as lists. Each modification must have two items, |
|
390 |
the operation and the OS name. The operation can be ``add`` or |
|
391 |
``remove``. |
|
392 |
``blacklisted_os`` (list) |
|
393 |
List of modifications as lists. Each modification must have two items, |
|
394 |
the operation and the OS name. The operation can be ``add`` or |
|
395 |
``remove``. |
|
396 |
|
|
397 |
|
|
335 | 398 |
``/2/groups`` |
336 | 399 |
+++++++++++++ |
337 | 400 |
|
b/lib/rapi/client.py | ||
---|---|---|
481 | 481 |
return self._SendRequest(HTTP_GET, "/%s/info" % GANETI_RAPI_VERSION, |
482 | 482 |
None, None) |
483 | 483 |
|
484 |
def ModifyCluster(self, **kwargs): |
|
485 |
"""Modifies cluster parameters. |
|
486 |
|
|
487 |
More details for parameters can be found in the RAPI documentation. |
|
488 |
|
|
489 |
@rtype: int |
|
490 |
@return: job id |
|
491 |
|
|
492 |
""" |
|
493 |
body = kwargs |
|
494 |
|
|
495 |
return self._SendRequest(HTTP_PUT, |
|
496 |
"/%s/modify" % GANETI_RAPI_VERSION, None, body) |
|
497 |
|
|
484 | 498 |
def GetClusterTags(self): |
485 | 499 |
"""Gets the cluster tags. |
486 | 500 |
|
b/lib/rapi/connector.py | ||
---|---|---|
231 | 231 |
"/2/os": rlib2.R_2_os, |
232 | 232 |
"/2/redistribute-config": rlib2.R_2_redist_config, |
233 | 233 |
"/2/features": rlib2.R_2_features, |
234 |
"/2/modify": rlib2.R_2_cluster_modify, |
|
234 | 235 |
} |
235 | 236 |
|
236 | 237 |
|
b/lib/rapi/rlib2.py | ||
---|---|---|
188 | 188 |
return baserlib.SubmitJob([opcodes.OpRedistributeConfig()]) |
189 | 189 |
|
190 | 190 |
|
191 |
class R_2_cluster_modify(baserlib.R_Generic): |
|
192 |
"""/2/modify resource. |
|
193 |
|
|
194 |
""" |
|
195 |
def PUT(self): |
|
196 |
"""Modifies cluster parameters. |
|
197 |
|
|
198 |
@return: a job id |
|
199 |
|
|
200 |
""" |
|
201 |
op = baserlib.FillOpcode(opcodes.OpSetClusterParams, self.request_body, |
|
202 |
None) |
|
203 |
|
|
204 |
return baserlib.SubmitJob([op]) |
|
205 |
|
|
206 |
|
|
191 | 207 |
class R_2_jobs(baserlib.R_Generic): |
192 | 208 |
"""/2/jobs resource. |
193 | 209 |
|
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
1039 | 1039 |
self.assertEqual(job_id, 12347) |
1040 | 1040 |
self.assertHandler(rlib2.R_2_groups_name_rename) |
1041 | 1041 |
|
1042 |
def testModifyCluster(self): |
|
1043 |
for mnh in [None, False, True]: |
|
1044 |
self.rapi.AddResponse("14470") |
|
1045 |
self.assertEqual(14470, |
|
1046 |
self.client.ModifyCluster(maintain_node_health=mnh)) |
|
1047 |
self.assertHandler(rlib2.R_2_cluster_modify) |
|
1048 |
self.assertItems([]) |
|
1049 |
data = serializer.LoadJson(self.rapi.GetLastRequestData()) |
|
1050 |
self.assertEqual(len(data), 1) |
|
1051 |
self.assertEqual(data["maintain_node_health"], mnh) |
|
1052 |
self.assertEqual(self.rapi.CountPending(), 0) |
|
1053 |
|
|
1042 | 1054 |
|
1043 | 1055 |
if __name__ == '__main__': |
1044 | 1056 |
client.UsesRapiClient(testutils.GanetiTestProgram)() |
Also available in: Unified diff