summaryrefslogtreecommitdiffstats
path: root/src/test/pybind
diff options
context:
space:
mode:
authorBruce Flynn <brucef@ssec.wisc.edu>2018-04-24 20:25:45 +0200
committerBruce Flynn <brucef@ssec.wisc.edu>2018-04-24 20:25:45 +0200
commitc95b220750d4bec955294941bc4fa8a1a8e6e38b (patch)
tree92e490698e01818528b1f6935be8f7afaccbfa5c /src/test/pybind
parentMerge pull request #21165 from Songweibin/wip-drop-redefine-func (diff)
downloadceph-c95b220750d4bec955294941bc4fa8a1a8e6e38b.tar.xz
ceph-c95b220750d4bec955294941bc4fa8a1a8e6e38b.zip
pybind/rados: add alignment getter to IoCtx
Adds alignment method to retrieve the pool alignment bytes for EC pools to the existing IoCtx class. Signed-off-by: Bruce Flynn <bmflynn@gmail.com>
Diffstat (limited to 'src/test/pybind')
-rw-r--r--src/test/pybind/test_rados.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/pybind/test_rados.py b/src/test/pybind/test_rados.py
index 378fdf08cb2..098e5ef15ff 100644
--- a/src/test/pybind/test_rados.py
+++ b/src/test/pybind/test_rados.py
@@ -899,6 +899,41 @@ class TestIoctx(object):
status = {'result': 'unknown', 'test': 'running'}
self.rados.service_daemon_update(status)
+ def test_alignment(self):
+ eq(self.ioctx.alignment(), None)
+
+
+class TestIoctxEc(object):
+
+ def setUp(self):
+ self.rados = Rados(conffile='')
+ self.rados.connect()
+ self.pool = 'test-ec'
+ self.profile = 'testprofile-%s' % self.pool
+ cmd = {"prefix": "osd erasure-code-profile set",
+ "name": self.profile, "profile": ["k=2", "m=1", "crush-failure-domain=osd"]}
+ ret, buf, out = self.rados.mon_command(json.dumps(cmd), b'', timeout=30)
+ eq(ret, 0, msg=out)
+ # create ec pool with profile created above
+ cmd = {'prefix': 'osd pool create', 'pg_num': 8, 'pgp_num': 8,
+ 'pool': self.pool, 'pool_type': 'erasure',
+ 'erasure_code_profile': self.profile}
+ ret, buf, out = self.rados.mon_command(json.dumps(cmd), b'', timeout=30)
+ eq(ret, 0, msg=out)
+ assert self.rados.pool_exists(self.pool)
+ self.ioctx = self.rados.open_ioctx(self.pool)
+
+ def tearDown(self):
+ cmd = {"prefix": "osd unset", "key": "noup"}
+ self.rados.mon_command(json.dumps(cmd), b'')
+ self.ioctx.close()
+ self.rados.delete_pool(self.pool)
+ self.rados.shutdown()
+
+ def test_alignment(self):
+ eq(self.ioctx.alignment(), 8192)
+
+
class TestIoctx2(object):
def setUp(self):