]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: ceph hashpspool false clears the flag 1237/head
authorLoic Dachary <loic@dachary.org>
Thu, 13 Feb 2014 17:18:43 +0000 (18:18 +0100)
committerLoic Dachary <loic@dachary.org>
Thu, 13 Feb 2014 18:07:36 +0000 (19:07 +0100)
instead of toggling it.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/mon/OSDMonitor.cc
src/test/Makefile.am
src/test/mon/misc.sh [new file with mode: 0755]

index ea83ff6c8768ece8127b22cc1fac12de03b972a2..88259376e3a2a9b8741abcfd89afc226cfb45694 100644 (file)
@@ -3182,7 +3182,7 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &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;
index d6d41a9a1338f652264c03214f8942a7d0f661ec..7af43bbd20c051076cfc50b5ab8fd4266c515483 100644 (file)
@@ -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 (executable)
index 0000000..f481a72
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Cloudwatt <libre.licensing@cloudwatt.com>
+#
+# Author: Loic Dachary <loic@dachary.org>
+#
+# 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: