Blame SOURCES/bz1214359-5-fence_compute.patch

e4ffb1
From a1f988fa0f3f89f8dac17717295c4219a02757cf Mon Sep 17 00:00:00 2001
e4ffb1
From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
e4ffb1
Date: Sat, 20 Jun 2015 07:45:08 +0200
e4ffb1
Subject: [PATCH 1/3] fence_compute: add support for recording fencing
e4ffb1
 operations in attrd
e4ffb1
e4ffb1
This is required to support multiple compute nodes failure at once
e4ffb1
with controller node failures happening at the same time.
e4ffb1
e4ffb1
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
e4ffb1
---
e4ffb1
 fence/agents/compute/fence_compute.py | 28 +++++++++++++++++++++++++++-
e4ffb1
 1 file changed, 27 insertions(+), 1 deletion(-)
e4ffb1
e4ffb1
diff --git a/fence/agents/compute/fence_compute.py b/fence/agents/compute/fence_compute.py
e4ffb1
index 000aef7..d8a1e95 100644
e4ffb1
--- a/fence/agents/compute/fence_compute.py
e4ffb1
+++ b/fence/agents/compute/fence_compute.py
e4ffb1
@@ -71,6 +71,10 @@ def _host_evacuate(host, on_shared_storage):
e4ffb1
 			for server in hyper.servers:
e4ffb1
 				response.append(_server_evacuate(server, on_shared_storage))
e4ffb1
 
e4ffb1
+def set_attrd_status(host, status, options):
e4ffb1
+	logging.debug("Setting fencing status for %s to %s" % (host, status))
e4ffb1
+	run_command(options, "attrd_updater -p -n evacute -Q -N %s -v %s" % (host, status))
e4ffb1
+
e4ffb1
 def set_power_status(_, options):
e4ffb1
 	global override_status
e4ffb1
 
e4ffb1
@@ -159,6 +163,15 @@ def define_new_opts():
e4ffb1
 		"default" : "",
e4ffb1
 		"order": 5,
e4ffb1
 	}
e4ffb1
+	all_opt["record-only"] = {
e4ffb1
+		"getopt" : "",
e4ffb1
+		"longopt" : "record-only",
e4ffb1
+		"help" : "--record-only                  Record the target as needing evacuation but as yet do not intiate it",
e4ffb1
+		"required" : "0",
e4ffb1
+		"shortdesc" : "Only record the target as needing evacuation",
e4ffb1
+		"default" : "False",
e4ffb1
+		"order": 5,
e4ffb1
+	}
e4ffb1
 	all_opt["no-shared-storage"] = {
e4ffb1
 		"getopt" : "",
e4ffb1
 		"longopt" : "no-shared-storage",
e4ffb1
@@ -175,7 +188,8 @@ def main():
e4ffb1
 	atexit.register(atexit_handler)
e4ffb1
 
e4ffb1
 	device_opt = ["login", "passwd", "tenant-name", "auth-url",
e4ffb1
-		"no_login", "no_password", "port", "domain", "no-shared-storage", "endpoint-type"]
e4ffb1
+		"no_login", "no_password", "port", "domain", "no-shared-storage", "endpoint-type",
e4ffb1
+		"record-only"]
e4ffb1
 	define_new_opts()
e4ffb1
 	all_opt["shell_timeout"]["default"] = "180"
e4ffb1
 
e4ffb1
@@ -199,6 +213,18 @@ def main():
e4ffb1
 	if options["--action"] != "list" and options["--domain"] != "" and options.has_key("--plug"):
e4ffb1
 		options["--plug"] = options["--plug"] + "." + options["--domain"]
e4ffb1
 
e4ffb1
+	if options["--record-only"] != "False":
e4ffb1
+		if options["--action"] == "on":
e4ffb1
+			set_attrd_status(options["--plug"], "no", options)
e4ffb1
+			sys.exit(0)
e4ffb1
+
e4ffb1
+		elif options["--action"] in ["off", "reboot"]:
e4ffb1
+			set_attrd_status(options["--plug"], "yes", options)
e4ffb1
+			sys.exit(0)
e4ffb1
+
e4ffb1
+		elif options["--action"] in ["status", "monitor"]:
e4ffb1
+			sys.exit(0)
e4ffb1
+
e4ffb1
 	# The first argument is the Nova client version
e4ffb1
 	nova = nova_client.Client('2',
e4ffb1
 		options["--username"],
e4ffb1
-- 
e4ffb1
1.9.3
e4ffb1