mirror of
https://github.com/ceph/ceph
synced 2025-01-04 02:02:36 +00:00
Fixes for python omap method return values.
Signed-off-by: Roland Mechler <rmechler@cisco.com>
This commit is contained in:
parent
ef0678a3bc
commit
0b0d584626
@ -2799,7 +2799,9 @@ returned %d, but should return zero on success." % (self.name, ret))
|
||||
int _flags = flags
|
||||
|
||||
with nogil:
|
||||
rados_write_op_operate(_write_op.write_op, self.io, _oid, &_mtime, _flags)
|
||||
ret = rados_write_op_operate(_write_op.write_op, self.io, _oid, &_mtime, _flags)
|
||||
if (ret != 0):
|
||||
raise make_ex(ret, "Failed to operate write op for oid %s" % oid)
|
||||
|
||||
@requires(('read_op', ReadOp), ('oid', str_type), ('flag', opt(int)))
|
||||
def operate_read_op(self, read_op, oid, flag=LIBRADOS_OPERATION_NOFLAG):
|
||||
@ -2819,7 +2821,9 @@ returned %d, but should return zero on success." % (self.name, ret))
|
||||
int _flag = flag
|
||||
|
||||
with nogil:
|
||||
rados_read_op_operate(_read_op.read_op, self.io, _oid, _flag)
|
||||
ret = rados_read_op_operate(_read_op.read_op, self.io, _oid, _flag)
|
||||
if (ret != 0):
|
||||
raise make_ex(ret, "Failed to operate read op for oid %s" % oid)
|
||||
|
||||
@requires(('read_op', ReadOp), ('start_after', str_type), ('filter_prefix', str_type), ('max_return', int))
|
||||
def get_omap_vals(self, read_op, start_after, filter_prefix, max_return):
|
||||
@ -2871,7 +2875,7 @@ returned %d, but should return zero on success." % (self.name, ret))
|
||||
ReadOp _read_op = read_op
|
||||
rados_omap_iter_t iter_addr = NULL
|
||||
int _max_return = max_return
|
||||
int prval
|
||||
int prval = 0
|
||||
|
||||
with nogil:
|
||||
rados_read_op_omap_get_keys(_read_op.read_op, _start_after,
|
||||
@ -2896,7 +2900,7 @@ returned %d, but should return zero on success." % (self.name, ret))
|
||||
rados_omap_iter_t iter_addr
|
||||
char **_keys = to_bytes_array(keys)
|
||||
size_t key_num = len(keys)
|
||||
int prval
|
||||
int prval = 0
|
||||
|
||||
try:
|
||||
with nogil:
|
||||
|
@ -447,16 +447,19 @@ class TestIoctx(object):
|
||||
self.ioctx.operate_write_op(write_op, "hw")
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals(read_op, "", "", 4)
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
next(iter)
|
||||
eq(list(iter), [("2", b"bbb"), ("3", b"ccc"), ("4", b"\x04\x04\x04\x04")])
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals(read_op, "2", "", 4)
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
eq(("3", b"ccc"), next(iter))
|
||||
eq(list(iter), [("4", b"\x04\x04\x04\x04")])
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals(read_op, "", "2", 4)
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
eq(list(iter), [("2", b"bbb")])
|
||||
|
||||
@ -468,8 +471,14 @@ class TestIoctx(object):
|
||||
self.ioctx.operate_write_op(write_op, "hw")
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals_by_keys(read_op,("3","4",))
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
eq(list(iter), [("3", b"ccc"), ("4", b"\x04\x04\x04\x04")])
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals_by_keys(read_op,("3","4",))
|
||||
eq(ret, 0)
|
||||
with assert_raises(ObjectNotFound):
|
||||
self.ioctx.operate_read_op(read_op, "no_such")
|
||||
|
||||
def test_get_omap_keys(self):
|
||||
keys = ("1", "2", "3")
|
||||
@ -479,8 +488,14 @@ class TestIoctx(object):
|
||||
self.ioctx.operate_write_op(write_op, "hw")
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_keys(read_op,"",2)
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
eq(list(iter), [("1", None), ("2", None)])
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_keys(read_op,"",2)
|
||||
eq(ret, 0)
|
||||
with assert_raises(ObjectNotFound):
|
||||
self.ioctx.operate_read_op(read_op, "no_such")
|
||||
|
||||
def test_clear_omap(self):
|
||||
keys = ("1", "2", "3")
|
||||
@ -493,6 +508,7 @@ class TestIoctx(object):
|
||||
self.ioctx.operate_write_op(write_op_1, "hw")
|
||||
with ReadOpCtx(self.ioctx) as read_op:
|
||||
iter, ret = self.ioctx.get_omap_vals_by_keys(read_op,("1",))
|
||||
eq(ret, 0)
|
||||
self.ioctx.operate_read_op(read_op, "hw")
|
||||
eq(list(iter), [])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user