From d5b6e497e819bec89e52079c8aa3441d67d94170 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 8 May 2023 13:54:32 -0400 Subject: [PATCH] qa/workunits/cephadm: align test_cephadm.sh with new cephadm version The `cephadm version` command no longer bases the output on the container images, rather it uses a special python file added to the zipapp during the build to report on the version of cephadm (the binary). The other option was to preserve this behavior and add a new version command or make it behave differently depending on what options were provided. I discussed the options with AMK in person and we decided that changing the tests was preferable. Signed-off-by: John Mulligan (cherry picked from commit bd59b8091929ff067fabd4c8ca7ad86b3723aa0f) --- qa/workunits/cephadm/test_cephadm.sh | 32 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/qa/workunits/cephadm/test_cephadm.sh b/qa/workunits/cephadm/test_cephadm.sh index cca9cbc7bbc..fcb4aa1c60f 100755 --- a/qa/workunits/cephadm/test_cephadm.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -29,9 +29,16 @@ CEPHADM_SAMPLES_DIR=${CEPHADM_SRC_DIR}/samples [ -z "$SUDO" ] && SUDO=sudo +# If cephadm is already installed on the system, use that one, avoid building +# # one if we can. +if [ -z "$CEPHADM" ] && command -v cephadm >/dev/null ; then + CEPHADM="$(command -v cephadm)" +fi + if [ -z "$CEPHADM" ]; then CEPHADM=`mktemp -p $TMPDIR tmp.cephadm.XXXXXX` ${CEPHADM_SRC_DIR}/build.sh "$CEPHADM" + NO_BUILD_INFO=1 fi # at this point, we need $CEPHADM set @@ -162,17 +169,20 @@ $SUDO $CEPHADM check-host ## run a gather-facts (output to stdout) $SUDO $CEPHADM gather-facts -## version + --image -$SUDO CEPHADM_IMAGE=$IMAGE_PACIFIC $CEPHADM_BIN version -$SUDO CEPHADM_IMAGE=$IMAGE_PACIFIC $CEPHADM_BIN version \ - | grep 'ceph version 16' -#$SUDO CEPHADM_IMAGE=$IMAGE_OCTOPUS $CEPHADM_BIN version -#$SUDO CEPHADM_IMAGE=$IMAGE_OCTOPUS $CEPHADM_BIN version \ -# | grep 'ceph version 15' -$SUDO $CEPHADM_BIN --image $IMAGE_MAIN version | grep 'ceph version' - -# try force docker; this won't work if docker isn't installed -systemctl status docker > /dev/null && ( $CEPHADM --docker version | grep 'ceph version' ) || echo "docker not installed" +## NOTE: cephadm version is, as of around May 2023, no longer basing the +## output for `cephadm version` on the version of the containers. The version +## reported is that of the "binary" and is determined during the ceph build. +## `cephadm version` should NOT require sudo/root. +$CEPHADM_BIN version +$CEPHADM_BIN version | grep 'cephadm version' +# Typically cmake should be running the cephadm build script with CLI arguments +# that embed version info into the "binary". If not using a cephadm build via +# cmake you can set `NO_BUILD_INFO` to skip this check. +if [ -z "$NO_BUILD_INFO" ]; then + $CEPHADM_BIN version | grep -v 'UNSET' + $CEPHADM_BIN version | grep -v 'UNKNOWN' +fi + ## test shell before bootstrap, when crash dir isn't (yet) present on this host $CEPHADM shell --fsid $FSID -- ceph -v | grep 'ceph version' -- 2.39.5