From 40a76ef0d09f8ecbea13712410d9d34f25b91935 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 18 Nov 2013 14:39:12 -0800 Subject: [PATCH 1/2] 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 --- src/osd/OSD.cc | 2 +- src/test/pybind/test_rados.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d63a0a1c11578..11f1c84a13b86 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 9be4c1eb815e5..ae06a5f77c4c1 100644 --- a/src/test/pybind/test_rados.py +++ b/src/test/pybind/test_rados.py @@ -319,7 +319,7 @@ def test_write(self): 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 @@ def test_monmap_dump(self): 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']) From f753d56a9edba6ce441520ac9b52b93bd8f1b5b4 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Wed, 20 Nov 2013 18:35:34 -0800 Subject: [PATCH 2/2] test: use older names for module setup/teardown setUp and tearDown require nosetests 0.11, but 0.10.4 is the latest on centos. Rename to use the older aliases, which still work with newer versions of nosetests as well. Fixes: #6368 Signed-off-by: Josh Durgin Reviewed-by: Dan Mick --- src/test/pybind/test_rbd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 5f14e62bbded5..00db0dac741e8 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -19,7 +19,7 @@ IMG_SIZE = 8 << 20 # 8 MiB IMG_ORDER = 22 # 4 MiB objects -def setUp(): +def setup_module(): global rados rados = Rados(conffile='') rados.connect() @@ -31,7 +31,7 @@ def setUp(): if features is not None: features = int(features) -def tearDown(): +def teardown_module(): global ioctx ioctx.__del__() global rados