From 3e406f28a2e29a029f3ea8b2bf59e2d17a86f74f Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Thu, 26 Dec 2024 03:31:56 +0300 Subject: [PATCH] import pcs-0.11.8-1.el9_5.1 --- SOURCES/RHEL-64934-01-fix-pcs-dr-status.patch | 144 ++++++++++++++++++ SPECS/pcs.spec | 8 +- 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 SOURCES/RHEL-64934-01-fix-pcs-dr-status.patch diff --git a/SOURCES/RHEL-64934-01-fix-pcs-dr-status.patch b/SOURCES/RHEL-64934-01-fix-pcs-dr-status.patch new file mode 100644 index 0000000..5aabca5 --- /dev/null +++ b/SOURCES/RHEL-64934-01-fix-pcs-dr-status.patch @@ -0,0 +1,144 @@ +From 7a2ea3c95c99b0f3eacc99816c9aa6febfad6c5e Mon Sep 17 00:00:00 2001 +From: Miroslav Lisik +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 + + ++ ++ ++ Display status of the remote site cluster. ++ ++ daemon urls: /api/v1/status-full-cluster-status-plaintext/v1 ++ ++ + + + Query status of resources. +-- +2.47.0 + diff --git a/SPECS/pcs.spec b/SPECS/pcs.spec index 776d8c1..e4ef1f5 100644 --- a/SPECS/pcs.spec +++ b/SPECS/pcs.spec @@ -1,6 +1,6 @@ Name: pcs Version: 0.11.8 -Release: 1%{?dist} +Release: 1%{?dist}.1 # https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/ # https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses # GPL-2.0-only: pcs @@ -109,6 +109,7 @@ Source101: https://github.com/ClusterLabs/pcs-web-ui/releases/download/%{ui_comm # pcs patches: <= 200 # Patch0: bzNUMBER-01-name.patch Patch0: do-not-support-cluster-setup-with-udp-u-transport.patch +Patch1: RHEL-64934-01-fix-pcs-dr-status.patch # ui patches: >200 # Patch201: bzNUMBER-01-name.patch @@ -305,6 +306,7 @@ update_times_patch(){ %autopatch -p1 -M 200 # update_times_patch %%{PATCH0} update_times_patch %{PATCH0} +update_times_patch %{PATCH1} # generate .tarball-version if building from an untagged commit, not a released version # autogen uses git-version-gen which uses .tarball-version for generating version number @@ -559,6 +561,10 @@ run_all_tests %license pyagentx_LICENSE.txt %changelog +* Thu Nov 14 2024 Miroslav Lisik - 0.11.8-1.el9_5.1 +- Fixed command `pcs dr status` + Resolves: RHEL-64934 + * Tue Jul 9 2024 Michal Pospisil - 0.11.8-1 - Updated pcs-web-ui to 0.1.20 - Rebased to the latest sources (see CHANGELOG.md)