Skip to content

Commit

Permalink
fence_compute: Fix disabling force_down on node when action is on
Browse files Browse the repository at this point in the history
When the action is on, the goal is to disable force_down for the
nova-compute service on the node.

However, we were only doing that if the nova-compute service was up;
which is impossible if it's forced to be down... So just always disable
force_down, and then, if it's up, do more things.
  • Loading branch information
vuntz committed Dec 1, 2016
1 parent e67fcd4 commit ec47089
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions fence/agents/compute/fence_compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,23 @@ def set_power_status(_, options):
return

if options["--action"] == "on":
if get_power_status(_, options) != "on":
try:
# Forcing the host back up
nova.services.force_down(
options["--plug"], "nova-compute", force_down=False)
except Exception as e:
# In theory, if force_down=False fails, that's for the exact
# same possible reasons that below with force_down=True
# eg. either an incompatible version or an old client.
# Since it's about forcing back to a default value, there is
# no real worries to just consider it's still okay even if the
# command failed
logging.info("Exception from attempt to force "
"host back up via nova API: "
"%s: %s" % (e.__class__.__name__, e))
if get_power_status(_, options) == "on":
# Forcing the service back up in case it was disabled
nova.services.enable(options["--plug"], 'nova-compute')
try:
# Forcing the host back up
nova.services.force_down(
options["--plug"], "nova-compute", force_down=False)
except Exception as e:
# In theory, if force_down=False fails, that's for the exact
# same possible reasons that below with force_down=True
# eg. either an incompatible version or an old client.
# Since it's about forcing back to a default value, there is
# no real worries to just consider it's still okay even if the
# command failed
logging.info("Exception from attempt to force "
"host back up via nova API: "
"%s: %s" % (e.__class__.__name__, e))
else:
# Pretend we're 'on' so that the fencing library doesn't loop forever waiting for the node to boot
override_status = "on"
Expand Down

0 comments on commit ec47089

Please sign in to comment.