mirror of
https://github.com/ceph/ceph
synced 2024-12-29 06:52:35 +00:00
Merge pull request #34134 from zhangdaolong/fix_incorrect_log_info
pybind/rbd: fix no lockers are obtained, ImageNotFound exception will be output
This commit is contained in:
commit
3cd90d751b
@ -5493,6 +5493,9 @@ cdef class LockOwnerIterator(object):
|
||||
&self.num_lock_owners)
|
||||
if ret >= 0:
|
||||
break
|
||||
elif ret == -errno.ENOENT:
|
||||
self.num_lock_owners = 0
|
||||
break
|
||||
elif ret != -errno.ERANGE:
|
||||
raise make_ex(ret, 'error listing lock owners for image %s' % image.name)
|
||||
|
||||
|
@ -1859,10 +1859,13 @@ class TestExclusiveLock(object):
|
||||
rados2.conf_set('rbd_blacklist_on_break_lock', 'true')
|
||||
with Image(ioctx2, image_name) as image, \
|
||||
Image(blacklist_ioctx, image_name) as blacklist_image:
|
||||
|
||||
lock_owners = list(image.lock_get_owners())
|
||||
eq(0, len(lock_owners))
|
||||
|
||||
blacklist_image.lock_acquire(RBD_LOCK_MODE_EXCLUSIVE)
|
||||
assert_raises(ReadOnlyImage, image.lock_acquire,
|
||||
RBD_LOCK_MODE_EXCLUSIVE)
|
||||
|
||||
lock_owners = list(image.lock_get_owners())
|
||||
eq(1, len(lock_owners))
|
||||
eq(RBD_LOCK_MODE_EXCLUSIVE, lock_owners[0]['mode'])
|
||||
|
Loading…
Reference in New Issue
Block a user