Merge "convert unicode to string before we connect to rados"
This commit is contained in:
commit
acd7d3a00c
@ -307,6 +307,12 @@ class RbdTestCase(test.NoDBTestCase):
|
||||
mock_rados.Rados.open_ioctx.assert_called_once_with(self.rbd_pool)
|
||||
mock_rados.Rados.shutdown.assert_called_once_with()
|
||||
|
||||
@mock.patch.object(rbd_utils, 'rados')
|
||||
def test_connect_to_rados_unicode_arg(self, mock_rados):
|
||||
self.driver._connect_to_rados(u'unicode_pool')
|
||||
self.mock_rados.Rados.open_ioctx.assert_called_with(
|
||||
test.MatchType(str))
|
||||
|
||||
def test_ceph_args_none(self):
|
||||
self.driver.rbd_user = None
|
||||
self.driver.ceph_conf = None
|
||||
|
@ -135,7 +135,11 @@ class RBDDriver(object):
|
||||
try:
|
||||
client.connect()
|
||||
pool_to_open = pool or self.pool
|
||||
ioctx = client.open_ioctx(pool_to_open)
|
||||
# NOTE(luogangyi): open_ioctx >= 10.1.0 could handle unicode
|
||||
# arguments perfectly as part of Python 3 support.
|
||||
# Therefore, when we turn to Python 3, it's safe to remove
|
||||
# str() conversion.
|
||||
ioctx = client.open_ioctx(str(pool_to_open))
|
||||
return client, ioctx
|
||||
except rados.Error:
|
||||
# shutdown cannot raise an exception
|
||||
|
Loading…
Reference in New Issue
Block a user