]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Actually encode the SolidFire json dump result
authorJohn Griffith <john.griffith8@gmail.com>
Wed, 13 Aug 2014 21:25:49 +0000 (15:25 -0600)
committerJohn Griffith <john.griffith8@gmail.com>
Wed, 13 Aug 2014 21:25:49 +0000 (15:25 -0600)
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

index a6e90d25078c7dce0c272a21f8f64e697659770e..5e1248a850472139fc4d6b782c09483ef7c4d9c8 100644 (file)
@@ -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 '