]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix nimble storage volume stats reporting
authorJesse Keating <jlk@bluebox.net>
Tue, 25 Aug 2015 15:33:32 +0000 (08:33 -0700)
committerJesse Keating <jlk@bluebox.net>
Tue, 25 Aug 2015 15:33:32 +0000 (08:33 -0700)
Capacity now needs to be reported in a pool, to support pool-aware
scheduling which was introduced in the Juno development cycle.

Change-Id: I1a3ea2c75bc0296868e281a3fbfb6636ab0f0e3e

cinder/tests/unit/test_nimble.py
cinder/volume/drivers/nimble.py

index fd4b24aa5608cca495b4cd046480a6669644e91f..f32a73459afc9115af6e6f3451eeccf2877ac3d5 100755 (executable)
@@ -467,14 +467,15 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
     def test_get_volume_stats(self):
         self.mock_client_service.service.getGroupConfig.return_value = \
             FAKE_POSITIVE_GROUP_CONFIG_RESPONSE
-        expected_res = {'driver_version': '1.1.2',
-                        'total_capacity_gb': 7466.30419921875,
-                        'QoS_support': False,
-                        'reserved_percentage': 0,
+        expected_res = {'driver_version': '1.1.3',
                         'vendor_name': 'Nimble',
                         'volume_backend_name': 'NIMBLE',
                         'storage_protocol': 'iSCSI',
-                        'free_capacity_gb': 7463.567649364471}
+                        'pools': [{'pool_name': 'NIMBLE',
+                                   'total_capacity_gb': 7466.30419921875,
+                                   'free_capacity_gb': 7463.567649364471,
+                                   'reserved_percentage': 0,
+                                   'QoS_support': False}]}
         self.assertEqual(
             expected_res,
             self.driver.get_volume_stats(refresh=True))
index 573bc2d434f810ce21d19456509bd13a715583d2..2c4eb4462444c5ed275465a06575bc45d827244a 100755 (executable)
@@ -37,7 +37,7 @@ from cinder.volume.drivers.san import san
 from cinder.volume import volume_types
 
 
-DRIVER_VERSION = '1.1.2'
+DRIVER_VERSION = '1.1.3'
 AES_256_XTS_CIPHER = 2
 DEFAULT_CIPHER = 3
 EXTRA_SPEC_ENCRYPTION = 'nimble:encryption'
@@ -86,6 +86,7 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
         1.1.0 - Added Extra Spec Capability
         1.1.1 - Updated VERSION to Nimble driver version
         1.1.2 - Update snap-quota to unlimited
+        1.1.3 - Correct capacity reporting
     """
 
     VERSION = DRIVER_VERSION
@@ -281,11 +282,16 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
             self.group_stats = {'volume_backend_name': backend_name,
                                 'vendor_name': 'Nimble',
                                 'driver_version': DRIVER_VERSION,
-                                'storage_protocol': 'iSCSI',
-                                'total_capacity_gb': total_capacity,
-                                'free_capacity_gb': free_space,
-                                'reserved_percentage': 0,
-                                'QoS_support': False}
+                                'storage_protocol': 'iSCSI'}
+            # Just use a single pool for now, FIXME to support multiple
+            # pools
+            single_pool = dict(
+                pool_name=backend_name,
+                total_capacity_gb=total_capacity,
+                free_capacity_gb=free_space,
+                reserved_percentage=0,
+                QoS_support=False)
+            self.group_stats['pools'] = [single_pool]
         return self.group_stats
 
     def extend_volume(self, volume, new_size):