1 Star 0 Fork 16

bixiaoyan/fence-agents

forked from src-openEuler/fence-agents 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fence_mpath-fix-0x-format-patch-causing-unfencing-is.patch 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
From 99c5c3289b23064441f998949808a0b3569c2e3b Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Thu, 10 Oct 2024 09:55:16 +0200
Subject: [PATCH 08/10] fence_mpath: fix 0x-format patch causing unfencing
issue, and use re.MULTILINE to avoid duplicating device dev/key lines in
/run/cluster/mpath.devices
---
agents/mpath/fence_mpath.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/agents/mpath/fence_mpath.py b/agents/mpath/fence_mpath.py
index 2d860149..2a4a58b3 100644
--- a/agents/mpath/fence_mpath.py
+++ b/agents/mpath/fence_mpath.py
@@ -40,7 +40,7 @@ def set_status(conn, options):
if options["--plug"] not in get_registration_keys(options, dev):
count += 1
logging.debug("Failed to register key "\
- + options["--plug"] + "on device " + dev + "\n")
+ + options["--plug"] + " on device " + dev + "\n")
continue
dev_write(options, dev)
@@ -147,8 +147,9 @@ def dev_write(options, dev):
store_fh = open(file_path, "a+")
except IOError:
fail_usage("Failed: Cannot open file \""+ file_path + "\"")
+ store_fh.seek(0)
out = store_fh.read()
- if not re.search(r"^" + dev + r"\s+", out):
+ if not re.search(r"^{}\s+{}$".format(dev, options["--plug"]), out, flags=re.MULTILINE):
store_fh.write(dev + "\t" + options["--plug"] + "\n")
store_fh.close()
@@ -332,7 +333,7 @@ failing."
fail_usage("Failed: No devices found")
options["devices"] = [d for d in re.split(r"\s*,\s*|\s+", options["--devices"].strip()) if d]
- options["--plug"] = re.sub(r"^0x0*|^0+", "", options["--plug"])
+ options["--plug"] = re.sub(r"^0x0*|^0+", "", options.get("--plug", ""))
# Input control END
result = fence_action(None, options, set_status, get_status)
--
2.33.1.windows.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bixiaoyan1/fence-agents.git
git@gitee.com:bixiaoyan1/fence-agents.git
bixiaoyan1
fence-agents
fence-agents
master

搜索帮助