diff options
author | Sage Weil <sage@redhat.com> | 2019-12-11 20:57:45 +0100 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2019-12-12 02:14:09 +0100 |
commit | 137fa64e12657a20aa1c49dce19b5752cb2e41fc (patch) | |
tree | d38757ee9509cc13944dd129f9b3003d097320f9 | |
parent | qa/tasks: ceph-daemon -> cephadm throughput var names and comments (diff) | |
download | ceph-137fa64e12657a20aa1c49dce19b5752cb2e41fc.tar.xz ceph-137fa64e12657a20aa1c49dce19b5752cb2e41fc.zip |
qa: rename ceph-daemon tests -> cephadm
Also move the workunit to a better location.
Signed-off-by: Sage Weil <sage@redhat.com>
-rw-r--r-- | .github/CODEOWNERS | 2 | ||||
-rw-r--r-- | qa/suites/rados/singleton-nomsgr/all/cephadm.yaml (renamed from qa/suites/rados/singleton-nomsgr/all/ceph-daemon.yaml) | 3 | ||||
-rwxr-xr-x | qa/workunits/cephadm/test_cephadm.sh (renamed from qa/standalone/test_ceph_daemon.sh) | 119 | ||||
-rwxr-xr-x | src/cephadm/cephadm | 4 | ||||
-rw-r--r-- | src/cephadm/tests/test_ceph_daemon.py | 2 | ||||
-rwxr-xr-x | test_cephadm.sh (renamed from test_ceph_daemon.sh) | 14 |
6 files changed, 71 insertions, 73 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 51237b2330a..65bed6376fb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -16,7 +16,7 @@ /src/pybind/mgr/ssh @ceph/orchestrators /src/pybind/mgr/test_orchestrator @ceph/orchestrators /src/python-common/ceph/deployment @ceph/orchestrators -/qa/standalone/test_ceph_daemon.sh @ceph/orchestrators +/qa/workunits/cephadm/test_cephadm.sh @ceph/orchestrators /qa/tasks/ceph2.py @ceph/orchestrators /qa/tasks/mgr/test_orchestrator_cli.py @ceph/orchestrators /qa/tasks/mgr/test_ssh_orchestrator.py @ceph/orchestrators diff --git a/qa/suites/rados/singleton-nomsgr/all/ceph-daemon.yaml b/qa/suites/rados/singleton-nomsgr/all/cephadm.yaml index ed19310d681..4d253517cc9 100644 --- a/qa/suites/rados/singleton-nomsgr/all/ceph-daemon.yaml +++ b/qa/suites/rados/singleton-nomsgr/all/cephadm.yaml @@ -6,7 +6,6 @@ tasks: mon.a: - yum install -y python3 || apt install -y python3 - workunit: - basedir: qa/standalone clients: client.0: - - test_ceph_daemon.sh + - cephadm/test_cephadm.sh diff --git a/qa/standalone/test_ceph_daemon.sh b/qa/workunits/cephadm/test_cephadm.sh index 12d8c10eb33..390dfbd3e2c 100755 --- a/qa/standalone/test_ceph_daemon.sh +++ b/qa/workunits/cephadm/test_cephadm.sh @@ -26,13 +26,13 @@ OSD_LV_NAME=${SCRIPT_NAME%.*} [ -z "$SUDO" ] && SUDO=sudo -if [ -z "$CEPH_DAEMON" ]; then - CEPH_DAEMON=${SCRIPT_DIR}/../../src/cephadm/cephadm +if [ -z "$CEPHADM" ]; then + CEPHADM=${SCRIPT_DIR}/../../../src/cephadm/cephadm fi -# at this point, we need $CEPH_DAEMON set -if ! [ -x "$CEPH_DAEMON" ]; then - echo "cephadm not found. Please set \$CEPH_DAEMON" +# at this point, we need $CEPHADM set +if ! [ -x "$CEPHADM" ]; then + echo "cephadm not found. Please set \$CEPHADM" exit 1 fi @@ -41,16 +41,16 @@ PYTHONS="python3 python2" # which pythons we test if [ -z "$PYTHON_KLUDGE" ]; then TMPBINDIR=$(mktemp -d) trap "rm -rf $TMPBINDIR" EXIT - ORIG_CEPH_DAEMON="$CEPH_DAEMON" - CEPH_DAEMON="$TMPBINDIR/cephadm" + ORIG_CEPHADM="$CEPHADM" + CEPHADM="$TMPBINDIR/cephadm" for p in $PYTHONS; do echo "=== re-running with $p ===" ln -s `which $p` $TMPBINDIR/python - echo "#!$TMPBINDIR/python" > $CEPH_DAEMON - cat $ORIG_CEPH_DAEMON >> $CEPH_DAEMON - chmod 700 $CEPH_DAEMON + echo "#!$TMPBINDIR/python" > $CEPHADM + cat $ORIG_CEPHADM >> $CEPHADM + chmod 700 $CEPHADM $TMPBINDIR/python --version - PYTHON_KLUDGE=1 CEPH_DAEMON=$CEPH_DAEMON $0 + PYTHON_KLUDGE=1 CEPHADM=$CEPHADM $0 rm $TMPBINDIR/python done rm -rf $TMPBINDIR @@ -59,24 +59,21 @@ if [ -z "$PYTHON_KLUDGE" ]; then fi # add image to args -CEPH_DAEMON_ARGS="$CEPH_DAEMON_ARGS --image $IMAGE_MASTER" +CEPHADM_ARGS="$CEPHADM_ARGS --image $IMAGE_MASTER" # combine into a single var -CEPH_DAEMON_BIN="$CEPH_DAEMON" -CEPH_DAEMON="$SUDO $CEPH_DAEMON_BIN $CEPH_DAEMON_ARGS" +CEPHADM_BIN="$CEPHADM" +CEPHADM="$SUDO $CEPHADM_BIN $CEPHADM_ARGS" # clean up previous run(s)? -$CEPH_DAEMON rm-cluster --fsid $FSID --force -$CEPH_DAEMON rm-cluster --fsid $FSID_LEGACY --force +$CEPHADM rm-cluster --fsid $FSID --force +$CEPHADM rm-cluster --fsid $FSID_LEGACY --force vgchange -an $OSD_VG_NAME || true loopdev=$($SUDO losetup -a | grep $(basename $OSD_IMAGE_NAME) | awk -F : '{print $1}') if ! [ "$loopdev" = "" ]; then $SUDO losetup -d $loopdev fi -TMPDIR=`mktemp -d -p .` -trap "rm -rf $TMPDIR" EXIT - function expect_false() { set -x @@ -84,21 +81,23 @@ function expect_false() } ## prepare + check host -$SUDO $CEPH_DAEMON check-host +$SUDO $CEPHADM check-host ## version + --image -$SUDO CEPH_DAEMON_IMAGE=$IMAGE_NAUTILUS $CEPH_DAEMON_BIN version \ +$SUDO CEPHADM_IMAGE=$IMAGE_NAUTILUS $CEPHADM_BIN version +$SUDO CEPHADM_IMAGE=$IMAGE_NAUTILUS $CEPHADM_BIN version \ | grep 'ceph version 14' -$SUDO $CEPH_DAEMON_BIN --image $IMAGE_MIMIC version \ +$SUDO $CEPHADM_BIN --image $IMAGE_MIMIC version +$SUDO $CEPHADM_BIN --image $IMAGE_MIMIC version \ | grep 'ceph version 13' -$SUDO $CEPH_DAEMON_BIN --image $IMAGE_MASTER version | grep 'ceph version' +$SUDO $CEPHADM_BIN --image $IMAGE_MASTER version | grep 'ceph version' # try force docker; this won't work if docker isn't installed -which docker && ( $CEPH_DAEMON --docker version | grep 'ceph version' ) +which docker && ( $CEPHADM --docker version | grep 'ceph version' ) ## test shell before bootstrap, when crash dir isn't (yet) present on this host -$CEPH_DAEMON shell -- ceph -v | grep 'ceph version' -$CEPH_DAEMON shell --fsid $FSID -- ceph -v | grep 'ceph version' +$CEPHADM shell -- ceph -v | grep 'ceph version' +$CEPHADM shell --fsid $FSID -- ceph -v | grep 'ceph version' ## bootstrap ORIG_CONFIG=`mktemp -p $TMPDIR` @@ -109,7 +108,7 @@ cat <<EOF > $ORIG_CONFIG [global] log to file = true EOF -$CEPH_DAEMON bootstrap \ +$CEPHADM bootstrap \ --mon-id a \ --mgr-id x \ --mon-ip $IP \ @@ -135,18 +134,18 @@ done systemctl | grep system-ceph | grep -q .slice # naming is escaped and annoying # check ceph -s works (via shell w/ passed config/keyring) -$CEPH_DAEMON shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ +$CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ ceph -s | grep $FSID ## ls -$CEPH_DAEMON ls | jq '.[]' | jq 'select(.name == "mon.a").fsid' \ +$CEPHADM ls | jq '.[]' | jq 'select(.name == "mon.a").fsid' \ | grep $FSID -$CEPH_DAEMON ls | jq '.[]' | jq 'select(.name == "mgr.x").fsid' \ +$CEPHADM ls | jq '.[]' | jq 'select(.name == "mgr.x").fsid' \ | grep $FSID ## deploy # add mon.b -$CEPH_DAEMON deploy --name mon.b \ +$CEPHADM deploy --name mon.b \ --fsid $FSID \ --mon-ip $IP:3301 \ --keyring /var/lib/ceph/$FSID/mon.a/keyring \ @@ -157,12 +156,12 @@ for u in ceph-$FSID@mon.b; do done # add mgr.y -$CEPH_DAEMON shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ +$CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ ceph auth get-or-create mgr.y \ mon 'allow profile mgr' \ osd 'allow *' \ mds 'allow *' > $TMPDIR/keyring.mgr.y -$CEPH_DAEMON deploy --name mgr.y \ +$CEPHADM deploy --name mgr.y \ --fsid $FSID \ --keyring $TMPDIR/keyring.mgr.y \ --config $CONFIG @@ -171,13 +170,13 @@ for u in ceph-$FSID@mgr.y; do systemctl is-active $u done for f in `seq 1 30`; do - if $CEPH_DAEMON shell --fsid $FSID \ + if $CEPHADM shell --fsid $FSID \ --config $CONFIG --keyring $KEYRING -- \ ceph -s -f json-pretty \ | jq '.mgrmap.num_standbys' | grep -q 1 ; then break; fi sleep 1 done -$CEPH_DAEMON shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ +$CEPHADM shell --fsid $FSID --config $CONFIG --keyring $KEYRING -- \ ceph -s -f json-pretty \ | jq '.mgrmap.num_standbys' | grep -q 1 @@ -189,7 +188,7 @@ $SUDO losetup $loop_dev $TMPDIR/$OSD_IMAGE_NAME $SUDO pvcreate $loop_dev && $SUDO vgcreate $OSD_VG_NAME $loop_dev for id in `seq 0 $((--OSD_TO_CREATE))`; do $SUDO lvcreate -l $((100/$OSD_TO_CREATE))%VG -n $OSD_LV_NAME.$id $OSD_VG_NAME - $CEPH_DAEMON shell --config $CONFIG --keyring $KEYRING -- \ + $CEPHADM shell --config $CONFIG --keyring $KEYRING -- \ ceph orchestrator osd create \ $(hostname):/dev/$OSD_VG_NAME/$OSD_LV_NAME.$id done @@ -202,58 +201,58 @@ if false; then for tarball in $TEST_TARS; do TMP_TAR_DIR=`mktemp -d -p $TMPDIR` $SUDO tar xzvf $tarball -C $TMP_TAR_DIR - NAMES=$($CEPH_DAEMON ls --legacy-dir $TMP_TAR_DIR | jq -r '.[].name') + NAMES=$($CEPHADM ls --legacy-dir $TMP_TAR_DIR | jq -r '.[].name') for name in $NAMES; do - $CEPH_DAEMON adopt \ + $CEPHADM adopt \ --style legacy \ --legacy-dir $TMP_TAR_DIR \ --name $name # validate after adopt - out=$($CEPH_DAEMON ls | jq '.[]' \ + out=$($CEPHADM ls | jq '.[]' \ | jq 'select(.name == "'$name'")') echo $out | jq -r '.style' | grep 'cephadm' echo $out | jq -r '.fsid' | grep $FSID_LEGACY done # clean-up before next iter - $CEPH_DAEMON rm-cluster --fsid $FSID_LEGACY --force + $CEPHADM rm-cluster --fsid $FSID_LEGACY --force $SUDO rm -rf $TMP_TAR_DIR done fi ## unit -$CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-enabled -$CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-active -expect_false $CEPH_DAEMON unit --fsid $FSID --name mon.xyz -- is-active -$CEPH_DAEMON unit --fsid $FSID --name mon.a -- disable -expect_false $CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-enabled -$CEPH_DAEMON unit --fsid $FSID --name mon.a -- enable -$CEPH_DAEMON unit --fsid $FSID --name mon.a -- is-enabled +$CEPHADM unit --fsid $FSID --name mon.a -- is-enabled +$CEPHADM unit --fsid $FSID --name mon.a -- is-active +expect_false $CEPHADM unit --fsid $FSID --name mon.xyz -- is-active +$CEPHADM unit --fsid $FSID --name mon.a -- disable +expect_false $CEPHADM unit --fsid $FSID --name mon.a -- is-enabled +$CEPHADM unit --fsid $FSID --name mon.a -- enable +$CEPHADM unit --fsid $FSID --name mon.a -- is-enabled ## shell -$CEPH_DAEMON shell -- true -$CEPH_DAEMON shell --fsid $FSID -- test -d /var/log/ceph +$CEPHADM shell -- true +$CEPHADM shell --fsid $FSID -- test -d /var/log/ceph ## enter -expect_false $CEPH_DAEMON enter -$CEPH_DAEMON enter --fsid $FSID --name mon.a -- test -d /var/lib/ceph/mon/ceph-a -$CEPH_DAEMON enter --fsid $FSID --name mgr.x -- test -d /var/lib/ceph/mgr/ceph-x -$CEPH_DAEMON enter --fsid $FSID --name mon.a -- pidof ceph-mon -expect_false $CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mon -$CEPH_DAEMON enter --fsid $FSID --name mgr.x -- pidof ceph-mgr +expect_false $CEPHADM enter +$CEPHADM enter --fsid $FSID --name mon.a -- test -d /var/lib/ceph/mon/ceph-a +$CEPHADM enter --fsid $FSID --name mgr.x -- test -d /var/lib/ceph/mgr/ceph-x +$CEPHADM enter --fsid $FSID --name mon.a -- pidof ceph-mon +expect_false $CEPHADM enter --fsid $FSID --name mgr.x -- pidof ceph-mon +$CEPHADM enter --fsid $FSID --name mgr.x -- pidof ceph-mgr ## ceph-volume -$CEPH_DAEMON ceph-volume --fsid $FSID -- inventory --format=json \ +$CEPHADM ceph-volume --fsid $FSID -- inventory --format=json \ | jq '.[]' ## rm-daemon # mon and osd require --force -expect_false $CEPH_DAEMON rm-daemon --fsid $FSID --name mon.a +expect_false $CEPHADM rm-daemon --fsid $FSID --name mon.a # mgr does not -$CEPH_DAEMON rm-daemon --fsid $FSID --name mgr.x +$CEPHADM rm-daemon --fsid $FSID --name mgr.x ## rm-cluster -expect_false $CEPH_DAEMON rm-cluster --fsid $FSID -$CEPH_DAEMON rm-cluster --fsid $FSID --force +expect_false $CEPHADM rm-cluster --fsid $FSID +$CEPHADM rm-cluster --fsid $FSID --force rm -rf $TMPDIR echo PASS diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 1dcf615e1f0..b9b4bf2d264 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -1770,8 +1770,8 @@ def _get_parser(): formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( '--image', - default=os.environ.get('CEPH_DAEMON_IMAGE', DEFAULT_IMAGE), - help='container image. Can also be set via the "CEPH_DAEMON_IMAGE" ' + default=os.environ.get('CEPHADM_IMAGE', DEFAULT_IMAGE), + help='container image. Can also be set via the "CEPHADM_IMAGE" ' 'env var') parser.add_argument( '--docker', diff --git a/src/cephadm/tests/test_ceph_daemon.py b/src/cephadm/tests/test_ceph_daemon.py index ada2beff714..db94ba5d099 100644 --- a/src/cephadm/tests/test_ceph_daemon.py +++ b/src/cephadm/tests/test_ceph_daemon.py @@ -19,7 +19,7 @@ class TestCephDaemon(unittest.TestCase): args = p.parse_args(['--image', 'foo', 'version']) assert args.image == 'foo' - @mock.patch.dict(os.environ,{'CEPH_DAEMON_IMAGE':'bar'}) + @mock.patch.dict(os.environ,{'CEPHADM_IMAGE':'bar'}) def test__get_parser_image_with_envvar(self): p = cd._get_parser() args = p.parse_args(['version']) diff --git a/test_ceph_daemon.sh b/test_cephadm.sh index 5f68be4a411..ac8763fa898 100755 --- a/test_ceph_daemon.sh +++ b/test_cephadm.sh @@ -12,12 +12,12 @@ OSD_TO_CREATE=6 OSD_VG_NAME=${SCRIPT_NAME%.*} OSD_LV_NAME=${SCRIPT_NAME%.*} -CEPH_DAEMON=../src/cephadm/cephadm +CEPHADM=../src/cephadm/cephadm #A="-d" # clean up previous run(s)? -$CEPH_DAEMON $A rm-cluster --fsid $fsid --force +$CEPHADM $A rm-cluster --fsid $fsid --force vgchange -an $OSD_VG_NAME || true loopdev=$(losetup -a | grep $(basename $OSD_IMAGE_NAME) | awk -F : '{print $1}') if ! [ "$loopdev" = "" ]; then @@ -30,7 +30,7 @@ cat <<EOF > c log to file = true EOF -$CEPH_DAEMON $A \ +$CEPHADM $A \ --image $image \ bootstrap \ --mon-id a \ @@ -45,7 +45,7 @@ chmod 644 k c if [ -n "$ip2" ]; then # mon.b - $CEPH_DAEMON $A \ + $CEPHADM $A \ --image $image \ deploy --name mon.b \ --fsid $fsid \ @@ -59,7 +59,7 @@ bin/ceph -c c -k k auth get-or-create mgr.y \ mon 'allow profile mgr' \ osd 'allow *' \ mds 'allow *' > k-mgr.y -$CEPH_DAEMON $A \ +$CEPHADM $A \ --image $image \ deploy --name mgr.y \ --fsid $fsid \ @@ -73,7 +73,7 @@ for id in k j; do mgr 'allow profile mds' \ osd 'allow *' \ mds 'allow *' > k-mds.$id - $CEPH_DAEMON $A \ + $CEPHADM $A \ --image $image \ deploy --name mds.$id \ --fsid $fsid \ @@ -88,7 +88,7 @@ losetup $loop_dev $OSD_IMAGE_NAME pvcreate $loop_dev && vgcreate $OSD_VG_NAME $loop_dev for id in `seq 0 $((--OSD_TO_CREATE))`; do lvcreate -l $((100/$OSD_TO_CREATE))%VG -n $OSD_LV_NAME.$id $OSD_VG_NAME - $SUDO $CEPH_DAEMON shell --config c --keyring k -- \ + $SUDO $CEPHADM shell --config c --keyring k -- \ ceph orchestrator osd create \ $(hostname):/dev/$OSD_VG_NAME/$OSD_LV_NAME.$id done |