While gnt_node.py already correctly complied to the
'--no-node-setup' option, the corresponding LU did
use the cluster's init flag '--no-ssh-init'. While not
advisable to do so, this would result in an error if
the cluster is initialized without the '--no-ssh-init'
option, but the node is added with the '--no-node-setup'
option.

Signed-off-by: Helga Velroyen <hel...@google.com>
---
 lib/client/gnt_node.py         | 3 ++-
 lib/cmdlib/node.py             | 3 +--
 src/Ganeti/OpCodes.hs          | 1 +
 src/Ganeti/OpParams.hs         | 8 ++++++++
 test/hs/Test/Ganeti/OpCodes.hs | 3 ++-
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py
index 5a32188..3a61700 100644
--- a/lib/client/gnt_node.py
+++ b/lib/client/gnt_node.py
@@ -338,7 +338,8 @@ def AddNode(opts, args):
                          vm_capable=opts.vm_capable, ndparams=opts.ndparams,
                          master_capable=opts.master_capable,
                          disk_state=disk_state,
-                         hv_state=hv_state)
+                         hv_state=hv_state,
+                         node_setup=opts.node_setup)
   SubmitOpCode(op, opts=opts)
 
 
diff --git a/lib/cmdlib/node.py b/lib/cmdlib/node.py
index 88ff0e0..3bf50d7 100644
--- a/lib/cmdlib/node.py
+++ b/lib/cmdlib/node.py
@@ -477,8 +477,7 @@ class LUNodeAdd(LogicalUnit):
     EnsureKvmdOnNodes(self, feedback_fn, nodes=[self.new_node.uuid])
 
     # Update SSH setup of all nodes
-    modify_ssh_setup = self.cfg.GetClusterInfo().modify_ssh_setup
-    if modify_ssh_setup:
+    if self.op.node_setup:
       # FIXME: so far, all nodes are considered potential master candidates
       self._SshUpdate(self.new_node.uuid, self.new_node.name,
                       self.new_node.master_candidate, True,
diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs
index 872500f..def83de 100644
--- a/src/Ganeti/OpCodes.hs
+++ b/src/Ganeti/OpCodes.hs
@@ -341,6 +341,7 @@ $(genOpCode "OpCode"
      , pMasterCapable
      , pVmCapable
      , pNdParams
+     , pNodeSetup
      ],
      "node_name")
   , ("OpNodeQueryvols",
diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs
index 30de848..4ecfb4d 100644
--- a/src/Ganeti/OpParams.hs
+++ b/src/Ganeti/OpParams.hs
@@ -296,6 +296,7 @@ module Ganeti.OpParams
   , pDataCollectorInterval
   , pNodeSslCerts
   , pSshKeys
+  , pNodeSetup
   ) where
 
 import Control.Monad (liftM, mplus)
@@ -1872,3 +1873,10 @@ pSshKeys =
   withDoc "Whether to renew SSH keys" .
   defaultField [| False |] $
   simpleField "ssh_keys" [t| Bool |]
+
+pNodeSetup :: Field
+pNodeSetup =
+  withDoc "Whether to perform a SSH setup on the new node" .
+  defaultField [| False |] $
+  simpleField "node_setup" [t| Bool |]
+
diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs
index 9bf4b0a..aa197ba 100644
--- a/test/hs/Test/Ganeti/OpCodes.hs
+++ b/test/hs/Test/Ganeti/OpCodes.hs
@@ -268,7 +268,8 @@ instance Arbitrary OpCodes.OpCode where
       "OP_NODE_ADD" ->
         OpCodes.OpNodeAdd <$> genNodeNameNE <*> emptyMUD <*> emptyMUD <*>
           genMaybe genNameNE <*> genMaybe genNameNE <*> arbitrary <*>
-          genMaybe genNameNE <*> arbitrary <*> arbitrary <*> emptyMUD
+          genMaybe genNameNE <*> arbitrary <*> arbitrary <*> emptyMUD <*>
+          arbitrary
       "OP_NODE_QUERYVOLS" ->
         OpCodes.OpNodeQueryvols <$> genNamesNE <*> genNodeNamesNE
       "OP_NODE_QUERY_STORAGE" ->
-- 
2.1.0.rc2.206.gedb03e5

Reply via email to