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

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