From 1e70cb8d4dace3c3372cd6e1bb13060becf25c6a Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 19 Dec 2016 08:59:59 +0000 Subject: [PATCH] rbd: Remove unnecessary 'encode' calls The ceph 'rbd' library (librados) now supports Python 3 and, by extension, unicode strings [1]. There is no need to keep these encode calls around: if a user is running nova under Python 3, then it is safe to assume that they are using a Python 3-compatible version of librados. [1] https://github.com/ceph/ceph/blob/v11.1.0/src/pybind/rados/rados.pyx#L30-L36 Change-Id: Ic1afb3e66bd0991047f97fa74f9d2fbbb837401a --- nova/tests/unit/virt/libvirt/storage/test_rbd.py | 3 +-- nova/virt/libvirt/storage/rbd_utils.py | 11 +++++------ .../ceph-minimum-version-bump-6ef4597c3e117201.yaml | 6 ++++++ 3 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/ceph-minimum-version-bump-6ef4597c3e117201.yaml diff --git a/nova/tests/unit/virt/libvirt/storage/test_rbd.py b/nova/tests/unit/virt/libvirt/storage/test_rbd.py index 3fab3196bbb6..fb97fc003734 100644 --- a/nova/tests/unit/virt/libvirt/storage/test_rbd.py +++ b/nova/tests/unit/virt/libvirt/storage/test_rbd.py @@ -13,7 +13,6 @@ from eventlet import tpool import mock -import six from nova.compute import task_states from nova import exception @@ -223,7 +222,7 @@ class RbdTestCase(test.NoDBTestCase): self.driver.clone(location, self.volume_name) - args = [client_stack[0].ioctx, six.b(image), six.b(snap), + args = [client_stack[0].ioctx, image, snap, client_stack[1].ioctx, str(self.volume_name)] kwargs = {'features': client.features} rbd.clone.assert_called_once_with(*args, **kwargs) diff --git a/nova/virt/libvirt/storage/rbd_utils.py b/nova/virt/libvirt/storage/rbd_utils.py index 974b5a924464..750c9ed5cd70 100644 --- a/nova/virt/libvirt/storage/rbd_utils.py +++ b/nova/virt/libvirt/storage/rbd_utils.py @@ -66,10 +66,9 @@ class RBDVolumeProxy(object): read_only=False): client, ioctx = driver._connect_to_rados(pool) try: - snap_name = snapshot.encode('utf8') if snapshot else None - self.volume = tpool.Proxy(rbd.Image(ioctx, name.encode('utf8'), - snapshot=snap_name, - read_only=read_only)) + self.volume = tpool.Proxy(rbd.Image(ioctx, name, + snapshot=snapshot, + read_only=read_only)) except rbd.ImageNotFound: with excutils.save_and_reraise_exception(): LOG.debug("rbd image %s does not exist", name) @@ -236,8 +235,8 @@ class RBDDriver(object): with RADOSClient(self, dest_pool) as dest_client: try: RbdProxy().clone(src_client.ioctx, - image.encode('utf-8'), - snapshot.encode('utf-8'), + image, + snapshot, dest_client.ioctx, str(dest_name), features=src_client.features) diff --git a/releasenotes/notes/ceph-minimum-version-bump-6ef4597c3e117201.yaml b/releasenotes/notes/ceph-minimum-version-bump-6ef4597c3e117201.yaml new file mode 100644 index 000000000000..dad5ab82361d --- /dev/null +++ b/releasenotes/notes/ceph-minimum-version-bump-6ef4597c3e117201.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + Nova now requires Ceph/librados >= 11.1.0 if running under Python 3 with + the RBD image backend for the libvirt driver. Requirements for Python 2 + users or users using a different backend remain unchanged.