Comment 0 for bug 1816721

Revision history for this message
Michal Arbet (michalarbet) wrote : Python3 librados incompatibility

Hello, found a bug in glance. Glance is storing bad direct_url='rbd://b%27868c2b5d-12f1-4f3f-aa2a-5701a3bb1041%27/images/7b1f429e-ad2f-40b2-be9e-8552edae8938/snap' in database. This is causing several problems, as in https://bugs.launchpad.net/cinder/+bug/1816468

root@openstack-controller:/tmp# openstack image create --container-format bare --disk-format raw --file cirros-0.3.4-x86_64-disk.img cirros-test-1

+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2019-02-20T09:08:45Z |
| disk_format | raw |
| file | /v2/images/7b1f429e-ad2f-40b2-be9e-8552edae8938/file |
| id | 7b1f429e-ad2f-40b2-be9e-8552edae8938 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros-test-1 |
| owner | ba5ef70fd99642fdb75c9307c88b1164 |
| properties | direct_url='rbd://b%27868c2b5d-12f1-4f3f-aa2a-5701a3bb1041%27/images/7b1f429e-ad2f-40b2-be9e-8552edae8938/snap', os_hash_algo='sha512', os_hash_value='1b03ca1bc3fafe448b90583c12f367949f8b0e665685979d95b004e48574b953316799e23240f4f739d1b5eb4c4ca24d38fdc6f4f9d8247a2bc64db25d6bbdb2', os_hidden='False' |
| protected | False |
| schema | /v2/schemas/image |
| size | 13287936 |
| status | active |
| tags | |
| updated_at | 2019-02-20T09:08:48Z |
| virtual_size | None |
| visibility | shared |
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

mysql> select * from image_locations where image_id = '7b1f429e-ad2f-40b2-be9e-8552edae8938'\G;
*************************** 1. row ***************************
        id: 32
  image_id: 7b1f429e-ad2f-40b2-be9e-8552edae8938
     value: rbd://b%27868c2b5d-12f1-4f3f-aa2a-5701a3bb1041%27/images/7b1f429e-ad2f-40b2-be9e-8552edae8938/snap
created_at: 2019-02-20 09:08:48
updated_at: 2019-02-20 09:08:48
deleted_at: NULL
   deleted: 0
 meta_data: {}
    status: active
1 row in set (0.00 sec)

ERROR:
No query specified

get_fsid function from librados returns different ID representation, in py2 it is STR, in py3 it is bytes.

It can be fixed by oslo_utils.encodeutils.safe_decode

I will post the change.