From 370f204258d477ebfaecfbd75498c73a41f19002 Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Tue, 18 Oct 2011 09:50:03 +0100
Subject: [PATCH] Fix RAPI node modify client and server calls

rapi.client.ModifyNode accepts a "group" and not a "node" param.
(this bug is invisible but still not nice)

rlib2.R_2_nodes_name_modify submits the opcode with instance_name rather
than node_name as a param. This would break the call.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/rapi/client.py | 8 ++++----
 lib/rapi/rlib2.py  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/rapi/client.py b/lib/rapi/client.py
index 53f26dedd..213712ddd 100644
--- a/lib/rapi/client.py
+++ b/lib/rapi/client.py
@@ -1455,20 +1455,20 @@ class GanetiRapiClient(object): # pylint: disable=R0904
                              ("/%s/nodes/%s/role" %
                               (GANETI_RAPI_VERSION, node)), query, role)
 
-  def ModifyNode(self, group, **kwargs):
+  def ModifyNode(self, node, **kwargs):
     """Modifies a node.
 
     More details for parameters can be found in the RAPI documentation.
 
-    @type group: string
-    @param group: Node name
+    @type node: string
+    @param node: Node name
     @rtype: string
     @return: job id
 
     """
     return self._SendRequest(HTTP_POST,
                              ("/%s/nodes/%s/modify" %
-                              (GANETI_RAPI_VERSION, group)), None, kwargs)
+                              (GANETI_RAPI_VERSION, node)), None, kwargs)
 
   def GetNodeStorageUnits(self, node, storage_type, output_fields):
     """Gets the storage units for a node.
diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index fbd1bd755..74fdf228c 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -513,7 +513,7 @@ class R_2_nodes_name_modify(baserlib.R_Generic):
     baserlib.CheckType(self.request_body, dict, "Body contents")
 
     op = baserlib.FillOpcode(opcodes.OpNodeSetParams, self.request_body, {
-      "instance_name": self.items[0],
+      "node_name": self.items[0],
       })
 
     return baserlib.SubmitJob([op])
-- 
GitLab