Browse Source

VNX/Powermax: Make it work under python3

Add and remove the unnecessary `encode`.

Change-Id: I2fbbd9d3950d4b68eca9905839a1f910e5a8ce4a
Closes-bug: #1853805
(cherry picked from commit ddfb07987b)
(cherry picked from commit ce302d04ec)
changes/47/701647/1
Ryan Liang 6 months ago
parent
commit
0dc9e9105e
4 changed files with 5 additions and 5 deletions
  1. +2
    -2
      manila/share/drivers/dell_emc/common/enas/connector.py
  2. +1
    -1
      manila/share/drivers/dell_emc/common/enas/xml_api_parser.py
  3. +1
    -1
      manila/tests/share/drivers/dell_emc/common/enas/fakes.py
  4. +1
    -1
      manila/tests/share/drivers/dell_emc/common/enas/test_connector.py

+ 2
- 2
manila/share/drivers/dell_emc/common/enas/connector.py View File

@@ -58,7 +58,7 @@ class XMLAPIConnector(object):
credential = ('user=' + self.username
+ '&password=' + self.password
+ '&Login=Login')
req = url_request.Request(self.auth_url, credential,
req = url_request.Request(self.auth_url, credential.encode(),
constants.CONTENT_TYPE_URLENCODE)
resp = self.url_opener.open(req)
resp_body = resp.read()
@@ -98,7 +98,7 @@ class XMLAPIConnector(object):

def _request(self, req_body=None, method=None,
header=constants.CONTENT_TYPE_URLENCODE):
req = url_request.Request(self._url, req_body, header)
req = url_request.Request(self._url, req_body.encode(), header)
if method not in (None, 'GET', 'POST'):
req.get_method = lambda: method
self._http_log_req(req)

+ 1
- 1
manila/share/drivers/dell_emc/common/enas/xml_api_parser.py View File

@@ -56,7 +56,7 @@ class XMLAPIParser(object):

events = ("start", "end")

context = etree.iterparse(six.BytesIO(xml.encode('utf-8')),
context = etree.iterparse(six.BytesIO(xml),
events=events)
for action, elem in context:
self.tag = self._remove_ns(elem.tag)

+ 1
- 1
manila/tests/share/drivers/dell_emc/common/enas/fakes.py View File

@@ -55,7 +55,7 @@ def response(func):
'xml_api"><Response>'
+ func(*args, **kwargs)
+ '</Response></ResponsePacket>'
)
).encode()

return inner


+ 1
- 1
manila/tests/share/drivers/dell_emc/common/enas/test_connector.py View File

@@ -46,7 +46,7 @@ class XMLAPIConnectorTestData(object):
'user=' + fakes.FakeData.emc_nas_login
+ '&password=' + fakes.FakeData.emc_nas_password
+ '&Login=Login'
)
).encode()

@staticmethod
def req_url_encode():

Loading…
Cancel
Save