[Bug 1816721] Re: [SRU] Python3 librados incompatibility

OpenStack Infra 1816721 at bugs.launchpad.net
Thu Mar 5 15:52:14 UTC 2020


Reviewed:  https://review.opendev.org/663857
Committed: https://git.openstack.org/cgit/openstack/glance_store/commit/?id=7880a5bfa7639fd6aa07d96b32da594c76940e38
Submitter: Zuul
Branch:    stable/rocky

commit 7880a5bfa7639fd6aa07d96b32da594c76940e38
Author: Michal Arbet <michal.arbet at ultimum.io>
Date:   Wed Feb 6 18:38:22 2019 +0100

    Fix python3 compatibility of rbd get_fsid
    
    In python3 conn.get_fsid() is represented as binary.
    Because of this, direct_url is corrupted in DB.
    This patch is fixing this. More informations in
    closing bug.
    
    Closes-Bug: #1816721
    
    Change-Id: I6a89042fae63bf5c9096a6bee6774aebf3f5864b
    (cherry picked from commit 9c73370358c02fc7f308d88f4563f22969a42c96)


** Changed in: glance-store/rocky
       Status: New => Fix Committed

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to Ubuntu Cloud Archive.
https://bugs.launchpad.net/bugs/1816721

Title:
  [SRU] Python3 librados incompatibility

Status in Ubuntu Cloud Archive:
  Fix Released
Status in Ubuntu Cloud Archive rocky series:
  Fix Released
Status in Ubuntu Cloud Archive stein series:
  Fix Released
Status in glance_store:
  Fix Released
Status in glance_store rocky series:
  Fix Committed
Status in glance_store stein series:
  New
Status in glance_store train series:
  New
Status in python-glance-store package in Ubuntu:
  Invalid
Status in python-glance-store source package in Cosmic:
  Fix Released
Status in python-glance-store source package in Disco:
  Fix Released

Bug description:
  [Impact]
  For >= rocky (i.e. if using py3 packages) librados.cluster.get_fsid() is returning a binary string which results in spurious/invalid invalid characters being stored in the database e.g. for the image_location. This patch ensures that the value is converted to a normal string.

  [Test Case]
  * deploy openstack rocky (using p3 packages)
  * deploy ceph and use for glance backend
  * set
  /etc/glance/glance-api.conf:show_multiple_locations = True
  /etc/glance/glance-api.conf:show_image_direct_url = True
  * upload image
  * query image_locations table in glance db
  mysql -h$host -u${user} -p$passwd glance -e'select * from image_locations;'
  * ensure that the stored value is correct i.e. does not have "b%27" at the beginning.

  [Regression Potential]
  None expected

  [Other Info]
  Upgrading to this patch won't fix existing images, they will need to be manually updated in the database.

  ----------------------------------------------------------------------------

  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 at 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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/1816721/+subscriptions



More information about the Ubuntu-openstack-bugs mailing list