From: Victor Stinner Date: Mon, 29 Jun 2015 20:20:16 +0000 (+0200) Subject: Port hitachi driver to Python 3 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=1a725db61e1b30317a7faa35ccf46fbd2ae9d6e8;p=openstack-build%2Fcinder-build.git Port hitachi driver to Python 3 * On Python 3, shlex expects Unicode, not bytes: don't encode * Replace map() with list-comprehension where a list is expected. * tox.ini: add cinder.tests.unit.test_hitachi_hbsd_horcm_fc to Python 3.4 Blueprint cinder-python3 Change-Id: Id0db0dabef98f7dd8331a5149e88dee0622917b3 --- diff --git a/cinder/volume/drivers/hitachi/hbsd_basiclib.py b/cinder/volume/drivers/hitachi/hbsd_basiclib.py index 8fc59912f..f4bc75779 100644 --- a/cinder/volume/drivers/hitachi/hbsd_basiclib.py +++ b/cinder/volume/drivers/hitachi/hbsd_basiclib.py @@ -244,7 +244,7 @@ class HBSDBasicLib(object): cmd = [cmd] if args: - if isinstance(args, six.text_type): + if six.PY2 and isinstance(args, six.text_type): cmd += shlex.split(args.encode()) else: cmd += shlex.split(args) diff --git a/cinder/volume/drivers/hitachi/hbsd_horcm.py b/cinder/volume/drivers/hitachi/hbsd_horcm.py index 0ebe8f00d..c551f624c 100644 --- a/cinder/volume/drivers/hitachi/hbsd_horcm.py +++ b/cinder/volume/drivers/hitachi/hbsd_horcm.py @@ -167,7 +167,7 @@ class HBSDHORCM(basic_lib.HBSDBasicLib): if not i.isdigit(): msg = basic_lib.output_err(601, param='hitachi_horcm_numbers') raise exception.HBSDError(message=msg) - self.conf.hitachi_horcm_numbers = map(int, numbers) + self.conf.hitachi_horcm_numbers = [int(num) for num in numbers] inst = self.conf.hitachi_horcm_numbers[0] pair_inst = self.conf.hitachi_horcm_numbers[1] if inst == pair_inst: diff --git a/tox.ini b/tox.ini index 144737a4a..4ab49a9cd 100644 --- a/tox.ini +++ b/tox.ini @@ -49,6 +49,7 @@ commands = cinder.tests.unit.test_evaluator \ cinder.tests.unit.test_exception \ cinder.tests.unit.test_gpfs \ + cinder.tests.unit.test_hitachi_hbsd_horcm_fc \ cinder.tests.unit.test_hitachi_hbsd_snm2_fc \ cinder.tests.unit.test_hitachi_hbsd_snm2_iscsi \ cinder.tests.unit.test_hp_xp_fc \