From: Josh Durgin Date: Mon, 18 Nov 2013 22:39:12 +0000 (-0800) Subject: osd: fix bench block size X-Git-Tag: v0.73~14^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=40a76ef0d09f8ecbea13712410d9d34f25b91935;p=ceph.git osd: fix bench block size The command was declared to take 'size' in dumpling, but was trying to read 'bsize' instead, so it always used the default of 4MiB. Change the bench command to read 'size', so it matches what existing clients are sending. Fixes: #6795 Backport: emperor, dumpling Signed-off-by: Josh Durgin --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d63a0a1c1157..11f1c84a13b8 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4069,7 +4069,7 @@ void OSD::do_command(Connection *con, tid_t tid, vector& cmd, bufferlist int64_t bsize; // default count 1G, size 4MB cmd_getval(cct, cmdmap, "count", count, (int64_t)1 << 30); - cmd_getval(cct, cmdmap, "bsize", bsize, (int64_t)4 << 20); + cmd_getval(cct, cmdmap, "size", bsize, (int64_t)4 << 20); bufferlist bl; bufferptr bp(bsize); diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py index 9be4c1eb815e..ae06a5f77c4c 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -319,7 +319,7 @@ class TestObject(object): eq(self.object.read(3), 'bar') eq(self.object.read(3), 'baz') -class TestMonCommand(object): +class TestCommand(object): def setUp(self): self.rados = Rados(conffile='') @@ -373,3 +373,12 @@ class TestMonCommand(object): d = json.loads(buf) assert('epoch' in d) + def test_osd_bench(self): + cmd = dict(prefix='bench', size=4096, count=8192) + ret, buf, err = self.rados.osd_command(0, json.dumps(cmd), '', + timeout=30) + eq(ret, 0) + assert len(err) > 0 + out = json.loads(err) + eq(out['blocksize'], cmd['size']) + eq(out['bytes_written'], cmd['count'])