Commit 0ecef64c authored by René Nussbaumer's avatar René Nussbaumer
Browse files

LUSetNodeParams: Add support for powered state


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 78758f1e
...@@ -4360,6 +4360,7 @@ class LUSetNodeParams(LogicalUnit): ...@@ -4360,6 +4360,7 @@ class LUSetNodeParams(LogicalUnit):
("vm_capable", None, ht.TMaybeBool), ("vm_capable", None, ht.TMaybeBool),
("secondary_ip", None, ht.TMaybeString), ("secondary_ip", None, ht.TMaybeString),
("ndparams", None, ht.TOr(ht.TDict, ht.TNone)), ("ndparams", None, ht.TOr(ht.TDict, ht.TNone)),
("powered", None, ht.TMaybeBool),
_PForce, _PForce,
] ]
REQ_BGL = False REQ_BGL = False
...@@ -4503,11 +4504,16 @@ class LUSetNodeParams(LogicalUnit): ...@@ -4503,11 +4504,16 @@ class LUSetNodeParams(LogicalUnit):
# away from the respective state, as only real changes are kept # away from the respective state, as only real changes are kept
# TODO: We might query the real power state if it supports OOB # TODO: We might query the real power state if it supports OOB
if _SupportsOob(self.cfg, node) and (self.op.offline is False and if _SupportsOob(self.cfg, node):
not node.powered): if self.op.offline is False and not (node.powered or
self.op.powered == True):
raise errors.OpPrereqError(("Please power on node %s first before you" raise errors.OpPrereqError(("Please power on node %s first before you"
" can reset offline state") % " can reset offline state") %
self.op.node_name) self.op.node_name)
elif self.op.powered is not None:
raise errors.OpPrereqError(("Unable to change powered state for node %s"
" which does not support out-of-band"
" handling") % self.op.node_name)
# If we're being deofflined/drained, we'll MC ourself if needed # If we're being deofflined/drained, we'll MC ourself if needed
if (self.op.drained == False or self.op.offline == False or if (self.op.drained == False or self.op.offline == False or
...@@ -4598,6 +4604,9 @@ class LUSetNodeParams(LogicalUnit): ...@@ -4598,6 +4604,9 @@ class LUSetNodeParams(LogicalUnit):
if self.op.ndparams: if self.op.ndparams:
node.ndparams = self.new_ndparams node.ndparams = self.new_ndparams
if self.op.powered is not None:
node.powered = self.op.powered
for attr in ["master_capable", "vm_capable"]: for attr in ["master_capable", "vm_capable"]:
val = getattr(self.op, attr) val = getattr(self.op, attr)
if val is not None: if val is not None:
......
...@@ -490,6 +490,7 @@ class OpSetNodeParams(OpCode): ...@@ -490,6 +490,7 @@ class OpSetNodeParams(OpCode):
"vm_capable", "vm_capable",
"secondary_ip", "secondary_ip",
"ndparams", "ndparams",
"powered",
] ]
......
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