Commit b2f29800 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Adding backend functionality to call oob helper


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 6204ee71
...@@ -1755,6 +1755,27 @@ def UploadFile(file_name, data, mode, uid, gid, atime, mtime): ...@@ -1755,6 +1755,27 @@ def UploadFile(file_name, data, mode, uid, gid, atime, mtime):
atime=atime, mtime=mtime) atime=atime, mtime=mtime)
def RunOob(oob_program, command, node, timeout):
"""Executes oob_program with given command on given node.
@param oob_program: The path to the executable oob_program
@param command: The command to invoke on oob_program
@param node: The node given as an argument to the program
@param timeout: Timeout after which we kill the oob program
@return: stdout
@raise RPCFail: If execution fails for some reason
"""
result = utils.RunCmd([oob_program, command, node], timeout=timeout)
if result.failed:
_Fail("'%s' failed with reason '%s'; output: %s", result.cmd,
result.fail_reason, result.output)
return result.stdout
def WriteSsconfFiles(values): def WriteSsconfFiles(values):
"""Update all ssconf files. """Update all ssconf files.
......
...@@ -645,6 +645,16 @@ NDS_PARAMETER_TYPES = { ...@@ -645,6 +645,16 @@ NDS_PARAMETER_TYPES = {
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys()) NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
# OOB supported commands
OOB_POWER_ON = "power-on"
OOB_POWER_OFF = "power-off"
OOB_POWER_CYCLE = "power-cycle"
OOB_POWER_STATUS = "power-status"
OOB_HEALTH = "health"
OOB_COMMANDS = frozenset([OOB_POWER_ON, OOB_POWER_OFF, OOB_POWER_CYCLE,
OOB_POWER_STATUS, OOB_HEALTH])
# Instance Parameters Profile # Instance Parameters Profile
PP_DEFAULT = "default" PP_DEFAULT = "default"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment