From: Jesse Keating Date: Tue, 25 Aug 2015 15:33:32 +0000 (-0700) Subject: Fix nimble storage volume stats reporting X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=8855feea30b230029e853f373e37806b7bacba7e;p=openstack-build%2Fcinder-build.git Fix nimble storage volume stats reporting 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 --- diff --git a/cinder/tests/unit/test_nimble.py b/cinder/tests/unit/test_nimble.py index fd4b24aa5..f32a73459 100755 --- a/cinder/tests/unit/test_nimble.py +++ b/cinder/tests/unit/test_nimble.py @@ -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)) diff --git a/cinder/volume/drivers/nimble.py b/cinder/volume/drivers/nimble.py index 573bc2d43..2c4eb4462 100755 --- a/cinder/volume/drivers/nimble.py +++ b/cinder/volume/drivers/nimble.py @@ -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):