]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: fix inverted test in osd pool create 608/head
authorLoic Dachary <loic@dachary.org>
Wed, 11 Sep 2013 20:52:20 +0000 (22:52 +0200)
committerLoic Dachary <loic@dachary.org>
Thu, 19 Sep 2013 22:33:13 +0000 (00:33 +0200)
When using the properties key=value only, the test was inverted
and an attempt to obtain a substring at index string::npos throws
an exception.

Add variations of osd pool create to qa/workunits/mon/pool_ops.sh
to assert the problem has been fixed and all code paths are used.

http://tracker.ceph.com/issues/6357 fixes #6357

Signed-off-by: Loic Dachary <loic@dachary.org>
qa/workunits/mon/pool_ops.sh
src/mon/OSDMonitor.cc

index e98e1e4121e6481d39c1fda6942d56ca57a640c7..2436cc4837e71ab8acd3f8efa55d1faf89c6ea4e 100755 (executable)
@@ -2,7 +2,8 @@
 
 set -e
 
-ceph osd pool create foo 123 123
+ceph osd pool create foo 123 123 key1=+++              && exit 1 || true
+ceph osd pool create foo 123 123 key1=value1 key2 key3=value3
 ceph osd pool create fooo 123
 
 ceph osd pool create foo 123 # idempotent
index 36fe6d345f2adab0f1e1b2c9eb3d67d97ffe1293..8d15dbd9424868914a3d5fa00511bed76506fe96 100644 (file)
@@ -2526,7 +2526,7 @@ int OSDMonitor::prepare_new_pool(string& name, uint64_t auid, int crush_rule,
        i != properties.end();
        i++) {
     size_t equal = i->find('=');
-    if (equal != string::npos)
+    if (equal == string::npos)
       pi->properties[*i] = string();
     else {
       const string key = i->substr(0, equal);