Revision fcee9675
b/lib/rapi/client.py | ||
---|---|---|
820 | 820 |
("/%s/instances/%s/startup" % |
821 | 821 |
(GANETI_RAPI_VERSION, instance)), query, None) |
822 | 822 |
|
823 |
def ReinstallInstance(self, instance, os, no_startup=False): |
|
823 |
def ReinstallInstance(self, instance, os=None, no_startup=False):
|
|
824 | 824 |
"""Reinstalls an instance. |
825 | 825 |
|
826 | 826 |
@type instance: str |
827 |
@param instance: the instance to reinstall |
|
828 |
@type os: str |
|
829 |
@param os: the os to reinstall |
|
827 |
@param instance: The instance to reinstall |
|
828 |
@type os: str or None |
|
829 |
@param os: The operating system to reinstall. If None, the instance's |
|
830 |
current operating system will be installed again |
|
830 | 831 |
@type no_startup: bool |
831 |
@param no_startup: whether to start the instance automatically
|
|
832 |
@param no_startup: Whether to start the instance automatically
|
|
832 | 833 |
|
833 | 834 |
""" |
834 |
query = [("os", os)] |
|
835 |
query = [] |
|
836 |
if os: |
|
837 |
query.append(("os", os)) |
|
835 | 838 |
if no_startup: |
836 | 839 |
query.append(("nostartup", 1)) |
837 | 840 |
return self._SendRequest(HTTP_POST, |
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
644 | 644 |
|
645 | 645 |
def testReinstallInstance(self): |
646 | 646 |
self.rapi.AddResponse("19119") |
647 |
self.assertEqual(19119, self.client.ReinstallInstance("baz-instance", "DOS", |
|
647 |
self.assertEqual(19119, self.client.ReinstallInstance("baz-instance", |
|
648 |
os="DOS", |
|
648 | 649 |
no_startup=True)) |
649 | 650 |
self.assertHandler(rlib2.R_2_instances_name_reinstall) |
650 | 651 |
self.assertItems(["baz-instance"]) |
Also available in: Unified diff