Blame SOURCES/fence_aliyun-3-logging.patch

674a4f
From 790cbaa66f3927a84739af4a1f0e8bba295cdc36 Mon Sep 17 00:00:00 2001
674a4f
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
674a4f
Date: Mon, 30 Jul 2018 10:43:04 +0200
674a4f
Subject: [PATCH] fence_aliyun: add logging
674a4f
674a4f
---
674a4f
 agents/aliyun/fence_aliyun.py | 16 ++++++++++++----
674a4f
 1 file changed, 12 insertions(+), 4 deletions(-)
674a4f
674a4f
diff --git a/agents/aliyun/fence_aliyun.py b/agents/aliyun/fence_aliyun.py
674a4f
index aa6c0acf..2cda6b7f 100644
674a4f
--- a/agents/aliyun/fence_aliyun.py
674a4f
+++ b/agents/aliyun/fence_aliyun.py
674a4f
@@ -23,9 +23,10 @@ def _send_request(conn, request):
674a4f
 	try:
674a4f
 		response_str = conn.do_action_with_exception(request)
674a4f
 		response_detail = json.loads(response_str)
674a4f
+		logging.debug("_send_request reponse: %s" % response_detail)
674a4f
 		return response_detail
674a4f
 	except Exception as e:
674a4f
-		fail_usage("Failed: _send_request failed")
674a4f
+		fail_usage("Failed: _send_request failed: %s" % e)
674a4f
 
674a4f
 def start_instance(conn, instance_id):
674a4f
 	request = StartInstanceRequest()
674a4f
@@ -69,15 +70,22 @@ def get_nodes_list(conn, options):
674a4f
 
674a4f
 def get_power_status(conn, options):
674a4f
 	state = get_status(conn, options["--plug"])
674a4f
+
674a4f
 	if state == "Running":
674a4f
-		return "on"
674a4f
+		status = "on"
674a4f
 	elif state == "Stopped":
674a4f
-		return "off"
674a4f
+		status = "off"
674a4f
 	else:
674a4f
-		return "unknown"
674a4f
+		status = "unknown"
674a4f
+
674a4f
+	logging.info("get_power_status: %s" % status)
674a4f
+
674a4f
+	return status
674a4f
 
674a4f
 
674a4f
 def set_power_status(conn, options):
674a4f
+	logging.info("set_power_status: %s" % options["--action"])
674a4f
+
674a4f
 	if (options["--action"]=="off"):
674a4f
 		stop_instance(conn, options["--plug"])
674a4f
 	elif (options["--action"]=="on"):