Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi,

We're using ceph as a glance backend and I was testing it only with RAW images (not qcow2), but I think this logic is applicable for all types of images. Probably this information will help someone and will save some time.

So, glance stores information about image location in it's database within table image_locations In case of ceph, when disk is added, glance also creates snapshot to it. And actually a snapshot is the image itself. So in order to get md5 of the image you should calculate md5sum of image location (which is retrieved from value field of image_locations table)

In case of ceph, it would be an rbd drive. So, for example, you have image with UUID c30444c5-eec2-46e2-b5d1-cae1e70a02af, so you are about to launch request:

MariaDB [glance]> select * from image_locations where image_id = 'c30444c5-eec2-46e2-b5d1-cae1e70a02af';
+----+--------------------------------------+---------------------------------------------------------------------------------------------+---------------------+---------------------+------------+---------+-----------+--------+
| id | image_id                             | value                                                                                       | created_at          | updated_at          | deleted_at | deleted | meta_data | status |
+----+--------------------------------------+---------------------------------------------------------------------------------------------+---------------------+---------------------+------------+---------+-----------+--------+
| 14 | c30444c5-eec2-46e2-b5d1-cae1e70a02af | rbd://9be0420c-8d0c-40e3-ac68-3e3cef496c63/images/c30444c5-eec2-46e2-b5d1-cae1e70a02af/snap | 2018-03-23 19:29:14 | 2018-03-23 19:29:14 | NULL       |       0 | {}        | active |
+----+--------------------------------------+---------------------------------------------------------------------------------------------+---------------------+---------------------+------------+---------+-----------+--------+

Next you need to map an rbd drive:

rbd map images/c30444c5-eec2-46e2-b5d1-cae1e70a02af@snap

And you're ready to calculate md5sum:

dd if=/dev/rbd0 | md5sum