Skip to content
Snippets Groups Projects
Commit 1b9690aa authored by Guido Trotter's avatar Guido Trotter
Browse files

Handle offline nodes for "instance down" checks


When offlining an instance because its primary node is down, we must be
able to cope with the situation.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent a47dc554
No related branches found
No related tags found
No related merge requests found
...@@ -1108,13 +1108,16 @@ def _CheckInstanceState(lu, instance, req_states, msg=None): ...@@ -1108,13 +1108,16 @@ def _CheckInstanceState(lu, instance, req_states, msg=None):
   
if constants.ADMINST_UP not in req_states: if constants.ADMINST_UP not in req_states:
pnode = instance.primary_node pnode = instance.primary_node
ins_l = lu.rpc.call_instance_list([pnode], [instance.hypervisor])[pnode] if not lu.cfg.GetNodeInfo(pnode).offline:
ins_l.Raise("Can't contact node %s for instance information" % pnode, ins_l = lu.rpc.call_instance_list([pnode], [instance.hypervisor])[pnode]
prereq=True, ecode=errors.ECODE_ENVIRON) ins_l.Raise("Can't contact node %s for instance information" % pnode,
prereq=True, ecode=errors.ECODE_ENVIRON)
if instance.name in ins_l.payload: if instance.name in ins_l.payload:
raise errors.OpPrereqError("Instance %s is running, %s" % raise errors.OpPrereqError("Instance %s is running, %s" %
(instance.name, msg), errors.ECODE_STATE) (instance.name, msg), errors.ECODE_STATE)
else:
lu.LogWarning("Primary node offline, ignoring check that instance"
" is down")
   
   
def _ComputeMinMaxSpec(name, qualifier, ipolicy, value): def _ComputeMinMaxSpec(name, qualifier, ipolicy, value):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment