Skip to content

Commit 379f534

Browse files
committed
fence_compute: Fix disabling force_down on node when action is on
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.
1 parent 8f106de commit 379f534

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

fence/agents/compute/fence_compute.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -148,23 +148,23 @@ def set_power_status(_, options):
148148
return
149149

150150
if options["--action"] == "on":
151+
try:
152+
# Forcing the host back up
153+
nova.services.force_down(
154+
options["--plug"], "nova-compute", force_down=False)
155+
except Exception as e:
156+
# In theory, if foce_down=False fails, that's for the exact
157+
# same possible reasons that below with force_down=True
158+
# eg. either an incompatible version or an old client.
159+
# Since it's about forcing back to a default value, there is
160+
# no real worries to just consider it's still okay even if the
161+
# command failed
162+
logging.info("Exception from attempt to force "
163+
"host back up via nova API: "
164+
"%s: %s" % (e.__class__.__name__, e))
151165
if get_power_status(_, options) == "on":
152166
# Forcing the service back up in case it was disabled
153167
nova.services.enable(options["--plug"], 'nova-compute')
154-
try:
155-
# Forcing the host back up
156-
nova.services.force_down(
157-
options["--plug"], "nova-compute", force_down=False)
158-
except Exception as e:
159-
# In theory, if foce_down=False fails, that's for the exact
160-
# same possible reasons that below with force_down=True
161-
# eg. either an incompatible version or an old client.
162-
# Since it's about forcing back to a default value, there is
163-
# no real worries to just consider it's still okay even if the
164-
# command failed
165-
logging.info("Exception from attempt to force "
166-
"host back up via nova API: "
167-
"%s: %s" % (e.__class__.__name__, e))
168168
else:
169169
# Pretend we're 'on' so that the fencing library doesn't loop forever waiting for the node to boot
170170
override_status = "on"

0 commit comments

Comments
 (0)