diff options
author | Michal Arbet <michal.arbet@ultimum.io> | 2019-02-06 18:38:22 +0100 |
---|---|---|
committer | Edward Hope-Morley <edward.hope-morley@canonical.com> | 2019-06-07 09:23:39 +0100 |
commit | 7880a5bfa7639fd6aa07d96b32da594c76940e38 (patch) | |
tree | 55dfd0cf0723b83bc733ef977da02be876c974c8 | |
parent | 840bbc424e6619572bf6e1c8a16dd22e2f2adb2c (diff) | |
download | glance_store-7880a5bfa7639fd6aa07d96b32da594c76940e38.tar.gz |
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)
-rw-r--r-- | glance_store/_drivers/rbd.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/glance_store/_drivers/rbd.py b/glance_store/_drivers/rbd.py index 74e929b..9d48661 100644 --- a/glance_store/_drivers/rbd.py +++ b/glance_store/_drivers/rbd.py @@ -24,6 +24,7 @@ import logging import math from oslo_config import cfg +from oslo_utils import encodeutils from oslo_utils import units from six.moves import urllib @@ -469,7 +470,18 @@ class Store(driver.Store): rados_id=self.user) as conn: fsid = None if hasattr(conn, 'get_fsid'): - fsid = conn.get_fsid() + # Librados's get_fsid is represented as binary + # in py3 instead of str as it is in py2. + # This is causing problems with ceph. + # Decode binary to str fixes these issues. + # Fix with encodeutils.safe_decode CAN BE REMOVED + # after librados's fix will be stable. + # + # More informations: + # https://bugs.launchpad.net/glance-store/+bug/1816721 + # https://bugs.launchpad.net/cinder/+bug/1816468 + # https://tracker.ceph.com/issues/38381 + fsid = encodeutils.safe_decode(conn.get_fsid()) with conn.open_ioctx(self.pool) as ioctx: order = int(math.log(self.WRITE_CHUNKSIZE, 2)) LOG.debug('creating image %s with order %d and size %d', |