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

gnt-node power: Mark also offline when powering off

Signed-off-by: default avatarRené Nussbaumer <>
Reviewed-by: default avatarGuido Trotter <>
Reviewed-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent 1ef6e776
......@@ -27,6 +27,7 @@
# C0103: Invalid name gnt-node
from ganeti.cli import *
from ganeti import cli
from ganeti import bootstrap
from ganeti import opcodes
from ganeti import utils
......@@ -476,8 +477,21 @@ def PowerNode(opts, args):
oob_command = "power-%s" % command
op = opcodes.OpOobCommand(node_name=node, command=oob_command)
result = SubmitOpCode(op, opts=opts)
opcodelist = []
if oob_command == constants.OOB_POWER_OFF:
opcodelist.append(opcodes.OpSetNodeParams(node_name=node, offline=True,
opcodelist.append(opcodes.OpOobCommand(node_name=node, command=oob_command))
cli.SetGenericOpcodeOpts(opcodelist, opts)
job_id = cli.SendJob(opcodelist)
# We just want the OOB Opcode status
# If it fails PollJob gives us the error message in it
result = cli.PollJob(job_id)[-1]
if result:
if oob_command == constants.OOB_POWER_STATUS:
text = "The machine is %spowered"
......@@ -735,7 +749,8 @@ commands = {
[ArgChoice(min=1, max=1, choices=_LIST_POWER_COMMANDS),
ArgNode(min=1, max=1)],
[], "on|off|cycle|status <node>",
"on|off|cycle|status <node>",
"Change power state of node by calling out-of-band helper."),
'remove': (
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