NEC Driver: Python3 compatibility

This patch fixes Python3 incompatible codes in NEC driver.

Change-Id: Ife4586de6fab2150334a06bf90031df4c81a045b
(cherry picked from commit c6c26a56a2)
This commit is contained in:
Naoki Saito 2019-08-21 20:58:01 +09:00
parent 585d3d8586
commit c7bfeed194

View File

@ -28,6 +28,7 @@ from cinder import coordination
from cinder import exception
from cinder.i18n import _
from cinder import ssh_utils
from cinder import utils
LOG = logging.getLogger(__name__)
@ -162,7 +163,8 @@ class MStorageISMCLI(object):
break
LOG.debug('`%(command)s` done. status=%(status)d.',
{'command': command, 'status': status})
out, err = ''.join(_out), ''.join(_err)
out = self._join_and_convert_str(_out)
err = self._join_and_convert_str(_err)
if expected_status is not None and status not in expected_status:
LOG.debug('`%(command)s` failed. status=%(status)d, '
'out="%(out)s", err="%(err)s".',
@ -671,6 +673,14 @@ class MStorageISMCLI(object):
'cvnumber': cvnumber})
self._execute(cmd)
def _join_and_convert_str(self, src_list):
if len(src_list) == 0:
return ''
if isinstance(src_list[0], bytes):
return utils.convert_str(b''.join(src_list))
else:
return ''.join(src_list)
class UnpairWait(object):