diff --git a/SOURCES/bz1213571-fence_scsi-add_monitor.patch b/SOURCES/bz1213571-fence_scsi-add_monitor.patch new file mode 100644 index 0000000..2735e18 --- /dev/null +++ b/SOURCES/bz1213571-fence_scsi-add_monitor.patch @@ -0,0 +1,49 @@ +From d452969b172da23604d58e14a7b60d19f87967df Mon Sep 17 00:00:00 2001 +From: Marek 'marx' Grac +Date: Wed, 17 Jun 2015 19:34:53 +0200 +Subject: [PATCH 02/10] fence_scsi: Add support for monitor action + +Resolves: rhbz#1196068 +--- + fence/agents/scsi/fence_scsi.py | 18 ++++++++++++++++++ + 1 file changed, 18 insertions(+) + +diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py +index 3a899d1..de301a5 100644 +--- a/fence/agents/scsi/fence_scsi.py ++++ b/fence/agents/scsi/fence_scsi.py +@@ -83,6 +83,21 @@ def set_status(conn, options): + sys.exit(1) + + ++# check if host is ready to execute actions ++def do_action_monitor(options): ++ if bool(run_cmd(options, options["--sg_persist-path"] + " -V")["err"]): ++ logging.error("Unable to run " + options["--sg_persist-path"]) ++ return 1 ++ elif bool(run_cmd(options, options["--sg_turs-path"] + " -V")["err"]): ++ logging.error("Unable to run " + options["--sg_turs-path"]) ++ return 1 ++ elif ("--devices" not in options and ++ bool(run_cmd(options, options["--vgs-path"] + " --version")["err"])): ++ logging.error("Unable to run " + options["--vgs-path"]) ++ return 1 ++ return 0 ++ ++ + #run command, returns dict, ret["err"] = exit code; ret["out"] = output + def run_cmd(options, cmd): + ret = {} +@@ -423,6 +438,9 @@ longer be able to write to the device(s). A manual reboot is required." + options["store_path"] = STORE_PATH + + # Input control BEGIN ++ if options["--action"] == "monitor": ++ sys.exit(do_action_monitor(options)) ++ + if not (("--nodename" in options and options["--nodename"])\ + or ("--key" in options and options["--key"])): + fail_usage("Failed: nodename or key is required") +-- +1.9.3 + diff --git a/SOURCES/bz1243485-1-fence_scsi-force-on.patch b/SOURCES/bz1243485-1-fence_scsi-force-on.patch new file mode 100644 index 0000000..40d54b4 --- /dev/null +++ b/SOURCES/bz1243485-1-fence_scsi-force-on.patch @@ -0,0 +1,57 @@ +From 2a2aa2d03bc456ce1fa869fa54398c89956e409a Mon Sep 17 00:00:00 2001 +From: Marek 'marx' Grac +Date: Thu, 16 Jul 2015 09:26:32 +0200 +Subject: [PATCH 1/2] fencing: Add option that forces ON even if machine is + already ON + +This feature is required for fence_scsi when we have to do unfencing after reboot even +if node was not fenced at all. Keys for SCSI are stored in /var/run/cluster and so they +have to re-created. +--- + fence/agents/lib/fencing.py.py | 9 +++++++-- + fence/agents/scsi/fence_scsi.py | 2 +- + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py +index 2ba98b8..377c63f 100644 +--- a/fence/agents/lib/fencing.py.py ++++ b/fence/agents/lib/fencing.py.py +@@ -82,6 +82,10 @@ all_opt = { + "getopt" : "", + "help" : "", + "order" : 1}, ++ "force_on" : { ++ "getopt" : "", ++ "help" : "", ++ "order" : 1}, + "action" : { + "getopt" : "o:", + "longopt" : "action", +@@ -949,8 +953,9 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None, + fail(EC_STATUS) + + if options["--action"] == status: +- print "Success: Already %s" % (status.upper()) +- return 0 ++ if not (status == "on" and "force_on" in options["device_opt"]): ++ print "Success: Already %s" % (status.upper()) ++ return 0 + + if options["--action"] == "on": + if set_multi_power_fn(tn, options, set_power_fn, get_power_fn, 1 + int(options["--retry-on"])): +diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py +index f373e6b..445c5f8 100644 +--- a/fence/agents/scsi/fence_scsi.py ++++ b/fence/agents/scsi/fence_scsi.py +@@ -396,7 +396,7 @@ def main(): + + device_opt = ["no_login", "no_password", "devices", "nodename", "key",\ + "aptpl", "fabric_fencing", "on_target", "corosync-cmap_path",\ +- "sg_persist_path", "sg_turs_path", "logfile", "vgs_path"] ++ "sg_persist_path", "sg_turs_path", "logfile", "vgs_path", "force_on"] + + define_new_opts() + +-- +1.9.3 + diff --git a/SOURCES/bz1243485-2-fence_scsi-monitor.patch b/SOURCES/bz1243485-2-fence_scsi-monitor.patch new file mode 100644 index 0000000..f7ad1e2 --- /dev/null +++ b/SOURCES/bz1243485-2-fence_scsi-monitor.patch @@ -0,0 +1,37 @@ +From 4a095f8d70ef90a50ed59917cca6874a3db1a433 Mon Sep 17 00:00:00 2001 +From: Marek 'marx' Grac +Date: Thu, 16 Jul 2015 09:28:15 +0200 +Subject: [PATCH 2/2] fence_scsi: Monitor action checks also existence of files + with SCSI keys + +--- + fence/agents/scsi/fence_scsi.py | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py +index 445c5f8..7e7bc0d 100644 +--- a/fence/agents/scsi/fence_scsi.py ++++ b/fence/agents/scsi/fence_scsi.py +@@ -88,6 +88,7 @@ def set_status(conn, options): + + # check if host is ready to execute actions + def do_action_monitor(options): ++ # Check if required binaries are installed + if bool(run_cmd(options, options["--sg_persist-path"] + " -V")["err"]): + logging.error("Unable to run " + options["--sg_persist-path"]) + return 1 +@@ -98,6 +99,11 @@ def do_action_monitor(options): + bool(run_cmd(options, options["--vgs-path"] + " --version")["err"])): + logging.error("Unable to run " + options["--vgs-path"]) + return 1 ++ ++ # Keys have to be present in order to fence/unfence ++ get_key() ++ dev_read() ++ + return 0 + + +-- +1.9.3 + diff --git a/SOURCES/bz1243485-3-fence_scsi_check.patch b/SOURCES/bz1243485-3-fence_scsi_check.patch new file mode 100644 index 0000000..9664609 --- /dev/null +++ b/SOURCES/bz1243485-3-fence_scsi_check.patch @@ -0,0 +1,67 @@ +From 5bc23bc764326a8ea2a5ffffbe1e9bea9a32b868 Mon Sep 17 00:00:00 2001 +From: Marek 'marx' Grac +Date: Mon, 17 Aug 2015 10:46:25 +0200 +Subject: [PATCH] fence_scsi: Watchdog script should pass on a system that is + not configured + +--- + fence/agents/scsi/fence_scsi.py | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/fence/agents/scsi/fence_scsi.py b/fence/agents/scsi/fence_scsi.py +index 7e7bc0d..e18e473 100644 +--- a/fence/agents/scsi/fence_scsi.py ++++ b/fence/agents/scsi/fence_scsi.py +@@ -205,12 +205,15 @@ def set_key(options): + + + # read node key from file +-def get_key(): ++def get_key(fail=True): + file_path = STORE_PATH + ".key" + try: + f = open(file_path, "r") + except IOError: +- fail_usage("Failed: Cannot open file \""+ file_path + "\"") ++ if fail: ++ fail_usage("Failed: Cannot open file \""+ file_path + "\"") ++ else: ++ return None + return f.readline().strip().lower() + + +@@ -228,12 +231,15 @@ def dev_write(dev, options): + f.close() + + +-def dev_read(): ++def dev_read(fail=True): + file_path = STORE_PATH + ".dev" + try: + f = open(file_path, "r") + except IOError: +- fail_usage("Failed: Cannot open file \"" + file_path + "\"") ++ if fail: ++ fail_usage("Failed: Cannot open file \"" + file_path + "\"") ++ else: ++ return None + # get not empty lines from file + devs = [line.strip() for line in f if line.strip()] + f.close() +@@ -378,11 +384,11 @@ def scsi_check(): + options["--power-timeout"] = "5" + if scsi_check_get_verbose(): + logging.getLogger().setLevel(logging.DEBUG) +- devs = dev_read() ++ devs = dev_read(fail=False) + if not devs: + logging.error("No devices found") + return 0 +- key = get_key() ++ key = get_key(fail=False) + if not key: + logging.error("Key not found") + return 0 +-- +1.9.3 + diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index ae630c5..ade5367 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -16,7 +16,7 @@ Name: fence-agents Summary: Fence Agents for Red Hat Cluster Version: 4.0.11 -Release: 13%{?alphatag:.%{alphatag}}%{?dist}.1 +Release: 13%{?alphatag:.%{alphatag}}%{?dist}.2 License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: http://sourceware.org/cluster/wiki/ @@ -49,6 +49,10 @@ Patch24: bz1214359-3-fence_compute.patch Patch25: bz1214359-4-fence_compute.patch Patch26: bz1214359-5-fence_compute.patch Patch27: bz1214359-6-fence_compute.patch +Patch28: bz1213571-fence_scsi-add_monitor.patch +Patch29: bz1243485-1-fence_scsi-force-on.patch +Patch30: bz1243485-2-fence_scsi-monitor.patch +Patch31: bz1243485-3-fence_scsi_check.patch %if 0%{?rhel} %global supportedagents apc apc_snmp bladecenter brocade cisco_mds cisco_ucs compute drac5 eaton_snmp eps hpblade ibmblade ifmib ilo ilo_mp ilo_ssh intelmodular ipdu ipmilan kdump rhevm rsb scsi vmware_soap wti @@ -102,6 +106,10 @@ BuildRequires: autoconf automake libtool %patch25 -p1 -b .bz1214359-4 %patch26 -p1 -b .bz1214359-5 %patch27 -p1 -b .bz1214359-6 +%patch28 -p1 -b .bz1213571 +%patch29 -p1 -b .bz1243485-1 +%patch30 -p1 -b .bz1243485-2 +%patch31 -p1 -b .bz1243485-3 %build ./autogen.sh @@ -629,6 +637,10 @@ The fence-agents-zvm package contains a fence agent for z/VM hypervisors %endif %changelog +* Wed Sep 02 2015 Marek Grac - 4.0.11-13.2 +- fence_scsi loses keys after reboot + Resolves: rhbz#1258481 + * Wed Jul 15 2015 Marek Grac - 4.0.11-13.1 - fence_compute: add support for recoding fencing operations in attrd Resolves: rhbz#1243505