rapi: Add /2/nodes/[node_name]/storage/repair resource
authorMichael Hanselmann <hansmi@google.com>
Mon, 17 Aug 2009 11:55:04 +0000 (13:55 +0200)
committerMichael Hanselmann <hansmi@google.com>
Mon, 17 Aug 2009 12:00:27 +0000 (14:00 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

doc/rapi.rst
lib/rapi/connector.py
lib/rapi/rlib2.py

index 1a9294d..92c923a 100644 (file)
@@ -570,6 +570,18 @@ Modifies parameters of storage units on the node. Requires the parameters
 of the storage unit).  Parameters can be passed additionally. Currently only
 ``allocatable`` (bool) is supported. The result will be a job id.
 
+``/2/nodes/[node_name]/storage/repair``
++++++++++++++++++++++++++++++++++++++++
+
+Repairs a storage unit on the node.
+
+``PUT``
+~~~~~~~
+
+Repairs a storage unit on the node. Requires the parameters ``storage_type``
+(currently only ``lvm-vg`` can be repaired) and ``name`` (name of the storage
+unit). The result will be a job id.
+
 ``/2/nodes/[node_name]/tags``
 +++++++++++++++++++++++++++++
 
index d82780b..96d616e 100644 (file)
@@ -163,6 +163,8 @@ CONNECTOR.update({
       rlib2.R_2_nodes_name_storage,
   re.compile(r'^/2/nodes/([\w\._-]+)/storage/modify$'):
       rlib2.R_2_nodes_name_storage_modify,
+  re.compile(r'^/2/nodes/([\w\._-]+)/storage/repair$'):
+      rlib2.R_2_nodes_name_storage_repair,
   "/2/instances": rlib2.R_2_instances,
   re.compile(r'^/2/instances/([\w\._-]+)$'): rlib2.R_2_instances_name,
   re.compile(r'^/2/instances/([\w\._-]+)/tags$'): rlib2.R_2_instances_name_tags,
index 3a398a5..72937c3 100644 (file)
@@ -353,6 +353,29 @@ class R_2_nodes_name_storage_modify(baserlib.R_Generic):
     return baserlib.SubmitJob([op])
 
 
+class R_2_nodes_name_storage_repair(baserlib.R_Generic):
+  """/2/nodes/[node_name]/storage/repair ressource.
+
+  """
+  def PUT(self):
+    node_name = self.items[0]
+
+    storage_type = self._checkStringVariable("storage_type", None)
+    if not storage_type:
+      raise http.HttpBadRequest("Missing the required 'storage_type'"
+                                " parameter")
+
+    name = self._checkStringVariable("name", None)
+    if not name:
+      raise http.HttpBadRequest("Missing the required 'name'"
+                                " parameter")
+
+    op = opcodes.OpRepairNodeStorage(node_name=node_name,
+                                     storage_type=storage_type,
+                                     name=name)
+    return baserlib.SubmitJob([op])
+
+
 class R_2_instances(baserlib.R_Generic):
   """/2/instances resource.