Fix Python 3 issues in backup
* Replace (int, long) with six.integer_types: the "long" type has been
removed in Python 3
* Replace str.encode("bas64") with base64.encodestring(str), base64
text codec has been removed in Python 3. Same change for decode
(base64.decodestring)
* On Python 3, encode JSON to UTF-8
* tox.ini: add the following tests to Python 3
- cinder.tests.unit.test_backup
- cinder.tests.unit.test_backup_driver_base
Blueprint cinder-python3
Change-Id: I86e04f8fbe9a3ce8849fd141dc3ee914e73c8796
This commit is contained in:
@@ -347,7 +347,7 @@ class DbQuotaDriver(object):
|
||||
# Set up the reservation expiration
|
||||
if expire is None:
|
||||
expire = CONF.reservation_expire
|
||||
if isinstance(expire, (int, long)):
|
||||
if isinstance(expire, six.integer_types):
|
||||
expire = datetime.timedelta(seconds=expire)
|
||||
if isinstance(expire, datetime.timedelta):
|
||||
expire = timeutils.utcnow() + expire
|
||||
|
||||
Reference in New Issue
Block a user