From 1f5979ff6cd039ef504e6a009558d8f133679c60 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Tue, 7 Jan 2025 14:16:32 +0100 Subject: [PATCH] - openstack-cinder-volume: wait for volume to be available Resolves: RHEL-69734 --- ...lume-wait-for-volume-to-be-available.patch | 63 +++++++++++++++++++ resource-agents.spec | 9 ++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 RHEL-69734-openstack-cinder-volume-wait-for-volume-to-be-available.patch diff --git a/RHEL-69734-openstack-cinder-volume-wait-for-volume-to-be-available.patch b/RHEL-69734-openstack-cinder-volume-wait-for-volume-to-be-available.patch new file mode 100644 index 0000000..5eb8beb --- /dev/null +++ b/RHEL-69734-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/resource-agents.spec b/resource-agents.spec index f4a7a41..687434e 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -45,7 +45,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.10.0 -Release: 69%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 70%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: %{upstream_prefix}-%{upstream_version}.tar.gz @@ -146,6 +146,7 @@ Patch93: RHEL-42513-powervs-subnet-new-ra.patch Patch94: RHEL-66292-1-aws-agents-reuse-imds-token-until-it-expires.patch Patch95: RHEL-66292-2-aws-agents-reuse-imds-token-improvements.patch Patch96: RHEL-68739-awsvip-add-interface-parameter.patch +Patch97: RHEL-69734-openstack-cinder-volume-wait-for-volume-to-be-available.patch # bundled ha-cloud-support libs Patch500: ha-cloud-support-aliyun.patch @@ -366,6 +367,7 @@ exit 1 %patch -p1 -P 94 %patch -p1 -P 95 %patch -p1 -P 96 +%patch -p1 -P 97 # bundled ha-cloud-support libs %patch -p1 -P 500 @@ -695,6 +697,11 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog +* Tue Jan 7 2025 Oyvind Albrigtsen - 4.10.0-70 +- openstack-cinder-volume: wait for volume to be available + + Resolves: RHEL-69734 + * Wed Nov 27 2024 Oyvind Albrigtsen - 4.10.0-69 - AWS agents: reuse IMDS token until it expires - awsvip: add interface parameter