Compare commits
No commits in common. 'c9' and 'cs10' have entirely different histories.
@ -1,144 +0,0 @@
|
||||
From 7a2ea3c95c99b0f3eacc99816c9aa6febfad6c5e Mon Sep 17 00:00:00 2001
|
||||
From: Miroslav Lisik <mlisik@redhat.com>
|
||||
Date: Thu, 17 Oct 2024 17:04:37 +0200
|
||||
Subject: [PATCH] fix `pcs dr status`
|
||||
|
||||
* add command status.full_cluster_status_plaintext to the API_V1_MAP
|
||||
* fix ClusterStatusLegacyHandler
|
||||
* fix `pcs cluster node add-outside`
|
||||
* fix ClusterAddNodesLegacyHandler
|
||||
---
|
||||
pcs/common/reports/messages.py | 17 +++++++----------
|
||||
pcs/daemon/app/api_v1.py | 5 +++--
|
||||
pcs_test/smoke.sh.in | 14 +++++++-------
|
||||
pcsd/capabilities.xml.in | 7 +++++++
|
||||
4 files changed, 24 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/pcs/common/reports/messages.py b/pcs/common/reports/messages.py
|
||||
index ccf32a03..9a1543e1 100644
|
||||
--- a/pcs/common/reports/messages.py
|
||||
+++ b/pcs/common/reports/messages.py
|
||||
@@ -260,7 +260,7 @@ def _stonith_watchdog_timeout_reason_to_str(
|
||||
}.get(reason, reason)
|
||||
|
||||
|
||||
-@dataclass(frozen=True, init=False)
|
||||
+@dataclass(frozen=True)
|
||||
class LegacyCommonMessage(ReportItemMessage):
|
||||
"""
|
||||
This class is used for legacy report transport protocol from
|
||||
@@ -268,22 +268,19 @@ class LegacyCommonMessage(ReportItemMessage):
|
||||
should be replaced with transporting DTOs of reports in the future.
|
||||
"""
|
||||
|
||||
- def __init__(
|
||||
- self, code: types.MessageCode, info: Mapping[str, Any], message: str
|
||||
- ) -> None:
|
||||
- self.__code = code
|
||||
- self.info = info
|
||||
- self._message = message
|
||||
+ legacy_code: types.MessageCode
|
||||
+ legacy_info: Mapping[str, Any]
|
||||
+ legacy_message: str
|
||||
|
||||
@property
|
||||
def message(self) -> str:
|
||||
- return self._message
|
||||
+ return self.legacy_message
|
||||
|
||||
def to_dto(self) -> ReportItemMessageDto:
|
||||
return ReportItemMessageDto(
|
||||
- code=self.__code,
|
||||
+ code=self.legacy_code,
|
||||
message=self.message,
|
||||
- payload=dict(self.info),
|
||||
+ payload=dict(self.legacy_info),
|
||||
)
|
||||
|
||||
|
||||
diff --git a/pcs/daemon/app/api_v1.py b/pcs/daemon/app/api_v1.py
|
||||
index 8e8b8804..5babad1d 100644
|
||||
--- a/pcs/daemon/app/api_v1.py
|
||||
+++ b/pcs/daemon/app/api_v1.py
|
||||
@@ -101,6 +101,7 @@ API_V1_MAP: Mapping[str, str] = {
|
||||
"sbd-enable-sbd/v1": "sbd.enable_sbd",
|
||||
"scsi-unfence-node/v2": "scsi.unfence_node",
|
||||
"scsi-unfence-node-mpath/v1": "scsi.unfence_node_mpath",
|
||||
+ "status-full-cluster-status-plaintext/v1": "status.full_cluster_status_plaintext",
|
||||
# deprecated, use resource-agent-get-agent-metadata/v1 instead
|
||||
"stonith-agent-describe-agent/v1": "stonith_agent.describe_agent",
|
||||
# deprecated, use resource-agent-get-agents-list/v1 instead
|
||||
@@ -301,13 +302,13 @@ class LegacyApiV1Handler(_BaseApiV1Handler):
|
||||
class ClusterStatusLegacyHandler(LegacyApiV1Handler):
|
||||
@staticmethod
|
||||
def _get_cmd() -> str:
|
||||
- return "status.full_cluster_status_plaintext"
|
||||
+ return "status-full-cluster-status-plaintext/v1"
|
||||
|
||||
|
||||
class ClusterAddNodesLegacyHandler(LegacyApiV1Handler):
|
||||
@staticmethod
|
||||
def _get_cmd() -> str:
|
||||
- return "cluster.add_nodes"
|
||||
+ return "cluster-add-nodes/v1"
|
||||
|
||||
|
||||
def get_routes(scheduler: Scheduler, auth_provider: AuthProvider) -> RoutesType:
|
||||
diff --git a/pcs_test/smoke.sh.in b/pcs_test/smoke.sh.in
|
||||
index a4b3ac71..bfbb427e 100755
|
||||
--- a/pcs_test/smoke.sh.in
|
||||
+++ b/pcs_test/smoke.sh.in
|
||||
@@ -23,12 +23,6 @@ output_file=$(mktemp)
|
||||
token_file=$(mktemp)
|
||||
cookie_file=$(mktemp)
|
||||
|
||||
-# Sanity check of API V0
|
||||
-token=$(python3 -c "import json; print(json.load(open('@LOCALSTATEDIR@/lib/pcsd/known-hosts'))['known_hosts']['localhost']['token']);")
|
||||
-curl -kb "token=${token}" https://localhost:2224/remote/cluster_status_plaintext -d 'data_json={}' > "${output_file}"
|
||||
-cat "${output_file}"; echo ""
|
||||
-python3 -c "import json; import sys; json.load(open('${output_file}'))['status'] == 'exception' and (sys.exit(1))";
|
||||
-
|
||||
dd if=/dev/urandom bs=32 count=1 status=none | base64 > "${token_file}"
|
||||
custom_localhost_node_name="custom-node-name"
|
||||
|
||||
@@ -71,6 +65,12 @@ curl --insecure --cookie ${cookie_file} --header "X-Requested-With: XMLHttpReque
|
||||
cat "${output_file}"; echo ""
|
||||
[ "$(cat ${output_file})" = "Update Successful" ]
|
||||
|
||||
+# Sanity check of API V0
|
||||
+token=$(python3 -c "import json; print(json.load(open('@LOCALSTATEDIR@/lib/pcsd/known-hosts'))['known_hosts']['localhost']['token']);")
|
||||
+curl -kb "token=${token}" https://localhost:2224/remote/cluster_status_plaintext -d 'data_json={}' > "${output_file}"
|
||||
+cat "${output_file}"; echo ""
|
||||
+python3 -c "import json; import sys; json.load(open('${output_file}'))['status'] != 'success' and (sys.exit(1))";
|
||||
+
|
||||
# Sanity check of API V1
|
||||
curl -kb "token=${token}" https://localhost:2224/api/v1/resource-agent-get-agents-list/v1 --data '{}' > "${output_file}"
|
||||
cat "${output_file}"; echo ""
|
||||
@@ -98,5 +98,5 @@ rm "${output_file}"
|
||||
rm "${cookie_file}"
|
||||
rm "${pcsd_settings_conf_path}"
|
||||
pcs cluster destroy --force
|
||||
-userdel -r testuser
|
||||
+userdel -rf testuser
|
||||
exit 0
|
||||
diff --git a/pcsd/capabilities.xml.in b/pcsd/capabilities.xml.in
|
||||
index 99d5af3f..b9c28560 100644
|
||||
--- a/pcsd/capabilities.xml.in
|
||||
+++ b/pcsd/capabilities.xml.in
|
||||
@@ -2661,6 +2661,13 @@
|
||||
daemon urls: pacemaker_node_status
|
||||
</description>
|
||||
</capability>
|
||||
+ <capability id="status.pcmk.full-cluster-status-plaintext" in-pcs="0" in-pcsd="1">
|
||||
+ <description>
|
||||
+ Display status of the remote site cluster.
|
||||
+
|
||||
+ daemon urls: /api/v1/status-full-cluster-status-plaintext/v1
|
||||
+ </description>
|
||||
+ </capability>
|
||||
<capability id="status.pcmk.query.resource" in-pcs="1" in-pcsd="0">
|
||||
<description>
|
||||
Query status of resources.
|
||||
--
|
||||
2.47.0
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue