2016-12-01 14:22:57 +01:00
|
|
|
From 6d2776559a5bb11b83e9703bed2aeec681207b78 Mon Sep 17 00:00:00 2001
|
2016-02-22 10:28:31 +01:00
|
|
|
From: Vincent Untz <vuntz@suse.com>
|
|
|
|
Date: Wed, 3 Feb 2016 13:45:52 +0100
|
2016-06-30 12:01:27 +02:00
|
|
|
Subject: [PATCH 9/9] fence_compute: Fix disabling force_down on node when
|
2016-02-22 10:28:31 +01:00
|
|
|
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.
|
|
|
|
---
|
2016-12-01 14:22:57 +01:00
|
|
|
fence/agents/compute/fence_compute.py | 30 +++++++++++++++---------------
|
|
|
|
1 file changed, 15 insertions(+), 15 deletions(-)
|
2016-02-22 10:28:31 +01:00
|
|
|
|
|
|
|
diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
|
2016-12-01 14:22:57 +01:00
|
|
|
index cb7dfe3..00a49cb 100644
|
2016-02-22 10:28:31 +01:00
|
|
|
--- a/fence/agents/compute/fence_compute.py
|
|
|
|
+++ b/fence/agents/compute/fence_compute.py
|
2016-12-01 14:22:57 +01:00
|
|
|
@@ -159,23 +159,23 @@ def set_power_status(_, options):
|
2016-02-22 10:28:31 +01:00
|
|
|
return
|
|
|
|
|
|
|
|
if options["--action"] == "on":
|
2016-12-01 14:22:57 +01:00
|
|
|
- if get_power_status(_, options) != "on":
|
2016-02-22 10:28:31 +01:00
|
|
|
+ try:
|
|
|
|
+ # Forcing the host back up
|
|
|
|
+ nova.services.force_down(
|
|
|
|
+ options["--plug"], "nova-compute", force_down=False)
|
|
|
|
+ except Exception as e:
|
2016-06-30 12:01:27 +02:00
|
|
|
+ # In theory, if force_down=False fails, that's for the exact
|
2016-02-22 10:28:31 +01:00
|
|
|
+ # 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))
|
2016-12-01 14:22:57 +01:00
|
|
|
+ if get_power_status(_, options) == "on":
|
2016-02-22 10:28:31 +01:00
|
|
|
# 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:
|
2016-06-30 12:01:27 +02:00
|
|
|
- # In theory, if force_down=False fails, that's for the exact
|
2016-02-22 10:28:31 +01:00
|
|
|
- # 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"
|
|
|
|
--
|
2016-12-01 14:22:57 +01:00
|
|
|
2.10.1
|
2016-02-22 10:28:31 +01:00
|
|
|
|