From 8b4d6c670916d69414efda7f18cb0906159a8ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 11 May 2022 14:59:43 +0200 Subject: [PATCH] osd: exit immediately if pvc block has not changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't need to run any `cp` command since a destination path already exists. Using `--no-clobber` is not needed and it results in a noop anyways. Instead, let's print the reason why we exit the container. Signed-off-by: Sébastien Han (cherry picked from commit 4234216db8354dffe39fe89473afc7fd4c4a1183) --- pkg/operator/ceph/cluster/osd/spec.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/operator/ceph/cluster/osd/spec.go b/pkg/operator/ceph/cluster/osd/spec.go index f404779bd..a6bbd7cca 100644 --- a/pkg/operator/ceph/cluster/osd/spec.go +++ b/pkg/operator/ceph/cluster/osd/spec.go @@ -213,7 +213,8 @@ if [ -b "$PVC_DEST" ]; then PVC_SOURCE_MAJ_MIN=$(stat --format '%%t%%T' $PVC_SOURCE) PVC_DEST_MAJ_MIN=$(stat --format '%%t%%T' $PVC_DEST) if [[ "$PVC_SOURCE_MAJ_MIN" == "$PVC_DEST_MAJ_MIN" ]]; then - CP_ARGS+=(--no-clobber) + echo "PVC $PVC_DEST already exists and has the same major and minor as $PVC_SOURCE: "$PVC_SOURCE_MAJ_MIN"" + exit 0 else echo "PVC's source major/minor numbers changed" CP_ARGS+=(--remove-destination)