RepairCommand takes a node name, a command name,
and any potential input for the command.

This opcode is not accessible through RAPI.

Signed-off-by: Bhimanavajjula Aditya <[email protected]>
---
 src/Ganeti/Hs2Py/OpDoc.hs      |  4 ++++
 src/Ganeti/OpCodes.hs          |  8 ++++++++
 src/Ganeti/OpParams.hs         | 13 +++++++++++++
 test/hs/Test/Ganeti/OpCodes.hs |  3 +++
 test/py/docs_unittest.py       |  1 +
 5 files changed, 29 insertions(+)

diff --git a/src/Ganeti/Hs2Py/OpDoc.hs b/src/Ganeti/Hs2Py/OpDoc.hs
index aee68db..f5f832d 100644
--- a/src/Ganeti/Hs2Py/OpDoc.hs
+++ b/src/Ganeti/Hs2Py/OpDoc.hs
@@ -168,6 +168,10 @@ opRestrictedCommand :: String
 opRestrictedCommand =
   "Runs a restricted command on node(s)."
 
+opRepairCommand :: String
+opRepairCommand =
+  "Runs a repair command on a given node."
+
 opNodeRemove :: String
 opNodeRemove =
   "Remove a node.\n\
diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs
index 162e2d4..0820d2e 100644
--- a/src/Ganeti/OpCodes.hs
+++ b/src/Ganeti/OpCodes.hs
@@ -330,6 +330,14 @@ $(genOpCode "OpCode"
      , pRestrictedCommand
      ],
      [])
+  , ("OpRepairCommand",
+     [t| String |],
+     OpDoc.opRepairCommand,
+     [ pNodeName
+     , pRepairCommand
+     , pInput
+     ],
+     [])
   , ("OpNodeRemove",
      [t| () |],
       OpDoc.opNodeRemove,
diff --git a/src/Ganeti/OpParams.hs b/src/Ganeti/OpParams.hs
index b198fe3..fbb75e7 100644
--- a/src/Ganeti/OpParams.hs
+++ b/src/Ganeti/OpParams.hs
@@ -244,6 +244,8 @@ module Ganeti.OpParams
   , pZeroingTimeoutPerMiB
   , pTagSearchPattern
   , pRestrictedCommand
+  , pRepairCommand
+  , pInput
   , pReplaceDisksMode
   , pReplaceDisksList
   , pAllowFailover
@@ -921,6 +923,17 @@ pRestrictedCommand =
   renameField "RestrictedCommand" $
   simpleField "command" [t| NonEmptyString |]
 
+pRepairCommand :: Field
+pRepairCommand =
+  withDoc "Repair command name" .
+  renameField "RepairCommand" $
+  simpleField "command" [t| NonEmptyString |]
+
+pInput :: Field
+pInput =
+  withDoc "Input to be redirected to stdin of repair script" .
+  optionalField $ simpleField "input" [t| NonEmptyString |]
+
 pNodeName :: Field
 pNodeName =
   withDoc "A required node name (for single-node LUs)" $
diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs
index 5a96831..1fd4d5e 100644
--- a/test/hs/Test/Ganeti/OpCodes.hs
+++ b/test/hs/Test/Ganeti/OpCodes.hs
@@ -516,6 +516,9 @@ instance Arbitrary OpCodes.OpCode where
       "OP_RESTRICTED_COMMAND" ->
         OpCodes.OpRestrictedCommand <$> arbitrary <*> genNodeNamesNE <*>
           return Nothing <*> genNameNE
+      "OP_REPAIR_COMMAND" ->
+        OpCodes.OpRepairCommand <$> genNodeNameNE <*> genNameNE <*>
+          genMaybe genPrintableAsciiStringNE
       _ -> fail $ "Undefined arbitrary for opcode " ++ op_id
 
 instance Arbitrary OpCodes.CommonOpParams where
diff --git a/test/py/docs_unittest.py b/test/py/docs_unittest.py
index b9aa6a0..6802d48 100755
--- a/test/py/docs_unittest.py
+++ b/test/py/docs_unittest.py
@@ -77,6 +77,7 @@ RAPI_OPCODE_EXCLUDE = compat.UniqueFrozenset([
 
   # Very sensitive in nature
   opcodes.OpRestrictedCommand,
+  opcodes.OpRepairCommand,
   opcodes.OpClusterRenewCrypto,
 
   # Helper opcodes (e.g. submitted by LUs)
-- 
2.5.0.457.gab17608

Reply via email to