]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add parsing to extra-specs key check
authorJohn Griffith <john.griffith@solidfire.com>
Wed, 10 Apr 2013 05:07:52 +0000 (23:07 -0600)
committerJohn Griffith <john.griffith@solidfire.com>
Fri, 3 May 2013 21:33:29 +0000 (15:33 -0600)
When using the filter scheduler which is now the default,
we can no longer pass in extra-specs like: {minIOPS:500, ....},
because the capabilities filter will reject this because there is
no host reporting minIOPS:500 capabilities.

We now need to scope the keys (ie qos:minIOPS:500....), but
that unfortunately requires a fix to the SolidFire driver.

This change add a check for the ':' in the key, and parses
on it if it's there.

Also fixes backend_name and uses VERSION var instead of
generating string in stats reporting.

Fixes bug: 1167141

Change-Id: Ie7fd7d231af78cb18a13f44a4379b44d3c3385df
(cherry picked from commit 0e3ea4e85dab00b7cecd5596f6daa65cc4d710b5)

cinder/volume/drivers/solidfire.py

index 8d0c55280761f031d6dd027b49c2a322e4085178..840cecce78d7875560f56174223074c21e9759e4 100644 (file)
@@ -33,7 +33,7 @@ from cinder.openstack.common import log as logging
 from cinder.volume.drivers.san.san import SanISCSIDriver
 from cinder.volume import volume_types
 
-VERSION = 1.2
+VERSION = '1.2'
 LOG = logging.getLogger(__name__)
 
 sf_opts = [
@@ -369,6 +369,9 @@ class SolidFire(SanISCSIDriver):
         volume_type = volume_types.get_volume_type(ctxt, type_id)
         specs = volume_type.get('extra_specs')
         for key, value in specs.iteritems():
+            if ':' in key:
+                fields = key.split(':')
+                key = fields[1]
             if key in self.sf_qos_keys:
                 qos[key] = int(value)
         return qos
@@ -560,9 +563,10 @@ class SolidFire(SanISCSIDriver):
             results['maxProvisionedSpace'] - results['usedSpace']
 
         data = {}
-        data["volume_backend_name"] = self.__class__.__name__
+        backend_name = self.configuration.safe_get('volume_backend_name')
+        data["volume_backend_name"] = backend_name or self.__class__.__name__
         data["vendor_name"] = 'SolidFire Inc'
-        data["driver_version"] = '1.2'
+        data["driver_version"] = VERSION
         data["storage_protocol"] = 'iSCSI'
 
         data['total_capacity_gb'] = results['maxProvisionedSpace']