From 069fd2ee833e091afa21a7fdce223d929ae342a3 Mon Sep 17 00:00:00 2001 From: Ji-Wei Date: Thu, 30 Jun 2016 13:01:27 +0800 Subject: [PATCH] Make divisible py3 compatible in nfs driver the code: import platform print('Python', platform.python_version()) print('3 / 2 =', 3 / 2) print('3 // 2 =', 3 // 2) print('3 / 2.0 =', 3 / 2.0) print('3 // 2.0 =', 3 // 2.0) in py2: ('Python', '2.7.10') ('3 / 2 =', 1) ('3 // 2 =', 1) ('3 / 2.0 =', 1.5) ('3 // 2.0 =', 1.0) but in py3: ('Python', '3.4.3') ('3 / 2 =' 1.5) ('3 // 2 =' 1) ('3 / 2.0 =' 1.5) ('3 // 2.0 =' 1.0) This patch modify the code to adapt to this difference. Change-Id: Ia117de378c23c4a982c362b241dd1f5d3898801c Closes-Bug: #1596137 --- cinder/volume/drivers/nfs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index cdd7a0e9f11..582ae066af9 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -321,7 +321,7 @@ class NfsDriver(driver.ExtendVD, remotefs.RemoteFSDriver): """Checks if file size at path is equal to size.""" data = image_utils.qemu_img_info(path, run_as_root=self._execute_as_root) - virt_size = data.virtual_size / units.Gi + virt_size = int(data.virtual_size / units.Gi) return virt_size == size def set_nas_security_options(self, is_new_cinder_install):