Blame SOURCES/bz1714458-fence_scsi-node-id-new-format.patch

21d5fd
From 1c4a64ca803831b44c96c75022abe5bb8713cd1a Mon Sep 17 00:00:00 2001
21d5fd
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
21d5fd
Date: Wed, 22 May 2019 10:13:34 +0200
21d5fd
Subject: [PATCH] fence_scsi: detect node ID using new format, and fallback to
21d5fd
 old format before failing
21d5fd
21d5fd
---
21d5fd
 agents/scsi/fence_scsi.py | 8 +++++++-
21d5fd
 1 file changed, 7 insertions(+), 1 deletion(-)
21d5fd
21d5fd
diff --git a/agents/scsi/fence_scsi.py b/agents/scsi/fence_scsi.py
21d5fd
index 8a1e4c77..5580e08b 100644
21d5fd
--- a/agents/scsi/fence_scsi.py
21d5fd
+++ b/agents/scsi/fence_scsi.py
21d5fd
@@ -192,8 +192,14 @@ def get_cluster_id(options):
21d5fd
 
21d5fd
 def get_node_id(options):
21d5fd
 	cmd = options["--corosync-cmap-path"] + " nodelist"
21d5fd
+	out = run_cmd(options, cmd)["out"]
21d5fd
+
21d5fd
+	match = re.search(r".(\d+).name \(str\) = " + options["--plug"] + "\n", out)
21d5fd
+
21d5fd
+	# try old format before failing
21d5fd
+	if not match:
21d5fd
+		match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", out)
21d5fd
 
21d5fd
-	match = re.search(r".(\d+).ring._addr \(str\) = " + options["--plug"] + "\n", run_cmd(options, cmd)["out"])
21d5fd
 	return match.group(1) if match else fail_usage("Failed: unable to parse output of corosync-cmapctl or node does not exist")
21d5fd
 
21d5fd