From: Loic Dachary Date: Thu, 13 Feb 2014 17:18:43 +0000 (+0100) Subject: mon: ceph hashpspool false clears the flag X-Git-Tag: v0.78~178^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=589e2fa485b94244c79079f249428d4d545fca18;p=ceph.git mon: ceph hashpspool false clears the flag instead of toggling it. Signed-off-by: Loic Dachary --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index ea83ff6c8768..88259376e3a2 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -3182,7 +3182,7 @@ int OSDMonitor::prepare_command_pool_set(map &cmdmap, if (val == "true" || (interr.empty() && n == 1)) { p.flags |= pg_pool_t::FLAG_HASHPSPOOL; } else if (val == "false" || (interr.empty() && n == 0)) { - p.flags ^= pg_pool_t::FLAG_HASHPSPOOL; + p.flags &= ~pg_pool_t::FLAG_HASHPSPOOL; } else { ss << "expecting value 'true', 'false', '0', or '1'"; return -EINVAL; diff --git a/src/test/Makefile.am b/src/test/Makefile.am index d6d41a9a1338..7af43bbd20c0 100644 --- a/src/test/Makefile.am +++ b/src/test/Makefile.am @@ -237,6 +237,7 @@ check_SCRIPTS += \ unittest_bufferlist.sh \ test/encoding/check-generated.sh \ test/mon/osd-pool-create.sh \ + test/mon/misc.sh \ test/mon/osd-crush.sh \ test/mon/mkfs.sh \ test/ceph-disk.sh \ diff --git a/src/test/mon/misc.sh b/src/test/mon/misc.sh new file mode 100755 index 000000000000..f481a7202d17 --- /dev/null +++ b/src/test/mon/misc.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# Copyright (C) 2014 Cloudwatt +# +# 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. +# +source test/mon/mon-test-helpers.sh + +function run() { + local dir=$1 + + export CEPH_ARGS + CEPH_ARGS+="--fsid=$(uuidgen) --auth-supported=none " + CEPH_ARGS+="--mon-host=127.0.0.1 " + + setup $dir || return 1 + run_mon $dir a --public-addr 127.0.0.1 + FUNCTIONS=${FUNCTIONS:-$(set | sed -n -e 's/^\(TEST_[0-9a-z_]*\) .*/\1/p')} + for TEST_function in $FUNCTIONS ; do + if ! $TEST_function $dir ; then + cat $dir/a/log + return 1 + fi + done + teardown $dir || return 1 +} + +function TEST_osd_pool_get_set() { + local dir=$1 + ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 + ./ceph osd pool set data hashpspool 0 || return 1 + ! ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 + ./ceph osd pool set data hashpspool 1 || return 1 + ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 + ./ceph osd pool set data hashpspool false || return 1 + ! ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 + ./ceph osd pool set data hashpspool false || return 1 + # check that setting false twice does not toggle to true (bug) + ! ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 + ./ceph osd pool set data hashpspool true || return 1 + ./ceph osd dump | grep 'pool 0' | grep hashpspool || return 1 +} + +main misc + +# Local Variables: +# compile-command: "cd ../.. ; make -j4 && test/mon/misc.sh" +# End: