From: John Griffith <john.griffith8@gmail.com>
Date: Wed, 13 Aug 2014 21:25:49 +0000 (-0600)
Subject: Actually encode the SolidFire json dump result
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=49b54af36a2aacd3d27330636f61d6f996016d65;p=openstack-build%2Fcinder-build.git

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
---

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 '