代码拉取完成,页面将自动刷新
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。