From 935107d5a28e644a046e4a64782c0bd4bb8a7ab0 Mon Sep 17 00:00:00 2001 From: john-griffith Date: Mon, 3 Feb 2014 20:22:33 -0700 Subject: [PATCH] Update SolidFire Driver to use cinder's units 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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cinder/volume/drivers/solidfire.py b/cinder/volume/drivers/solidfire.py index 31b0b99af..ed79444d2 100644 --- a/cinder/volume/drivers/solidfire.py +++ b/cinder/volume/drivers/solidfire.py @@ -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') -- 2.45.2