diff options
author | Loic Dachary <loic@dachary.org> | 2013-09-11 22:52:20 +0200 |
---|---|---|
committer | Loic Dachary <loic@dachary.org> | 2013-09-20 00:33:13 +0200 |
commit | bcc1680ad2bcf52ba39a25686d831777e9554b01 (patch) | |
tree | c7c72f4fadb31f317fc814b9a3368e732da42e01 | |
parent | 5421d6da2ca34d122c1de8faec13522801fe77fb (diff) | |
download | ceph-bcc1680ad2bcf52ba39a25686d831777e9554b01.tar.gz |
mon: fix inverted test in osd pool create
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>
-rwxr-xr-x | qa/workunits/mon/pool_ops.sh | 3 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/qa/workunits/mon/pool_ops.sh b/qa/workunits/mon/pool_ops.sh index e98e1e4121e..2436cc4837e 100755 --- a/qa/workunits/mon/pool_ops.sh +++ b/qa/workunits/mon/pool_ops.sh @@ -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 diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 36fe6d345f2..8d15dbd9424 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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); |