diff --git a/SOURCES/RHEL-61165-podman-force-remove-container-if-necessary.patch b/SOURCES/RHEL-61165-podman-force-remove-container-if-necessary.patch new file mode 100644 index 0000000..fed67ca --- /dev/null +++ b/SOURCES/RHEL-61165-podman-force-remove-container-if-necessary.patch @@ -0,0 +1,43 @@ +From 2ab2c832180dacb2e66d38541beae0957416eb96 Mon Sep 17 00:00:00 2001 +From: Antonio Romito +Date: Mon, 9 Sep 2024 17:30:38 +0200 +Subject: [PATCH] Improve handling of "stopping" container removal in + remove_container() + +- Added handling for containers in a stopping state by checking the state and force-removing if necessary. +- Improved log messages to provide clearer information when force removal is needed. + +Related: https://issues.redhat.com/browse/RHEL-58008 +--- + heartbeat/podman | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/podman b/heartbeat/podman +index 53867bff20..643ec4d894 100755 +--- a/heartbeat/podman ++++ b/heartbeat/podman +@@ -254,6 +254,13 @@ remove_container() + ocf_run podman rm -v $CONTAINER + rc=$? + if [ $rc -ne 0 ]; then ++ if [ $rc -eq 2 ]; then ++ if podman inspect --format '{{.State.Status}}' $CONTAINER | grep -wq "stopping"; then ++ ocf_log err "Inactive container ${CONTAINER} is stuck in 'stopping' state. Force-remove it." ++ ocf_run podman rm -f $CONTAINER ++ rc=$? ++ fi ++ fi + # due to a podman bug (rhbz#1841485), sometimes a stopped + # container can still be associated with Exec sessions, in + # which case the "podman rm" has to be forced +@@ -517,8 +524,8 @@ podman_stop() + # but the associated container exit code is -1. If that's the case, + # assume there's no failure and continue with the rm as usual. + if [ $rc -eq 125 ] && \ +- podman inspect --format '{{.State.Status}}:{{.State.ExitCode}}' $CONTAINER | grep -wq "stopped:-1"; then +- ocf_log warn "Container ${CONTAINER} had an unexpected stop outcome. Trying to remove it anyway." ++ podman inspect --format '{{.State.Status}}:{{.State.ExitCode}}' $CONTAINER | grep -Eq '^(exited|stopped):-1$'; then ++ ocf_log err "Container ${CONTAINER} had an unexpected stop outcome. Trying to remove it anyway." + else + ocf_exit_reason "Failed to stop container, ${CONTAINER}, based on image, ${OCF_RESKEY_image}." + return $OCF_ERR_GENERIC diff --git a/SOURCES/RHEL-72960-1-openstack-cinder-volume-wait-for-volume-to-be-available.patch b/SOURCES/RHEL-72960-1-openstack-cinder-volume-wait-for-volume-to-be-available.patch new file mode 100644 index 0000000..5eb8beb --- /dev/null +++ b/SOURCES/RHEL-72960-1-openstack-cinder-volume-wait-for-volume-to-be-available.patch @@ -0,0 +1,63 @@ +From 71bc76dc4fa57726e80d0ddcc0bdcfe708af8763 Mon Sep 17 00:00:00 2001 +From: "Fabio M. Di Nitto" +Date: Thu, 5 Dec 2024 11:02:40 +0100 +Subject: [PATCH] openstack-cinder-volume: wait for volume to be available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +monitor the vol till it´s attached to the host and avoid a race between +openstack APIs receiving the request and completing the operation. + +Signed-off-by: Fabio M. Di Nitto +--- + heartbeat/openstack-cinder-volume | 29 ++++++++++++++++++----------- + 1 file changed, 18 insertions(+), 11 deletions(-) + +diff --git a/heartbeat/openstack-cinder-volume b/heartbeat/openstack-cinder-volume +index 116442c41b..2b64d4d887 100755 +--- a/heartbeat/openstack-cinder-volume ++++ b/heartbeat/openstack-cinder-volume +@@ -141,17 +141,19 @@ osvol_monitor() { + + node_id=$(_get_node_id) + +- if [ "$__OCF_ACTION" = "monitor" ] && ocf_is_true $OCF_RESKEY_volume_local_check ; then +- # +- # Is the volue attached? +- # We check the local devices +- # +- short_volume_id=$(echo $OCF_RESKEY_volume_id | awk '{print substr($0, 0, 20)}') +- if lsblk /dev/disk/by-id/virtio-$short_volume_id 1>/dev/null 2>&1; then +- return $OCF_SUCCESS +- else +- ocf_log warn "$OCF_RESKEY_volume_id is not attached to instance $node_id" +- return $OCF_NOT_RUNNING ++ if ocf_is_true $OCF_RESKEY_volume_local_check ; then ++ if [ "$__OCF_ACTION" = "monitor" ] || [ "$__OCF_ACTION" = "start" ] ; then ++ # ++ # Is the volue attached? ++ # We check the local devices ++ # ++ short_volume_id=$(echo $OCF_RESKEY_volume_id | awk '{print substr($0, 0, 20)}') ++ if lsblk /dev/disk/by-id/virtio-$short_volume_id 1>/dev/null 2>&1; then ++ return $OCF_SUCCESS ++ else ++ ocf_log warn "$OCF_RESKEY_volume_id is not attached to instance $node_id" ++ return $OCF_NOT_RUNNING ++ fi + fi + fi + +@@ -247,6 +249,11 @@ osvol_start() { + return $OCF_ERR_GENERIC + fi + ++ while ! osvol_monitor; do ++ ocf_log info "Waiting for cinder volume $OCF_RESKEY_volume_id to appear on $node_id" ++ sleep 1 ++ done ++ + return $OCF_SUCCESS + } + diff --git a/SOURCES/RHEL-72960-2-openstack-cinder-volume-fix-detach-not-working-during-start-action.patch b/SOURCES/RHEL-72960-2-openstack-cinder-volume-fix-detach-not-working-during-start-action.patch new file mode 100644 index 0000000..079359b --- /dev/null +++ b/SOURCES/RHEL-72960-2-openstack-cinder-volume-fix-detach-not-working-during-start-action.patch @@ -0,0 +1,44 @@ +From d89b3fb29033c3a60eb0896033af5981c7b9f64a Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Fri, 10 Jan 2025 11:39:48 +0100 +Subject: [PATCH] openstack-cinder-volume: fix detach not working during + start-action after #2000 + +--- + heartbeat/openstack-cinder-volume | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/openstack-cinder-volume b/heartbeat/openstack-cinder-volume +index 2b64d4d88..5bb1acddd 100755 +--- a/heartbeat/openstack-cinder-volume ++++ b/heartbeat/openstack-cinder-volume +@@ -142,9 +142,9 @@ osvol_monitor() { + node_id=$(_get_node_id) + + if ocf_is_true $OCF_RESKEY_volume_local_check ; then +- if [ "$__OCF_ACTION" = "monitor" ] || [ "$__OCF_ACTION" = "start" ] ; then ++ if [ "$__OCF_ACTION" = "monitor" ] || [ "$1" = "quick" ]; then + # +- # Is the volue attached? ++ # Is the volume attached? + # We check the local devices + # + short_volume_id=$(echo $OCF_RESKEY_volume_id | awk '{print substr($0, 0, 20)}') +@@ -158,7 +158,7 @@ osvol_monitor() { + fi + + # +- # Is the volue attached? ++ # Is the volume attached? + # We use the API + # + result=$(run_openstackcli "volume show \ +@@ -249,7 +249,7 @@ osvol_start() { + return $OCF_ERR_GENERIC + fi + +- while ! osvol_monitor; do ++ while ! osvol_monitor quick; do + ocf_log info "Waiting for cinder volume $OCF_RESKEY_volume_id to appear on $node_id" + sleep 1 + done diff --git a/SPECS/resource-agents.spec b/SPECS/resource-agents.spec index dc51ac7..ef98789 100644 --- a/SPECS/resource-agents.spec +++ b/SPECS/resource-agents.spec @@ -45,7 +45,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.10.0 -Release: 64%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 64%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}.3 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: %{upstream_prefix}-%{upstream_version}.tar.gz @@ -134,6 +134,9 @@ Patch81: RHEL-40393-Filesystem-2-update-bsd-logic.patch Patch82: RHEL-32829-db2-fix-OCF_SUCESS-typo.patch Patch83: RHEL-43579-galera-mysql-redis-remove-Unpromoted-monitor-action.patch Patch84: RHEL-22715-LVM-activate-fix-false-positive.patch +Patch85: RHEL-61165-podman-force-remove-container-if-necessary.patch +Patch86: RHEL-72960-1-openstack-cinder-volume-wait-for-volume-to-be-available.patch +Patch87: RHEL-72960-2-openstack-cinder-volume-fix-detach-not-working-during-start-action.patch # bundled ha-cloud-support libs Patch500: ha-cloud-support-aws.patch @@ -342,6 +345,9 @@ exit 1 %patch -p1 -P 82 %patch -p1 -P 83 %patch -p1 -P 84 +%patch -p1 -P 85 +%patch -p1 -P 86 +%patch -p1 -P 87 # bundled ha-cloud-support libs %patch -p1 -P 500 @@ -663,6 +669,16 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog +* Fri Jan 10 2025 Oyvind Albrigtsen - 4.10.0-64.3 +- openstack-cinder-volume: wait for volume to be available + + Resolves: RHEL-72960 + +* Wed Oct 2 2024 Oyvind Albrigtsen - 4.10.0-64.1 +- podman: force-remove containers in stopping state if necessary + + Resolves: RHEL-61165 + * Thu Aug 29 2024 Oyvind Albrigtsen - 4.10.0-64 - IPsrcaddr: add IPv6 support