Support force option for deactivate disks on RAPI
authorKlaus Aehlig <aehlig@google.com>
Tue, 27 Oct 2015 14:32:26 +0000 (15:32 +0100)
committerKlaus Aehlig <aehlig@google.com>
Tue, 27 Oct 2015 15:48:25 +0000 (16:48 +0100)
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>

lib/rapi/client.py
lib/rapi/rlib2.py

index 65f82ab..b6ef576 100644 (file)
@@ -964,7 +964,7 @@ class GanetiRapiClient(object): # pylint: disable=R0904
                              ("/%s/instances/%s/activate-disks" %
                               (GANETI_RAPI_VERSION, instance)), query, None)
 
-  def DeactivateInstanceDisks(self, instance, reason=None):
+  def DeactivateInstanceDisks(self, instance, reason=None, force=False):
     """Deactivates an instance's disks.
 
     @type instance: string
@@ -976,6 +976,7 @@ class GanetiRapiClient(object): # pylint: disable=R0904
 
     """
     query = []
+    _AppendForceIf(query, force)
     _AppendReason(query, reason)
     return self._SendRequest(HTTP_PUT,
                              ("/%s/instances/%s/deactivate-disks" %
index 8fee8fb..34b4124 100644 (file)
@@ -1395,6 +1395,7 @@ class R_2_instances_name_deactivate_disks(baserlib.OpcodeResource):
     """
     return ({}, {
       "instance_name": self.items[0],
+      "force": self.useForce(),
       })