]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Update snap-quota to unlimited in Nimble driver
authorSonia Ghanekar <sonia.ghanekar@nimblestorage.com>
Tue, 4 Aug 2015 22:08:21 +0000 (15:08 -0700)
committerSonia Ghanekar <sonia.ghanekar@nimblestorage.com>
Tue, 4 Aug 2015 22:08:21 +0000 (15:08 -0700)
Change the snap-quota from limited fix size of the volume
to unlimited on the Nimble driver. This applies to creating
a new volume, extending an existing volume and creating a
clone from an existing volume snapshot.

Change-Id: Id22836559554c10074c1a14d837a09dbe01b52f8
Closes-Bug: #1463214

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

index f2d4a5cbd71886c51fc6aa7a77262b7575f11ccd..fd4b24aa5608cca495b4cd046480a6669644e91f 100755 (executable)
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import sys
+
 import mock
 from oslo_config import cfg
 
@@ -242,7 +244,8 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
                                        'display_description': ''}))
         self.mock_client_service.service.createVol.assert_called_once_with(
             request={
-                'attr': {'snap-quota': 1073741824, 'warn-level': 858993459,
+                'attr': {'snap-quota': sys.maxsize,
+                         'warn-level': 858993459,
                          'name': 'testvolume', 'reserve': 0,
                          'online': True, 'pool-name': 'default',
                          'size': 1073741824, 'quota': 1073741824,
@@ -280,7 +283,8 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
 
         self.mock_client_service.service.createVol.assert_called_once_with(
             request={
-                'attr': {'snap-quota': 1073741824, 'warn-level': 858993459,
+                'attr': {'snap-quota': sys.maxsize,
+                         'warn-level': 858993459,
                          'name': 'testvolume-encryption', 'reserve': 0,
                          'online': True, 'pool-name': 'default',
                          'size': 1073741824, 'quota': 1073741824,
@@ -318,7 +322,8 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
 
         self.mock_client_service.service.createVol.assert_called_once_with(
             request={
-                'attr': {'snap-quota': 1073741824, 'warn-level': 858993459,
+                'attr': {'snap-quota': sys.maxsize,
+                         'warn-level': 858993459,
                          'name': 'testvolume-perfpolicy', 'reserve': 0,
                          'online': True, 'pool-name': 'default',
                          'size': 1073741824, 'quota': 1073741824,
@@ -405,11 +410,11 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
         self.driver.extend_volume({'name': 'testvolume'}, 5)
         self.mock_client_service.service.editVol.assert_called_once_with(
             request={'attr': {'size': 5368709120,
-                              'snap-quota': 5368709120,
+                              'snap-quota': sys.maxsize,
                               'warn-level': 4294967296,
                               'reserve': 0,
                               'quota': 5368709120},
-                     'mask': 628,
+                     'mask': 884,
                      'name': 'testvolume',
                      'sid': 'a9b9aba7'})
 
@@ -444,7 +449,7 @@ class NimbleDriverVolumeTestCase(NimbleDriverBaseTestCase):
             mock.call.service.cloneVol(
                 request={
                     'snap-name': 'openstack-clone-volume-abcdefghijkl',
-                    'attr': {'snap-quota': 5368709120,
+                    'attr': {'snap-quota': sys.maxsize,
                              'name': 'volume',
                              'quota': 5368709120,
                              'reserve': 5368709120,
@@ -462,7 +467,7 @@ 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.1',
+        expected_res = {'driver_version': '1.1.2',
                         'total_capacity_gb': 7466.30419921875,
                         'QoS_support': False,
                         'reserved_percentage': 0,
@@ -545,7 +550,7 @@ class NimbleDriverSnapshotTestCase(NimbleDriverBaseTestCase):
         expected_calls = [
             mock.call.service.cloneVol(
                 request={'snap-name': 'testvolume-snap1',
-                         'attr': {'snap-quota': 1073741824,
+                         'attr': {'snap-quota': sys.maxsize,
                                   'name': 'clone-testvolume',
                                   'quota': 1073741824,
                                   'online': True,
@@ -556,11 +561,11 @@ class NimbleDriverSnapshotTestCase(NimbleDriverBaseTestCase):
                          'sid': 'a9b9aba7'}),
             mock.call.service.editVol(
                 request={'attr': {'size': 2147483648,
-                                  'snap-quota': 2147483648,
+                                  'snap-quota': sys.maxsize,
                                   'warn-level': 1717986918,
                                   'reserve': 0,
                                   'quota': 2147483648},
-                         'mask': 628,
+                         'mask': 884,
                          'name': 'clone-testvolume',
                          'sid': 'a9b9aba7'})]
         self.mock_client_service.assert_has_calls(expected_calls)
index df6236e2f27a99ef1e6cba80e87e3b553c200d50..981a864ae7dac5aba29102d8775f62f5e094245a 100755 (executable)
@@ -23,6 +23,7 @@ import random
 import re
 import six
 import string
+import sys
 
 from oslo_config import cfg
 from oslo_log import log as logging
@@ -36,14 +37,15 @@ from cinder.volume.drivers.san import san
 from cinder.volume import volume_types
 
 
-DRIVER_VERSION = '1.1.1'
+DRIVER_VERSION = '1.1.2'
 AES_256_XTS_CIPHER = 2
 DEFAULT_CIPHER = 3
 EXTRA_SPEC_ENCRYPTION = 'nimble:encryption'
 EXTRA_SPEC_PERF_POLICY = 'nimble:perfpol-name'
 DEFAULT_PERF_POLICY_SETTING = 'default'
 DEFAULT_ENCRYPTION_SETTING = 'no'
-VOL_EDIT_MASK = 4 + 16 + 32 + 64 + 512
+DEFAULT_SNAP_QUOTA = sys.maxsize
+VOL_EDIT_MASK = 4 + 16 + 32 + 64 + 256 + 512
 SOAP_PORT = 5391
 SM_ACL_APPLY_TO_BOTH = 3
 SM_ACL_CHAP_USER_ANY = '*'
@@ -83,7 +85,7 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
         1.0 - Initial driver
         1.1.0 - Added Extra Spec Capability
         1.1.1 - Updated VERSION to Nimble driver version
-
+        1.1.2 - Update snap-quota to unlimited
     """
 
     VERSION = DRIVER_VERSION
@@ -210,7 +212,7 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
                  'reserve': reserve_size,
                  'warn-level': int(vol_size * WARN_LEVEL),
                  'quota': vol_size,
-                 'snap-quota': vol_size})
+                 'snap-quota': DEFAULT_SNAP_QUOTA})
         return self._get_model_info(volume['name'])
 
     def create_cloned_volume(self, volume, src_vref):
@@ -302,7 +304,7 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
              'reserve': reserve_size,
              'warn-level': int(vol_size * WARN_LEVEL),
              'quota': vol_size,
-             'snap-quota': vol_size})
+             'snap-quota': DEFAULT_SNAP_QUOTA})
 
     def _create_igroup_for_initiator(self, initiator_name):
         """Creates igroup for an initiator and returns the igroup name."""
@@ -537,7 +539,7 @@ class NimbleAPIExecutor(object):
                               'reserve': reserve_size,
                               'warn-level': int(volume_size * WARN_LEVEL),
                               'quota': volume_size,
-                              'snap-quota': volume_size,
+                              'snap-quota': DEFAULT_SNAP_QUOTA,
                               'online': True,
                               'pool-name': pool_name,
                               'perfpol-name': perf_policy_name,
@@ -702,7 +704,7 @@ class NimbleAPIExecutor(object):
                               'reserve': reserve_size,
                               'warn-level': int(clone_size * WARN_LEVEL),
                               'quota': clone_size,
-                              'snap-quota': clone_size,
+                              'snap-quota': DEFAULT_SNAP_QUOTA,
                               'online': True},
                      'snap-name': snap_name})