rbd: export image name

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
This commit is contained in:
Seena Fallah 2021-11-01 13:27:16 +03:30 committed by mergify[bot]
parent a46d9cbd62
commit bae93ac4ab
3 changed files with 17 additions and 0 deletions

View File

@ -1407,6 +1407,10 @@
"name": "Image.GetId", "name": "Image.GetId",
"comment": "GetId returns the internal image ID string.\n\nImplements:\n int rbd_get_id(rbd_image_t image, char *id, size_t id_len);\n" "comment": "GetId returns the internal image ID string.\n\nImplements:\n int rbd_get_id(rbd_image_t image, char *id, size_t id_len);\n"
}, },
{
"name": "Image.GetName",
"comment": "GetName returns the image name."
},
{ {
"name": "Image.SetSnapshot", "name": "Image.SetSnapshot",
"comment": "SetSnapshot updates the rbd image (not the Snapshot) such that the snapshot\nis the source of readable data.\n\nImplements:\n int rbd_snap_set(rbd_image_t image, const char *snapname);\n" "comment": "SetSnapshot updates the rbd image (not the Snapshot) such that the snapshot\nis the source of readable data.\n\nImplements:\n int rbd_snap_set(rbd_image_t image, const char *snapname);\n"

View File

@ -951,6 +951,11 @@ func (image *Image) GetId() (string, error) {
} }
// GetName returns the image name.
func (image *Image) GetName() string {
return image.name
}
// SetSnapshot updates the rbd image (not the Snapshot) such that the snapshot // SetSnapshot updates the rbd image (not the Snapshot) such that the snapshot
// is the source of readable data. // is the source of readable data.
// //

View File

@ -1641,6 +1641,14 @@ func TestGetId(t *testing.T) {
conn.Shutdown() conn.Shutdown()
} }
func TestGetName(t *testing.T) {
image := Image{
name: "testImg",
}
imgName := image.GetName()
assert.Equal(t, image.name, imgName)
}
func TestOpenImageById(t *testing.T) { func TestOpenImageById(t *testing.T) {
conn := radosConnect(t) conn := radosConnect(t)