From 49b54af36a2aacd3d27330636f61d6f996016d65 Mon Sep 17 00:00:00 2001 From: John Griffith Date: Wed, 13 Aug 2014 15:25:49 -0600 Subject: [PATCH] Actually encode the SolidFire json dump result The SolidFire driver intends to do a encode on the json data to utf-8, unfortunatly it's not really doing anything because the syntax of the calls is wrong. This patch changes things to actually perform the encoding. Change-Id: I2bc94ed1fdc1dd5f9a6371ae5f63a955f213bc15 Closes-Bug: #1355622 --- cinder/volume/drivers/solidfire.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index a6e90d250..5e1248a85 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -129,8 +129,8 @@ class SolidFireDriver(SanISCSIDriver): if params is not None: command['params'] = params - payload = json.dumps(command, ensure_ascii=False) - payload.encode('utf-8') + json_string = json.dumps(command, + ensure_ascii=False).encode('utf-8') header = {'Content-Type': 'application/json-rpc; charset=utf-8'} if cluster_password is not None: @@ -140,12 +140,12 @@ class SolidFireDriver(SanISCSIDriver): cluster_password))[:-1] header['Authorization'] = 'Basic %s' % auth_key - LOG.debug("Payload for SolidFire API call: %s", payload) + LOG.debug("Payload for SolidFire API call: %s", json_string) api_endpoint = '/json-rpc/%s' % version connection = httplib.HTTPSConnection(host, port) try: - connection.request('POST', api_endpoint, payload, header) + connection.request('POST', api_endpoint, json_string, header) except Exception as ex: LOG.error(_('Failed to make httplib connection ' 'SolidFire Cluster: %s (verify san_ip ' -- 2.45.2