diff options
author | Mykola Golub <mgolub@suse.com> | 2018-03-15 17:32:50 +0100 |
---|---|---|
committer | Mykola Golub <mgolub@suse.com> | 2018-03-16 19:05:34 +0100 |
commit | d75973f8b3f0e0e662ce36f271f8fdf80b5b4220 (patch) | |
tree | 618b5854accb23e413075bfd88b6a96f0167d37c /src/test/pybind | |
parent | Merge pull request #20911 from guzhongyan/ConfM-cleanup (diff) | |
download | ceph-d75973f8b3f0e0e662ce36f271f8fdf80b5b4220.tar.xz ceph-d75973f8b3f0e0e662ce36f271f8fdf80b5b4220.zip |
librbd: add API function to get image name
We already have open_by_id function, so an image name may be
unknown to the user, and get_name may be useful then.
Signed-off-by: Mykola Golub <mgolub@suse.com>
Diffstat (limited to 'src/test/pybind')
-rw-r--r-- | src/test/pybind/test_rbd.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py index 6ce6c32c9d5..355ea6ded71 100644 --- a/src/test/pybind/test_rbd.py +++ b/src/test/pybind/test_rbd.py @@ -290,6 +290,18 @@ def test_open_readonly_dne(): assert_raises(ImageNotFound, Image, ioctx, image_name, 'snap', read_only=True) +@require_new_format() +def test_open_by_id(): + with Rados(conffile='') as cluster: + with cluster.open_ioctx(pool_name) as ioctx: + image_name = get_temp_image_name() + RBD().create(ioctx, image_name, IMG_SIZE) + with Image(ioctx, image_name) as image: + image_id = image.id() + with Image(ioctx, image_id=image_id) as image: + eq(image.get_name(), image_name) + RBD().remove(ioctx, image_name) + def test_remove_dne(): assert_raises(ImageNotFound, remove_image) |