7 Star 1 Fork 17

src-openEuler/pcs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-make-url-remove_resource-usable-for-stonith-again.patch 1.74 KB
一键复制 编辑 原始数据 按行查看 历史
From a1bae66aba35a6155e3c22524abb40c7923ca4ca Mon Sep 17 00:00:00 2001
From: Ivan Devat <[email protected]>
Date: Tue, 27 Aug 2024 16:56:21 +0200
Subject: [PATCH 048/100] make url /remove_resource usable for stonith again
The internal separation of resources and stonith caused that the url
`/managec/cluster-name/remove_resource` is refusing to work with
stonith (the handler calls CLI commands that now refuses to work with
stonith). Because there is no alternative for this task, the handler is
fixed to accept stonith but only with explicit `is-stonith` parameter.
---
pcsd/remote.rb | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/pcsd/remote.rb b/pcsd/remote.rb
index 93212321..5ade6ec5 100644
--- a/pcsd/remote.rb
+++ b/pcsd/remote.rb
@@ -1018,6 +1018,13 @@ def remove_resource(params, request, auth_user)
end
}
tmp_file = nil
+
+ resource_or_stonith = if params["is-stonith"] == "true" then
+ "stonith"
+ else
+ "resource"
+ end
+
if force
resource_to_remove = resource_list
else
@@ -1027,7 +1034,8 @@ def remove_resource(params, request, auth_user)
if retval != 0
return [400, 'Unable to stop resource(s).']
end
- cmd = [PCS, '-f', tmp_file.path, '--', 'resource', 'disable']
+
+ cmd = [PCS, '-f', tmp_file.path, '--', resource_or_stonith, 'disable']
resource_list.each { |resource|
out, err, retval = run_cmd(user, *(cmd + [resource]))
if retval != 0
@@ -1061,7 +1069,7 @@ def remove_resource(params, request, auth_user)
end
end
resource_to_remove.each { |resource|
- cmd = ['resource', 'delete', resource]
+ cmd = [resource_or_stonith, 'delete', resource]
flags = []
if force
flags << '--force'
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/pcs.git
[email protected]:src-openeuler/pcs.git
src-openeuler
pcs
pcs
master

搜索帮助