diff --git a/SOURCES/bz1677327-1-fence_redfish-use-ipport-parameter.patch b/SOURCES/bz1677327-1-fence_redfish-use-ipport-parameter.patch new file mode 100644 index 0000000..e2514f1 --- /dev/null +++ b/SOURCES/bz1677327-1-fence_redfish-use-ipport-parameter.patch @@ -0,0 +1,43 @@ +From 9ebd2e2e36ae0de5c9164f4ac3fd29bdac0cab61 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 14 Feb 2019 10:03:33 +0100 +Subject: [PATCH] fence_redfish: use "ipport" parameter and improve logging + +--- + agents/redfish/fence_redfish.py | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py +index 5b719d4b..28840058 100644 +--- a/agents/redfish/fence_redfish.py ++++ b/agents/redfish/fence_redfish.py +@@ -22,7 +22,10 @@ def get_power_status(conn, options): + fail_usage("Couldn't get power information") + data = response['data'] + +- logging.debug("PowerState is: " + data[u'PowerState']) ++ try: ++ logging.debug("PowerState is: " + data[u'PowerState']) ++ except Exception: ++ fail_usage("Unable to get PowerState: " + "https://" + options["--ip"] + ":" + str(options["--ipport"]) + options["--systems-uri"]) + + if data[u'PowerState'].strip() == "Off": + return "off" +@@ -52,7 +55,7 @@ def set_power_status(conn, options): + return + + def send_get_request(options, uri): +- full_uri = "https://" + options["--ip"] + uri ++ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri + try: + resp = requests.get(full_uri, verify=not "--ssl-insecure" in options, + auth=(options["--username"], options["--password"])) +@@ -62,7 +65,7 @@ def send_get_request(options, uri): + return {'ret': True, 'data': data} + + def send_post_request(options, uri, payload, headers): +- full_uri = "https://" + options["--ip"] + uri ++ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri + try: + requests.post(full_uri, data=json.dumps(payload), + headers=headers, verify=not "--ssl-insecure" in options, diff --git a/SOURCES/bz1677327-2-fence_redfish-ip-parameter-backward-compatibility.patch b/SOURCES/bz1677327-2-fence_redfish-ip-parameter-backward-compatibility.patch new file mode 100644 index 0000000..3d97c4e --- /dev/null +++ b/SOURCES/bz1677327-2-fence_redfish-ip-parameter-backward-compatibility.patch @@ -0,0 +1,24 @@ +From 21898e45ca2624546de99086a27a14dd1ff86a2b Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 21 Feb 2019 09:08:03 +0100 +Subject: [PATCH] fence_redfish: backwards compatibility for : + +--- + agents/redfish/fence_redfish.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py +index 28840058..f1424232 100644 +--- a/agents/redfish/fence_redfish.py ++++ b/agents/redfish/fence_redfish.py +@@ -140,6 +140,10 @@ def main(): + if "--ssl-insecure" in opt: + requests.packages.urllib3.disable_warnings(InsecureRequestWarning) + ++ # backwards compatibility for : ++ if options["--ip"].count(":") == 1: ++ (options["--ip"], options["--ipport"]) = options["--ip"].split(":") ++ + if "--systems-uri" not in opt: + # Systems URI not provided, find it + sysresult = find_systems_resource(options) diff --git a/SOURCES/bz1696584-fence_gce-fix-python3-encoding-issue.patch b/SOURCES/bz1696584-fence_gce-fix-python3-encoding-issue.patch new file mode 100644 index 0000000..9e9f7ad --- /dev/null +++ b/SOURCES/bz1696584-fence_gce-fix-python3-encoding-issue.patch @@ -0,0 +1,22 @@ +From 64ac6207152508392690b7c1dfcac3fe0a76adfd Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Fri, 5 Apr 2019 09:48:52 +0200 +Subject: [PATCH] fence_gce: fix Python 3 encoding issue + +--- + agents/gce/fence_gce.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agents/gce/fence_gce.py b/agents/gce/fence_gce.py +index 93cd11801..b171710d9 100644 +--- a/agents/gce/fence_gce.py ++++ b/agents/gce/fence_gce.py +@@ -146,7 +146,7 @@ def get_metadata(metadata_key, params=None, timeout=None): + url = '%s?%s' % (metadata_url, params) + request = urlrequest.Request(url, headers=METADATA_HEADERS) + request_opener = urlrequest.build_opener(urlrequest.ProxyHandler({})) +- return request_opener.open(request, timeout=timeout * 1.1).read() ++ return request_opener.open(request, timeout=timeout * 1.1).read().decode("utf-8") + + + def define_new_opts(): diff --git a/SOURCES/bz1700546-fence_azure_arm-skip_shutdown.patch b/SOURCES/bz1700546-fence_azure_arm-skip_shutdown.patch new file mode 100644 index 0000000..708eb84 --- /dev/null +++ b/SOURCES/bz1700546-fence_azure_arm-skip_shutdown.patch @@ -0,0 +1,48 @@ +From 1b3e548fcc0bd427dade178fa260567047ff3a0e Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Mon, 6 May 2019 13:24:18 +0200 +Subject: [PATCH] fence_azure_arm: use skip_shutdown feature when available + +The "skip_shutdown" parameter is ignored in older Azure SDK, so there's +no need for a fallback option. +--- + agents/azure_arm/fence_azure_arm.py | 6 +++--- + tests/data/metadata/fence_azure_arm.xml | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/agents/azure_arm/fence_azure_arm.py b/agents/azure_arm/fence_azure_arm.py +index 58b9eeb13..be0d40345 100755 +--- a/agents/azure_arm/fence_azure_arm.py ++++ b/agents/azure_arm/fence_azure_arm.py +@@ -114,8 +114,8 @@ def set_power_status(clients, options): + azure_fence.set_network_state(compute_client, network_client, rgName, vmName, "unblock") + + if (options["--action"]=="off"): +- logging.info("Deallocating " + vmName + " in resource group " + rgName) +- compute_client.virtual_machines.deallocate(rgName, vmName) ++ logging.info("Poweroff " + vmName + " in resource group " + rgName) ++ compute_client.virtual_machines.power_off(rgName, vmName, skip_shutdown=True) + elif (options["--action"]=="on"): + logging.info("Starting " + vmName + " in resource group " + rgName) + compute_client.virtual_machines.start(rgName, vmName) +@@ -199,7 +199,7 @@ def main(): + + docs = {} + docs["shortdesc"] = "Fence agent for Azure Resource Manager" +- docs["longdesc"] = "Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure.\ ++ docs["longdesc"] = "fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure.\ + \n.P\n\ + For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal\ + \n.P\n\ +diff --git a/tests/data/metadata/fence_azure_arm.xml b/tests/data/metadata/fence_azure_arm.xml +index 1c0b6cc6b..97ecfdba4 100644 +--- a/tests/data/metadata/fence_azure_arm.xml ++++ b/tests/data/metadata/fence_azure_arm.xml +@@ -1,6 +1,6 @@ + + +-Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure. ++fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure. + + For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal + diff --git a/SOURCES/bz1704228-fence_redfish-full-redfish-spec-compliance.patch b/SOURCES/bz1704228-fence_redfish-full-redfish-spec-compliance.patch new file mode 100644 index 0000000..3b8ba13 --- /dev/null +++ b/SOURCES/bz1704228-fence_redfish-full-redfish-spec-compliance.patch @@ -0,0 +1,65 @@ +From 75a74debba2205547d8eefae221221c2c71d99ce Mon Sep 17 00:00:00 2001 +From: Jose Delarosa +Date: Mon, 15 Apr 2019 12:46:42 -0500 +Subject: [PATCH] fence_redfish: add headers to HTTP methods + +* Needed for full compliance with Redfish spec. +* May cause errors in some devices if not sent. +--- + agents/redfish/fence_redfish.py | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py +index f1424232..390a4827 100644 +--- a/agents/redfish/fence_redfish.py ++++ b/agents/redfish/fence_redfish.py +@@ -16,6 +16,11 @@ + from fencing import * + from fencing import fail_usage, run_delay + ++GET_HEADERS = {'accept': 'application/json', 'OData-Version': '4.0'} ++POST_HEADERS = {'content-type': 'application/json', 'accept': 'application/json', ++ 'OData-Version': '4.0'} ++ ++ + def get_power_status(conn, options): + response = send_get_request(options, options["--systems-uri"]) + if response['ret'] is False: +@@ -40,7 +45,6 @@ def set_power_status(conn, options): + }[options["--action"]] + + payload = {'ResetType': action} +- headers = {'content-type': 'application/json'} + + # Search for 'Actions' key and extract URI from it + response = send_get_request(options, options["--systems-uri"]) +@@ -49,7 +53,7 @@ def set_power_status(conn, options): + data = response['data'] + action_uri = data["Actions"]["#ComputerSystem.Reset"]["target"] + +- response = send_post_request(options, action_uri, payload, headers) ++ response = send_post_request(options, action_uri, payload) + if response['ret'] is False: + fail_usage("Error sending power command") + return +@@ -58,17 +62,18 @@ def send_get_request(options, uri): + full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri + try: + resp = requests.get(full_uri, verify=not "--ssl-insecure" in options, ++ headers=GET_HEADERS, + auth=(options["--username"], options["--password"])) + data = resp.json() + except Exception as e: + fail_usage("Failed: send_get_request: " + str(e)) + return {'ret': True, 'data': data} + +-def send_post_request(options, uri, payload, headers): ++def send_post_request(options, uri, payload): + full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri + try: + requests.post(full_uri, data=json.dumps(payload), +- headers=headers, verify=not "--ssl-insecure" in options, ++ headers=POST_HEADERS, verify=not "--ssl-insecure" in options, + auth=(options["--username"], options["--password"])) + except Exception as e: + fail_usage("Failed: send_post_request: " + str(e)) diff --git a/SOURCES/bz1709780-fence_rhevm-RHEV-v4-API-support.patch b/SOURCES/bz1709780-fence_rhevm-RHEV-v4-API-support.patch new file mode 100644 index 0000000..6f115e8 --- /dev/null +++ b/SOURCES/bz1709780-fence_rhevm-RHEV-v4-API-support.patch @@ -0,0 +1,164 @@ +From a4e8b77ac51a0e4a6de489823ee1be47cbc7eb18 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 9 May 2019 12:09:48 +0200 +Subject: [PATCH] fence_rhevm: add RHEV v4 API support and auto-detection + +--- + agents/rhevm/fence_rhevm.py | 44 +++++++++++++++++++++++------ + tests/data/metadata/fence_rhevm.xml | 7 ++++- + 2 files changed, 41 insertions(+), 10 deletions(-) + +diff --git a/agents/rhevm/fence_rhevm.py b/agents/rhevm/fence_rhevm.py +index a1cdaf605..6012c4239 100644 +--- a/agents/rhevm/fence_rhevm.py ++++ b/agents/rhevm/fence_rhevm.py +@@ -9,7 +9,8 @@ + from fencing import fail, EC_FETCH_VM_UUID, run_delay + + RE_GET_ID = re.compile("(.*?)", re.IGNORECASE) ++RE_STATUS = re.compile("(.*?)", re.IGNORECASE) ++RE_STATE = re.compile("(.*?)", re.IGNORECASE) + RE_GET_NAME = re.compile("(.*?)", re.IGNORECASE) + + def get_power_status(conn, options): +@@ -25,7 +26,10 @@ def get_power_status(conn, options): + + options["id"] = result.group(2) + +- result = RE_STATUS.search(res) ++ if tuple(map(int, options["--api-version"].split(".")))[0] > 3: ++ result = RE_STATUS.search(res) ++ else: ++ result = RE_STATE.search(res) + if result == None: + # We were able to parse ID so output is correct + # in some cases it is possible that RHEV-M output does not +@@ -59,7 +63,10 @@ def get_list(conn, options): + lines = res.split(" 3: ++ status = RE_STATUS.search(lines[i]).group(1) ++ else: ++ status = RE_STATE.search(lines[i]).group(1) + outlets[name] = ("", status) + except AttributeError: + return {} +@@ -69,6 +76,13 @@ def get_list(conn, options): + return outlets + + def send_command(opt, command, method="GET"): ++ if opt["--api-version"] == "auto": ++ opt["--api-version"] = "4" ++ res = send_command(opt, "") ++ if re.search("Error", res): ++ opt["--api-version"] = "3" ++ logging.debug("auto-detected API version: " + opt["--api-version"]) ++ + ## setup correct URL + if "--ssl" in opt or "--ssl-secure" in opt or "--ssl-insecure" in opt: + url = "https:" +@@ -90,7 +104,7 @@ def send_command(opt, command, method="GET"): + web_buffer = io.BytesIO() + conn.setopt(pycurl.URL, url.encode("UTF-8")) + conn.setopt(pycurl.HTTPHEADER, [ +- "Version: 3", ++ "Version: {}".format(opt["--api-version"]), + "Content-type: application/xml", + "Accept: application/xml", + "Prefer: persistent-auth", +@@ -130,8 +144,9 @@ def send_command(opt, command, method="GET"): + + result = web_buffer.getvalue().decode("UTF-8") + +- logging.debug("%s\n", command) +- logging.debug("%s\n", result) ++ logging.debug("url: %s\n", url) ++ logging.debug("command: %s\n", command) ++ logging.debug("result: %s\n", result) + + return result + +@@ -151,6 +166,15 @@ def define_new_opts(): + "required" : "0", + "shortdesc" : "Reuse cookies for authentication", + "order" : 1} ++ all_opt["api_version"] = { ++ "getopt" : ":", ++ "longopt" : "api-version", ++ "help" : "--api-version " ++ "Version of RHEV API (default: auto)", ++ "required" : "0", ++ "order" : 2, ++ "default" : "auto", ++ } + all_opt["api_path"] = { + "getopt" : ":", + "longopt" : "api-path", +@@ -158,20 +182,19 @@ def define_new_opts(): + "default" : "/ovirt-engine/api", + "required" : "0", + "shortdesc" : "The path part of the API URL", +- "order" : 2} ++ "order" : 3} + all_opt["disable_http_filter"] = { + "getopt" : "", + "longopt" : "disable-http-filter", + "help" : "--disable-http-filter Set HTTP Filter header to false", + "required" : "0", + "shortdesc" : "Set HTTP Filter header to false", +- "order" : 3} ++ "order" : 4} + + + def main(): + device_opt = [ + "ipaddr", +- "api_path", + "login", + "passwd", + "ssl", +@@ -179,6 +202,8 @@ def main(): + "web", + "port", + "use_cookies", ++ "api_version", ++ "api_path", + "disable_http_filter", + ] + +@@ -186,6 +211,7 @@ def main(): + define_new_opts() + + all_opt["power_wait"]["default"] = "1" ++ all_opt["shell_timeout"]["default"] = "5" + + options = check_input(device_opt, process_input(device_opt)) + +diff --git a/tests/data/metadata/fence_rhevm.xml b/tests/data/metadata/fence_rhevm.xml +index 6344db79f..c56cf64b6 100644 +--- a/tests/data/metadata/fence_rhevm.xml ++++ b/tests/data/metadata/fence_rhevm.xml +@@ -98,6 +98,11 @@ + + Login name + ++ ++ ++ ++ Version of RHEV API (default: auto) ++ + + + The path part of the API URL +@@ -164,7 +169,7 @@ + + + +- ++ + Wait X seconds for cmd prompt after issuing command + + diff --git a/SOURCES/bz1709926-fence_mpath-fix-watchdog-hardreboot.patch b/SOURCES/bz1709926-fence_mpath-fix-watchdog-hardreboot.patch new file mode 100644 index 0000000..2b187c2 --- /dev/null +++ b/SOURCES/bz1709926-fence_mpath-fix-watchdog-hardreboot.patch @@ -0,0 +1,21 @@ +From e5c6c2e134fd397ffe3319adc7afb8b633a251b2 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Tue, 14 May 2019 16:44:59 +0200 +Subject: [PATCH] fence_mpath: import ctypes to fix watchdog hardreboot + +--- + agents/mpath/fence_mpath.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py +index d9ac2ef54..e4f598361 100644 +--- a/agents/mpath/fence_mpath.py ++++ b/agents/mpath/fence_mpath.py +@@ -6,6 +6,7 @@ + import os + import logging + import atexit ++import ctypes + sys.path.append("@FENCEAGENTSLIBDIR@") + from fencing import fail_usage, run_command, atexit_handler, check_input, process_input, show_docs + from fencing import fence_action, all_opt, run_delay diff --git a/SOURCES/bz1710055-1-fence_redfish-use-ipport-parameter.patch b/SOURCES/bz1710055-1-fence_redfish-use-ipport-parameter.patch deleted file mode 100644 index e2514f1..0000000 --- a/SOURCES/bz1710055-1-fence_redfish-use-ipport-parameter.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 9ebd2e2e36ae0de5c9164f4ac3fd29bdac0cab61 Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Thu, 14 Feb 2019 10:03:33 +0100 -Subject: [PATCH] fence_redfish: use "ipport" parameter and improve logging - ---- - agents/redfish/fence_redfish.py | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py -index 5b719d4b..28840058 100644 ---- a/agents/redfish/fence_redfish.py -+++ b/agents/redfish/fence_redfish.py -@@ -22,7 +22,10 @@ def get_power_status(conn, options): - fail_usage("Couldn't get power information") - data = response['data'] - -- logging.debug("PowerState is: " + data[u'PowerState']) -+ try: -+ logging.debug("PowerState is: " + data[u'PowerState']) -+ except Exception: -+ fail_usage("Unable to get PowerState: " + "https://" + options["--ip"] + ":" + str(options["--ipport"]) + options["--systems-uri"]) - - if data[u'PowerState'].strip() == "Off": - return "off" -@@ -52,7 +55,7 @@ def set_power_status(conn, options): - return - - def send_get_request(options, uri): -- full_uri = "https://" + options["--ip"] + uri -+ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri - try: - resp = requests.get(full_uri, verify=not "--ssl-insecure" in options, - auth=(options["--username"], options["--password"])) -@@ -62,7 +65,7 @@ def send_get_request(options, uri): - return {'ret': True, 'data': data} - - def send_post_request(options, uri, payload, headers): -- full_uri = "https://" + options["--ip"] + uri -+ full_uri = "https://" + options["--ip"] + ":" + str(options["--ipport"]) + uri - try: - requests.post(full_uri, data=json.dumps(payload), - headers=headers, verify=not "--ssl-insecure" in options, diff --git a/SOURCES/bz1710055-2-fence_redfish-ip-parameter-backward-compatibility.patch b/SOURCES/bz1710055-2-fence_redfish-ip-parameter-backward-compatibility.patch deleted file mode 100644 index 3d97c4e..0000000 --- a/SOURCES/bz1710055-2-fence_redfish-ip-parameter-backward-compatibility.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 21898e45ca2624546de99086a27a14dd1ff86a2b Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Thu, 21 Feb 2019 09:08:03 +0100 -Subject: [PATCH] fence_redfish: backwards compatibility for : - ---- - agents/redfish/fence_redfish.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/agents/redfish/fence_redfish.py b/agents/redfish/fence_redfish.py -index 28840058..f1424232 100644 ---- a/agents/redfish/fence_redfish.py -+++ b/agents/redfish/fence_redfish.py -@@ -140,6 +140,10 @@ def main(): - if "--ssl-insecure" in opt: - requests.packages.urllib3.disable_warnings(InsecureRequestWarning) - -+ # backwards compatibility for : -+ if options["--ip"].count(":") == 1: -+ (options["--ip"], options["--ipport"]) = options["--ip"].split(":") -+ - if "--systems-uri" not in opt: - # Systems URI not provided, find it - sysresult = find_systems_resource(options) diff --git a/SOURCES/bz1710066-fence_gce-fix-python3-encoding-issue.patch b/SOURCES/bz1710066-fence_gce-fix-python3-encoding-issue.patch deleted file mode 100644 index 9e9f7ad..0000000 --- a/SOURCES/bz1710066-fence_gce-fix-python3-encoding-issue.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 64ac6207152508392690b7c1dfcac3fe0a76adfd Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Fri, 5 Apr 2019 09:48:52 +0200 -Subject: [PATCH] fence_gce: fix Python 3 encoding issue - ---- - agents/gce/fence_gce.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/agents/gce/fence_gce.py b/agents/gce/fence_gce.py -index 93cd11801..b171710d9 100644 ---- a/agents/gce/fence_gce.py -+++ b/agents/gce/fence_gce.py -@@ -146,7 +146,7 @@ def get_metadata(metadata_key, params=None, timeout=None): - url = '%s?%s' % (metadata_url, params) - request = urlrequest.Request(url, headers=METADATA_HEADERS) - request_opener = urlrequest.build_opener(urlrequest.ProxyHandler({})) -- return request_opener.open(request, timeout=timeout * 1.1).read() -+ return request_opener.open(request, timeout=timeout * 1.1).read().decode("utf-8") - - - def define_new_opts(): diff --git a/SOURCES/bz1710486-fence_azure_arm-skip_shutdown.patch b/SOURCES/bz1710486-fence_azure_arm-skip_shutdown.patch deleted file mode 100644 index 708eb84..0000000 --- a/SOURCES/bz1710486-fence_azure_arm-skip_shutdown.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 1b3e548fcc0bd427dade178fa260567047ff3a0e Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Mon, 6 May 2019 13:24:18 +0200 -Subject: [PATCH] fence_azure_arm: use skip_shutdown feature when available - -The "skip_shutdown" parameter is ignored in older Azure SDK, so there's -no need for a fallback option. ---- - agents/azure_arm/fence_azure_arm.py | 6 +++--- - tests/data/metadata/fence_azure_arm.xml | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/agents/azure_arm/fence_azure_arm.py b/agents/azure_arm/fence_azure_arm.py -index 58b9eeb13..be0d40345 100755 ---- a/agents/azure_arm/fence_azure_arm.py -+++ b/agents/azure_arm/fence_azure_arm.py -@@ -114,8 +114,8 @@ def set_power_status(clients, options): - azure_fence.set_network_state(compute_client, network_client, rgName, vmName, "unblock") - - if (options["--action"]=="off"): -- logging.info("Deallocating " + vmName + " in resource group " + rgName) -- compute_client.virtual_machines.deallocate(rgName, vmName) -+ logging.info("Poweroff " + vmName + " in resource group " + rgName) -+ compute_client.virtual_machines.power_off(rgName, vmName, skip_shutdown=True) - elif (options["--action"]=="on"): - logging.info("Starting " + vmName + " in resource group " + rgName) - compute_client.virtual_machines.start(rgName, vmName) -@@ -199,7 +199,7 @@ def main(): - - docs = {} - docs["shortdesc"] = "Fence agent for Azure Resource Manager" -- docs["longdesc"] = "Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure.\ -+ docs["longdesc"] = "fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure.\ - \n.P\n\ - For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal\ - \n.P\n\ -diff --git a/tests/data/metadata/fence_azure_arm.xml b/tests/data/metadata/fence_azure_arm.xml -index 1c0b6cc6b..97ecfdba4 100644 ---- a/tests/data/metadata/fence_azure_arm.xml -+++ b/tests/data/metadata/fence_azure_arm.xml -@@ -1,6 +1,6 @@ - - --Used to deallocate virtual machines and to report power state of virtual machines running in Azure. It uses Azure SDK for Python to connect to Azure. -+fence_azure_arm is an I/O Fencing agent for Azure Resource Manager. It uses Azure SDK for Python to connect to Azure. - - For instructions to setup credentials see: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal - diff --git a/SOURCES/bz1712263-fence_rhevm-1-use-UTF8-encoding.patch b/SOURCES/bz1712263-fence_rhevm-1-use-UTF8-encoding.patch new file mode 100644 index 0000000..281e006 --- /dev/null +++ b/SOURCES/bz1712263-fence_rhevm-1-use-UTF8-encoding.patch @@ -0,0 +1,32 @@ +From a77165d7c8caadf514462d359c6d564048c2c33a Mon Sep 17 00:00:00 2001 +From: Sandro <42254081+Numblesix@users.noreply.github.com> +Date: Tue, 29 Jan 2019 13:29:52 +0100 +Subject: [PATCH] Changed Encoding to UTF-8 + +Starting from RHV/Ovirt 4.2 we saw issues with the agent(unable to fence) after switching to UTF-8 all worked again. +--- + agents/rhevm/fence_rhevm.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/agents/rhevm/fence_rhevm.py b/agents/rhevm/fence_rhevm.py +index 2a5107cc6..a1cdaf605 100644 +--- a/agents/rhevm/fence_rhevm.py ++++ b/agents/rhevm/fence_rhevm.py +@@ -88,7 +88,7 @@ def send_command(opt, command, method="GET"): + ## send command through pycurl + conn = pycurl.Curl() + web_buffer = io.BytesIO() +- conn.setopt(pycurl.URL, url.encode("ascii")) ++ conn.setopt(pycurl.URL, url.encode("UTF-8")) + conn.setopt(pycurl.HTTPHEADER, [ + "Version: 3", + "Content-type: application/xml", +@@ -128,7 +128,7 @@ def send_command(opt, command, method="GET"): + + opt["cookie"] = cookie + +- result = web_buffer.getvalue().decode() ++ result = web_buffer.getvalue().decode("UTF-8") + + logging.debug("%s\n", command) + logging.debug("%s\n", result) diff --git a/SOURCES/bz1712263-fence_rhevm-2-fix-debug-encoding-issues.patch b/SOURCES/bz1712263-fence_rhevm-2-fix-debug-encoding-issues.patch new file mode 100644 index 0000000..9603498 --- /dev/null +++ b/SOURCES/bz1712263-fence_rhevm-2-fix-debug-encoding-issues.patch @@ -0,0 +1,31 @@ +From 965924fe8bf7dcd0bc15fb0e9265ab49bb8a5dd8 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Mon, 20 May 2019 15:49:39 +0200 +Subject: [PATCH] fence_rhevm: fix debug encoding issues + +Tested with UTF-8 encoded comment in result, which caused this issue, +and added to command and url in case they are in UTF-8 decoded state. +--- + agents/rhevm/fence_rhevm.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/agents/rhevm/fence_rhevm.py b/agents/rhevm/fence_rhevm.py +index 6012c423..9e4650cd 100644 +--- a/agents/rhevm/fence_rhevm.py ++++ b/agents/rhevm/fence_rhevm.py +@@ -144,9 +144,9 @@ def send_command(opt, command, method="GET"): + + result = web_buffer.getvalue().decode("UTF-8") + +- logging.debug("url: %s\n", url) +- logging.debug("command: %s\n", command) +- logging.debug("result: %s\n", result) ++ logging.debug("url: %s\n", url.encode("UTF-8")) ++ logging.debug("command: %s\n", command.encode("UTF-8")) ++ logging.debug("result: %s\n", result.encode("UTF-8")) + + return result + +-- +2.21.0 + diff --git a/SOURCES/bz1714458-fence_scsi-node-id-new-format.patch b/SOURCES/bz1714458-fence_scsi-node-id-new-format.patch new file mode 100644 index 0000000..0364930 --- /dev/null +++ b/SOURCES/bz1714458-fence_scsi-node-id-new-format.patch @@ -0,0 +1,30 @@ +From 1c4a64ca803831b44c96c75022abe5bb8713cd1a Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Wed, 22 May 2019 10:13:34 +0200 +Subject: [PATCH] fence_scsi: detect node ID using new format, and fallback to + old format before failing + +--- + agents/scsi/fence_scsi.py | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py +index 8a1e4c77..5580e08b 100644 +--- a/agents/scsi/fence_scsi.py ++++ b/agents/scsi/fence_scsi.py +@@ -192,8 +192,14 @@ def get_cluster_id(options): + + def get_node_id(options): + cmd = options["--corosync-cmap-path"] + " nodelist" ++ out = run_cmd(options, cmd)["out"] ++ ++ match = re.search(r".(\d+).name \(str\) = " + options["--plug"] + "\n", out) ++ ++ # try old format before failing ++ if not match: ++ match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", out) + +- match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", run_cmd(options, cmd)["out"]) + return match.group(1) if match else fail_usage("Failed: unable to parse output of corosync-cmapctl or node does not exist") + + diff --git a/SOURCES/bz1714960-fence_scsi-node-id-new-format.patch b/SOURCES/bz1714960-fence_scsi-node-id-new-format.patch deleted file mode 100644 index 0364930..0000000 --- a/SOURCES/bz1714960-fence_scsi-node-id-new-format.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 1c4a64ca803831b44c96c75022abe5bb8713cd1a Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Wed, 22 May 2019 10:13:34 +0200 -Subject: [PATCH] fence_scsi: detect node ID using new format, and fallback to - old format before failing - ---- - agents/scsi/fence_scsi.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py -index 8a1e4c77..5580e08b 100644 ---- a/agents/scsi/fence_scsi.py -+++ b/agents/scsi/fence_scsi.py -@@ -192,8 +192,14 @@ def get_cluster_id(options): - - def get_node_id(options): - cmd = options["--corosync-cmap-path"] + " nodelist" -+ out = run_cmd(options, cmd)["out"] -+ -+ match = re.search(r".(\d+).name \(str\) = " + options["--plug"] + "\n", out) -+ -+ # try old format before failing -+ if not match: -+ match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", out) - -- match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", run_cmd(options, cmd)["out"]) - return match.group(1) if match else fail_usage("Failed: unable to parse output of corosync-cmapctl or node does not exist") - - diff --git a/SOURCES/bz1720198-fence_scsi-watchdog-fix-retry-failing-on-first-try.patch b/SOURCES/bz1720198-fence_scsi-watchdog-fix-retry-failing-on-first-try.patch new file mode 100644 index 0000000..010fc00 --- /dev/null +++ b/SOURCES/bz1720198-fence_scsi-watchdog-fix-retry-failing-on-first-try.patch @@ -0,0 +1,42 @@ +From 418b3a36c8a7de0e984a0cd4707f2b90f279c4ce Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 13 Jun 2019 11:29:25 +0200 +Subject: [PATCH] fence_scsi watchdog: dont exit when command fails using retry + parameter + +--- + lib/fencing.py.py | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/lib/fencing.py.py b/lib/fencing.py.py +index 8cd0a813..6f2526a9 100644 +--- a/lib/fencing.py.py ++++ b/lib/fencing.py.py +@@ -530,7 +530,7 @@ def fail_usage(message="", stop=True): + logging.error("Please use '-h' for usage\n") + sys.exit(EC_GENERIC_ERROR) + +-def fail(error_code): ++def fail(error_code, stop=True): + message = { + EC_LOGIN_DENIED : "Unable to connect/login to fencing device", + EC_CONNECTION_LOST : "Connection lost", +@@ -546,7 +546,8 @@ def fail(error_code): + + }[error_code] + "\n" + logging.error("%s\n", message) +- sys.exit(EC_GENERIC_ERROR) ++ if stop: ++ sys.exit(EC_GENERIC_ERROR) + + def usage(avail_opt): + print("Usage:") +@@ -1009,7 +1010,7 @@ def run_command(options, command, timeout=None, env=None, log_command=None): + thread.join(timeout) + if thread.is_alive(): + process.kill() +- fail(EC_TIMED_OUT) ++ fail(EC_TIMED_OUT, stop=(int(options.get("retry", 0)) < 1)) + + status = process.wait() + diff --git a/SOURCES/bz1732773-fence_vmware_rest-fix-keyerror-suspended-vms.patch b/SOURCES/bz1732773-fence_vmware_rest-fix-keyerror-suspended-vms.patch new file mode 100644 index 0000000..3c9af83 --- /dev/null +++ b/SOURCES/bz1732773-fence_vmware_rest-fix-keyerror-suspended-vms.patch @@ -0,0 +1,23 @@ +From 33a638ff624839d7fa2d409479c348abee57763e Mon Sep 17 00:00:00 2001 +From: dwannamaker-onr +Date: Tue, 25 Jun 2019 15:28:00 -0400 +Subject: [PATCH] Fixed issue with SUSPENDED VMs + +If any VMs in the vCenter are suspended, you get a KeyError because that state is not expected. This breaks list and monitor actions. +--- + agents/vmware_rest/fence_vmware_rest.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/agents/vmware_rest/fence_vmware_rest.py b/agents/vmware_rest/fence_vmware_rest.py +index b544d385..53b4066d 100644 +--- a/agents/vmware_rest/fence_vmware_rest.py ++++ b/agents/vmware_rest/fence_vmware_rest.py +@@ -8,7 +8,7 @@ + from fencing import * + from fencing import fail, run_delay, EC_LOGIN_DENIED, EC_STATUS + +-state = {"POWERED_ON": "on", 'POWERED_OFF': "off"} ++state = {"POWERED_ON": "on", 'POWERED_OFF': "off", 'SUSPENDED': "off"} + + def get_power_status(conn, options): + res = send_command(conn, "vcenter/vm?filter.names={}".format(options["--plug"]))["value"] diff --git a/SOURCES/bz1748443-fence_zvmip-python3-fixes.patch b/SOURCES/bz1748443-fence_zvmip-python3-fixes.patch new file mode 100644 index 0000000..90586aa --- /dev/null +++ b/SOURCES/bz1748443-fence_zvmip-python3-fixes.patch @@ -0,0 +1,43 @@ +From 2735a4ee096f87fda2e94029db7f059d7be28464 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 5 Sep 2019 10:28:18 +0200 +Subject: [PATCH] fence_zvmip: fix Python 3 issues + +--- + agents/zvm/fence_zvmip.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/agents/zvm/fence_zvmip.py b/agents/zvm/fence_zvmip.py +index 5fbe53e4..e6bb01d1 100644 +--- a/agents/zvm/fence_zvmip.py ++++ b/agents/zvm/fence_zvmip.py +@@ -37,7 +37,7 @@ def open_socket(options): + return conn + + def smapi_pack_string(string): +- return struct.pack("!i%ds" % (len(string)), len(string), string) ++ return struct.pack("!i%ds" % (len(string)), len(string), string.encode("UTF-8")) + + def prepare_smapi_command(options, smapi_function, additional_args): + packet_size = 3*INT4 + len(smapi_function) + len(options["--username"]) + len(options["--password"]) +@@ -126,7 +126,7 @@ def get_list_of_images(options, command, data_as_plug): + data = "" + + while True: +- read_data = conn.recv(1024, socket.MSG_WAITALL) ++ read_data = conn.recv(1024, socket.MSG_WAITALL).decode("UTF-8") + data += read_data + if array_len == len(data): + break +@@ -136,9 +136,9 @@ def get_list_of_images(options, command, data_as_plug): + + parsed_len = 0 + while parsed_len < array_len: +- string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4])[0] ++ string_len = struct.unpack("!i", data[parsed_len:parsed_len+INT4].encode("UTF-8"))[0] + parsed_len += INT4 +- image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len])[0] ++ image_name = struct.unpack("!%ds" % (string_len), data[parsed_len:parsed_len+string_len].encode("UTF-8"))[0].decode("UTF-8") + parsed_len += string_len + images.add(image_name) + diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index 8cac307..a5fba32 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -29,7 +29,7 @@ Name: fence-agents Summary: Set of unified programs capable of host isolation ("fencing") Version: 4.2.1 -Release: 17%{?alphatag:.%{alphatag}}%{?dist}.3 +Release: 30%{?alphatag:.%{alphatag}}%{?dist} License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -64,11 +64,19 @@ Patch22: bz1654973-fence_vmware_soap-cleanup-sigterm.patch Patch23: bz1650214-fence_azure_arm-bundled.patch Patch24: bz1666914-1-fence_redfish.patch Patch25: bz1666914-2-fence_redfish-fail-invalid-cert.patch -Patch26: bz1710055-1-fence_redfish-use-ipport-parameter.patch -Patch27: bz1710055-2-fence_redfish-ip-parameter-backward-compatibility.patch -Patch28: bz1710066-fence_gce-fix-python3-encoding-issue.patch -Patch29: bz1710486-fence_azure_arm-skip_shutdown.patch -Patch30: bz1714960-fence_scsi-node-id-new-format.patch +Patch26: bz1677327-1-fence_redfish-use-ipport-parameter.patch +Patch27: bz1677327-2-fence_redfish-ip-parameter-backward-compatibility.patch +Patch28: bz1696584-fence_gce-fix-python3-encoding-issue.patch +Patch29: bz1709926-fence_mpath-fix-watchdog-hardreboot.patch +Patch30: bz1709780-fence_rhevm-RHEV-v4-API-support.patch +Patch31: bz1712263-fence_rhevm-1-use-UTF8-encoding.patch +Patch32: bz1712263-fence_rhevm-2-fix-debug-encoding-issues.patch +Patch33: bz1700546-fence_azure_arm-skip_shutdown.patch +Patch34: bz1704228-fence_redfish-full-redfish-spec-compliance.patch +Patch35: bz1714458-fence_scsi-node-id-new-format.patch +Patch36: bz1720198-fence_scsi-watchdog-fix-retry-failing-on-first-try.patch +Patch37: bz1732773-fence_vmware_rest-fix-keyerror-suspended-vms.patch +Patch38: bz1748443-fence_zvmip-python3-fixes.patch %if 0%{?fedora} || 0%{?rhel} > 7 %global supportedagents amt_ws apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp emerson eps evacuate hpblade ibmblade ifmib ilo ilo_moonshot ilo_mp ilo_ssh intelmodular ipdu ipmilan mpath kdump redfish rhevm rsa rsb sbd scsi vmware_rest vmware_soap wti @@ -176,7 +184,15 @@ BuildRequires: python3-google-api-client %patch27 -p1 %patch28 -p1 %patch29 -p1 -%patch30 -p1 +%patch30 -p1 -F2 +%patch31 -p1 -F2 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 -F1 +%patch37 -p1 +%patch38 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -417,7 +433,7 @@ License: GPLv2+ and LGPLv2+ Group: System Environment/Base Summary: Fence agent for Azure Resource Manager Requires: fence-agents-common >= %{version}-%{release} -Requires: python3-azure-sdk >= 4.0.0 +Requires: python3-azure-sdk >= 4.0.0-9 BuildArch: noarch Obsoletes: fence-agents %description azure-arm @@ -779,6 +795,7 @@ Fence agent for SCSI persistent reservation over Device Mapper Multipath. %files mpath %{_sbindir}/fence_mpath +%{_datadir}/cluster/fence_mpath_check* %{_mandir}/man8/fence_mpath.8* %package redfish @@ -935,21 +952,53 @@ Fence agent for IBM z/VM over IP. %endif %changelog -* Wed May 29 2019 Oyvind Albrigtsen - 4.2.1-17.3 +* Fri Sep 6 2019 Oyvind Albrigtsen - 4.2.1-30 +- fence_zvmip: fix Python 3 issues + Resolves: rhbz#1748443 + +* Thu Jul 25 2019 Oyvind Albrigtsen - 4.2.1-29 +- fence_vmware_rest: fix KeyError issue for suspended VMs + Resolves: rhbz#1732773 + +* Wed Jul 24 2019 Oyvind Albrigtsen - 4.2.1-28 +- fence_mpath: fix watchdog hardreboot + Resolves: rhbz#1709926 + +* Thu Jun 13 2019 Oyvind Albrigtsen - 4.2.1-27 +- fence_scsi watchdog: fix failing on first try when using retry + Resolves: rhbz#1720198 + +* Tue May 28 2019 Oyvind Albrigtsen - 4.2.1-25 +- fence_redfish: add header for full Redfish spec compliance + Resolves: rhbz#1704228 - fence_scsi: fix to match new node ID format - Resolves: rhbz#1714960 + Resolves: rhbz#1714458 -* Thu May 16 2019 Oyvind Albrigtsen - 4.2.1-17.2 +* Thu May 23 2019 Oyvind Albrigtsen - 4.2.1-24 - fence_azure_arm: use skip_shutdown feature - Resolves: rhbz#1710486 + Resolves: rhbz#1700546 -* Wed May 15 2019 Oyvind Albrigtsen - 4.2.1-17.1 +* Tue May 21 2019 Oyvind Albrigtsen - 4.2.1-23 +- fence_rhevm: add RHEV v4 API support and auto-detection + Resolves: rhbz#1709780 +- fence_rhevm: fix encoding issues + Resolves: rhbz#1712263 + +* Fri Apr 5 2019 Oyvind Albrigtsen - 4.2.1-22 - fence_gce: fix Python 3 encoding issue - Resolves: rhbz#1710066 + Resolves: rhbz#1696584 + +* Mon Apr 1 2019 Oyvind Albrigtsen - 4.2.1-21 +- Add CI gating tests + Resolves: rhbz#1682125 + +* Fri Mar 22 2019 Oyvind Albrigtsen - 4.2.1-20 - fence_aliyun: upgrade python-aliyun-sdk-core to fix httplib issue - Resolves: rhbz#1710056 + Resolves: rhbz#1677945 + +* Tue Mar 19 2019 Oyvind Albrigtsen - 4.2.1-18 - fence_redfish: use ipport parameter - Resolves: rhbz#1710055 + Resolves: rhbz#1677327 * Fri Feb 8 2019 Oyvind Albrigtsen - 4.2.1-17 - fence-agents-vmware-soap: add missing python3-requests dependency