From: Loic Dachary Date: Thu, 27 Aug 2015 10:21:48 +0000 (+0200) Subject: tests: obsolete ceph-disk root tests X-Git-Tag: v9.1.0~252^2~1^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9a71816f485323301a35992318d736fc64dc9cc5;p=ceph.git tests: obsolete ceph-disk root tests They were designed to run in a docker container using loop devices instead of disks. Although this was fit for ceph-disk activate tests for regular and dmcrypt devices, a docker instance does not have its own udev instance it is not possible to run tests involving udev events without interfering with the host. Signed-off-by: Loic Dachary --- diff --git a/configure.ac b/configure.ac index 7447d3d98b29..3acbfe67eeda 100644 --- a/configure.ac +++ b/configure.ac @@ -418,12 +418,6 @@ AC_ARG_ENABLE(gitversion, AM_CONDITIONAL(NO_GIT_VERSION, [test "x$enable_gitversion" = "xno"]) -AC_ARG_ENABLE([root-make-check], - [AS_HELP_STRING([--enable-root-make-check], [enable make check tests that require root privileges])], - [], - [enable_root_make_check=no]) -AM_CONDITIONAL(ENABLE_ROOT_MAKE_CHECK, test "x$enable_root_make_check" != xno) - # profiler? AC_ARG_WITH([profiler], [AS_HELP_STRING([--with-profiler], [build extra profiler binaries])], diff --git a/src/test/Makefile.am b/src/test/Makefile.am index 32e10851717c..79f879683f53 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -84,11 +84,7 @@ check_SCRIPTS += \ test/libradosstriper/rados-striper.sh \ test/test_objectstore_memstore.sh -if ENABLE_ROOT_MAKE_CHECK -check_SCRIPTS += test/ceph-disk-root.sh -else check_SCRIPTS += test/ceph-disk.sh -endif EXTRA_DIST += \ $(srcdir)/test/python/ceph-disk/setup.py \ diff --git a/src/test/ceph-disk-root.sh b/src/test/ceph-disk-root.sh deleted file mode 100755 index 916bc9425c7e..000000000000 --- a/src/test/ceph-disk-root.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2014 Red Hat -# -# Author: Loic Dachary -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU Library Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Library Public License for more details. -# -set -e -sudo test/ceph-disk.sh test_activate_dev test_activate_dmcrypt_dev test_activate_dmcrypt_plain_dev -test/ceph-disk.sh - -# Local Variables: -# compile-command: "cd ../.. ; make -j4 && test/ceph-disk-root.sh" -# End: diff --git a/src/test/ceph-disk.sh b/src/test/ceph-disk.sh index c568f3df6f50..be466faeb987 100755 --- a/src/test/ceph-disk.sh +++ b/src/test/ceph-disk.sh @@ -299,40 +299,6 @@ function test_activate() { test_pool_read_write $osd_uuid || return 1 } -function test_activate_dmcrypt() { - local to_prepare=$1 - local to_activate=$2 - local journal=$3 - local journal_p=$4 - local uuid=$5 - local juuid=$6 - local plain=$7 - - $mkdir -p $OSD_DATA - - if test $plain = plain ; then - echo "osd_dmcrypt_type=plain" > $DIR/ceph.conf - fi - - ceph-disk $CEPH_DISK_ARGS \ - prepare --dmcrypt --dmcrypt-key-dir $DIR/keys --osd-uuid=$uuid --journal-uuid=$juuid $to_prepare $journal || return 1 - - if test $plain = plain ; then - /sbin/cryptsetup --key-file $DIR/keys/$uuid --key-size 256 create $uuid $to_activate - /sbin/cryptsetup --key-file $DIR/keys/$juuid --key-size 256 create $juuid $journal - else - /sbin/cryptsetup --key-file $DIR/keys/$uuid.luks.key luksOpen $to_activate $uuid - /sbin/cryptsetup --key-file $DIR/keys/$juuid.luks.key luksOpen ${journal}${journal_p} $juuid - fi - - $timeout $TIMEOUT ceph-disk $CEPH_DISK_ARGS \ - activate \ - --mark-init=none \ - /dev/mapper/$uuid || return 1 - - test_pool_read_write $uuid || return 1 -} - function test_activate_dir() { run_mon @@ -342,263 +308,6 @@ function test_activate_dir() { $rm -fr $osd_data } -function loop_sanity_check_body() { - local dev=$1 - local guid=$2 - - # - # Check if /dev/loop is configured with max_part > 0 to handle - # partition tables and expose the partition devices in /dev - # - sgdisk --largest-new=1 --partition-guid=1:$guid $dev - if ! test -e ${dev}p1 ; then - if grep loop.max_part /proc/cmdline ; then - echo "the loop module max_part parameter is configured but when" - echo "creating a new partition on $dev, it the expected node" - echo "${dev}p1 does not exist" - return 1 - fi - perl -pi -e 's/$/ loop.max_part=16/ if(/kernel/ && !/max_part/)' /boot/grub/grub.conf - echo "the loop.max_part=16 was added to the kernel in /boot/grub/grub.conf" - cat /boot/grub/grub.conf - echo "you need to reboot for it to be taken into account" - return 1 - fi - - # - # Install the minimal files supporting the maintenance of /dev/disk/by-partuuid - # - udevadm trigger --sysname-match=$(basename $dev) - udevadm settle - if test ! -e /dev/disk/by-partuuid/$guid ; then - cp -a ../udev/95-ceph-osd-alt.rules /lib/udev/rules.d/95-ceph-osd.rules - cp -a ceph-disk ceph-disk-udev /usr/sbin - udevadm trigger --sysname-match=$(basename $dev) - if test ! -e /dev/disk/by-partuuid/$guid ; then - echo "/dev/disk/by-partuuid/$guid not found although the" - echo "following support files are installed: " - ls -l /lib/udev/rules.d/95-ceph-osd.rules /usr/sbin/ceph-disk{,-udev} - return 1 - fi - fi - - return 0 -} - -function loop_sanity_check() { - local id=$(lsb_release -si) - local major=$(lsb_release -rs | cut -f1 -d.) - if test $major != 6 || test $id != CentOS -a $id != RedHatEnterpriseServer ; then - echo "/dev/loop is assumed to be configured with max_part > 0" - echo "and /dev/disk/by-partuuid to be populated by udev on" - lsb_release -a - return 0 - fi - local name=$DIR/sanity.disk - dd if=/dev/zero of=$name bs=1024k count=10 > /dev/null 2>&1 - losetup --find $name - local dev=$(losetup --associated $name | cut -f1 -d:) - local guid=$($uuidgen) - - loop_sanity_check_body $dev $guid - status=$? - - losetup --detach $dev - rm $name - rm -f /dev/disk/by-partuuid/$guid - - return $status -} - -function reset_dev() { - local dev=$1 - - if test -z "$dev" ; then - return - fi - - grep "^$dev" < /proc/mounts | while read mounted rest ; do - umount $mounted - done - local dev_base=$(basename $dev) - ( - ls /sys/block/$dev_base/$dev_base*/holders 2> /dev/null - ls /sys/block/$dev_base/holders 2> /dev/null - ) | grep '^dm-' | while read dm ; do - dmsetup remove /dev/$dm - done - ceph-disk zap $dev > /dev/null 2>&1 -} - -function reset_leftover_dev() { - local path=$1 - - losetup --all | sed -e 's/://' | while read dev id associated_path ; do - # if $path has been deleted with a dev attached, then $associated_path - # will carry "($path (deleted))". - if test "$associated_path" = "($path)" ; then - reset_dev $dev - losetup --detach $dev - fi - done -} - -function create_dev() { - local path=$1 - - echo -n "create_dev $path ... " >&2 - reset_leftover_dev $path - dd if=/dev/zero of=$path bs=1024k count=400 > /dev/null 2>&1 - losetup --find $path - local dev=$(losetup --associated $path | cut -f1 -d:) - test "$dev" || return 1 - reset_dev $dev - echo $dev >&2 - echo $dev -} - -function destroy_dev() { - local path=$1 - local dev=$2 - - echo destroy_dev $path $dev >&2 - reset_dev $dev - losetup --detach $dev - rm -f $path -} - -function activate_dev_body() { - local disk=$1 - local journal=$2 - local newdisk=$3 - - setup - run_mon - # - # Create an OSD without a journal and an objectstore - # that does not use a journal. - # - ceph-disk zap $disk || return 1 - CEPH_ARGS="$CEPH_ARGS --osd-objectstore=memstore" \ - test_activate $disk ${disk}p1 || return 1 - kill_daemons - umount ${disk}p1 || return 1 - teardown - - setup - run_mon - # - # Create an OSD with data on a disk, journal on another - # - ceph-disk zap $disk || return 1 - test_activate $disk ${disk}p1 $journal || return 1 - kill_daemons - umount ${disk}p1 || return 1 - teardown - - setup - run_mon - # - # Create an OSD with data on a disk, journal on another - # This will add a new partition to $journal, the previous - # one will remain. - # - ceph-disk zap $disk || return 1 - test_activate $disk ${disk}p1 $journal || return 1 - kill_daemons - umount ${disk}p1 || return 1 - teardown - - setup - run_mon - # - # Create an OSD and reuse an existing journal partition - # - test_activate $newdisk ${newdisk}p1 ${journal}p1 || return 1 - # - # Create an OSD and get a journal partition from a disk that - # already contains a journal partition which is in use. Updates of - # the kernel partition table may behave differently when a - # partition is in use. See http://tracker.ceph.com/issues/7334 for - # more information. - # - ceph-disk zap $disk || return 1 - test_activate $disk ${disk}p1 $journal || return 1 - kill_daemons - umount ${newdisk}p1 || return 1 - umount ${disk}p1 || return 1 - teardown -} - -function test_activate_dev() { - test_setup_dev_and_run activate_dev_body -} - -function test_setup_dev_and_run() { - local action=$1 - if test $(id -u) != 0 ; then - echo "SKIP because not root" - return 0 - fi - - loop_sanity_check || return 1 - - local dir=$(pwd)/$DIR - local disk - disk=$(create_dev $dir/vdf.disk) || return 1 - local journal - journal=$(create_dev $dir/vdg.disk) || return 1 - local newdisk - newdisk=$(create_dev $dir/vdh.disk) || return 1 - - $action $disk $journal $newdisk - status=$? - - destroy_dev $dir/vdf.disk $disk - destroy_dev $dir/vdg.disk $journal - destroy_dev $dir/vdh.disk $newdisk - - return $status -} - -function activate_dmcrypt_dev_body() { - local disk=$1 - local journal=$2 - local newdisk=$3 - local uuid=$($uuidgen) - local juuid=$($uuidgen) - - setup - run_mon - test_activate_dmcrypt $disk ${disk}p1 $journal p1 $uuid $juuid not_plain || return 1 - kill_daemons - umount /dev/mapper/$uuid || return 1 - teardown -} - -function test_activate_dmcrypt_dev() { - test_setup_dev_and_run activate_dmcrypt_dev_body -} - -function activate_dmcrypt_plain_dev_body() { - local disk=$1 - local journal=$2 - local newdisk=$3 - local uuid=$($uuidgen) - local juuid=$($uuidgen) - - setup - run_mon - test_activate_dmcrypt $disk ${disk}p1 $journal p1 $uuid $juuid plain || return 1 - kill_daemons - umount /dev/mapper/$uuid || return 1 - teardown -} - -function test_activate_dmcrypt_plain_dev() { - test_setup_dev_and_run activate_dmcrypt_plain_dev_body -} - function test_find_cluster_by_uuid() { setup test_activate_dir 2>&1 | tee $DIR/test_find