fence-agents/SOURCES/bz1714458-fence_scsi-node-id-new-format.patch

31 lines
1.1 KiB
Diff
Raw Normal View History

2021-05-14 04:12:18 +00:00
From 1c4a64ca803831b44c96c75022abe5bb8713cd1a Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
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")