Revision 4c98b915
b/doc/rapi.rst | ||
---|---|---|
334 | 334 |
It supports the ``dry-run`` argument. |
335 | 335 |
|
336 | 336 |
|
337 |
``/2/instances/[instance_name]/replace-disks`` |
|
338 |
++++++++++++++++++++++++++++++++++++++++++++++ |
|
339 |
|
|
340 |
Replaces disks on an instance. |
|
341 |
|
|
342 |
It supports the following commands: ``POST``. |
|
343 |
|
|
344 |
``POST`` |
|
345 |
~~~~~~~~ |
|
346 |
|
|
347 |
Takes the parameters ``mode`` (one of ``replace_on_primary``, |
|
348 |
``replace_on_secondary``, ``replace_new_secondary`` or ``replace_auto``), |
|
349 |
``disks`` (comma separated list of disk indexes), ``remote_node`` and |
|
350 |
``iallocator``. |
|
351 |
|
|
352 |
|
|
337 | 353 |
``/2/instances/[instance_name]/tags`` |
338 | 354 |
+++++++++++++++++++++++++++++++++++++ |
339 | 355 |
|
b/lib/rapi/connector.py | ||
---|---|---|
170 | 170 |
rlib2.R_2_instances_name_reboot, |
171 | 171 |
re.compile(r'^/2/instances/([\w\._-]+)/reinstall$'): |
172 | 172 |
rlib2.R_2_instances_name_reinstall, |
173 |
re.compile(r'^/2/instances/([\w\._-]+)/replace-disks$'): |
|
174 |
rlib2.R_2_instances_name_replace_disks, |
|
173 | 175 |
re.compile(r'^/2/instances/([\w\._-]+)/shutdown$'): |
174 | 176 |
rlib2.R_2_instances_name_shutdown, |
175 | 177 |
re.compile(r'^/2/instances/([\w\._-]+)/startup$'): |
b/lib/rapi/rlib2.py | ||
---|---|---|
550 | 550 |
return baserlib.SubmitJob(ops) |
551 | 551 |
|
552 | 552 |
|
553 |
class R_2_instances_name_replace_disks(baserlib.R_Generic): |
|
554 |
"""/2/instances/[instance_name]/replace-disks resource. |
|
555 |
|
|
556 |
""" |
|
557 |
def POST(self): |
|
558 |
"""Replaces disks on an instance. |
|
559 |
|
|
560 |
""" |
|
561 |
instance_name = self.items[0] |
|
562 |
remote_node = self._checkStringVariable("remote_node", default=None) |
|
563 |
mode = self._checkStringVariable("mode", default=None) |
|
564 |
raw_disks = self._checkStringVariable("disks", default=None) |
|
565 |
iallocator = self._checkStringVariable("iallocator", default=None) |
|
566 |
|
|
567 |
if raw_disks: |
|
568 |
try: |
|
569 |
disks = [int(part) for part in raw_disks.split(",")] |
|
570 |
except ValueError, err: |
|
571 |
raise http.HttpBadRequest("Invalid disk index passed: %s" % str(err)) |
|
572 |
else: |
|
573 |
disks = [] |
|
574 |
|
|
575 |
op = opcodes.OpReplaceDisks(instance_name=instance_name, |
|
576 |
remote_node=remote_node, |
|
577 |
mode=mode, |
|
578 |
disks=disks, |
|
579 |
iallocator=iallocator) |
|
580 |
|
|
581 |
return baserlib.SubmitJob([op]) |
|
582 |
|
|
583 |
|
|
553 | 584 |
class _R_Tags(baserlib.R_Generic): |
554 | 585 |
""" Quasiclass for tagging resources |
555 | 586 |
|
Also available in: Unified diff