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

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