]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Update SolidFire Driver to use cinder's units
authorjohn-griffith <john.griffith@solidfire.com>
Tue, 4 Feb 2014 03:22:33 +0000 (20:22 -0700)
committerjohn-griffith <john.griffith@solidfire.com>
Tue, 4 Feb 2014 03:22:33 +0000 (20:22 -0700)
The SolidFire driver uses math module and it's own
local GB variable.

This patch just removes that and uses the GiB def
that already exists in cinder.units.

Change-Id: I4fc167bd61dbb609bd325b4a32b120bf55db02fa

cinder/volume/drivers/solidfire.py

index 31b0b99afa5acff6a294a6398dd8961727a2f645..ed79444d2a10b467f1cab1b784cbf0a0a1f424d1 100644 (file)
@@ -16,7 +16,6 @@
 import base64
 import httplib
 import json
-import math
 import random
 import socket
 import string
@@ -29,6 +28,7 @@ from cinder import context
 from cinder import exception
 from cinder.openstack.common import log as logging
 from cinder.openstack.common import timeutils
+from cinder import units
 from cinder.volume.drivers.san.san import SanISCSIDriver
 from cinder.volume import qos_specs
 from cinder.volume import volume_types
@@ -89,8 +89,6 @@ class SolidFireDriver(SanISCSIDriver):
     sf_qos_keys = ['minIOPS', 'maxIOPS', 'burstIOPS']
     cluster_stats = {}
 
-    GB = math.pow(2, 30)
-
     def __init__(self, *args, **kwargs):
         super(SolidFireDriver, self).__init__(*args, **kwargs)
         self.configuration.append_config_values(sf_opts)
@@ -358,7 +356,7 @@ class SolidFireDriver(SanISCSIDriver):
 
         params = {'volumeID': int(sf_vol['volumeID']),
                   'name': 'UUID-%s' % v_ref['id'],
-                  'newSize': int(new_size * self.GB),
+                  'newSize': int(new_size * units.GiB),
                   'newAccountID': sfaccount['accountID']}
         data = self._issue_api_request('CloneVolume', params)
 
@@ -523,7 +521,7 @@ class SolidFireDriver(SanISCSIDriver):
         params = {'name': 'UUID-%s' % volume['id'],
                   'accountID': None,
                   'sliceCount': slice_count,
-                  'totalSize': int(volume['size'] * self.GB),
+                  'totalSize': int(volume['size'] * units.GiB),
                   'enable512e': self.configuration.sf_emulate_512,
                   'attributes': attributes,
                   'qos': qos}
@@ -649,7 +647,7 @@ class SolidFireDriver(SanISCSIDriver):
 
         params = {
             'volumeID': sf_vol['volumeID'],
-            'totalSize': int(new_size * self.GB)
+            'totalSize': int(new_size * units.GiB)
         }
         data = self._issue_api_request('ModifyVolume',
                                        params, version='5.0')