]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Delete default volume size 100M in drivers
authorAnton Arefiev <aarefiev@mirantis.com>
Mon, 15 Dec 2014 10:33:38 +0000 (12:33 +0200)
committerAnton Arefiev <aarefiev@mirantis.com>
Tue, 16 Dec 2014 11:08:03 +0000 (13:08 +0200)
There is check: if volume size == 0 we set default value to 100M,
it uses only in tests and it's little bit confusing.Use code only
for tests in drivers is bad practice.

Also the create volume flow already won't let user to create
a volume  with size 0. So it was decided to remove this check.

Change-Id: I620ae8fff4634c60a02329f22d1a0343b27aa955

cinder/tests/test_gpfs.py
cinder/tests/test_scality.py
cinder/volume/drivers/ibm/gpfs.py
cinder/volume/drivers/lvm.py
cinder/volume/drivers/rbd.py
cinder/volume/drivers/san/hp/hp_lefthand_cliq_proxy.py
cinder/volume/drivers/san/solaris.py
cinder/volume/drivers/scality.py

index 54e760b9454ae6778c2ec1663ba433cf27b2e17a..470b2e00f7f57803e7d939e65f9c032855924ed3 100644 (file)
@@ -96,7 +96,6 @@ class GPFSDriverTestCase(test.TestCase):
         self.assertFalse(gpfs._different(None))
 
     def test_sizestr(self):
-        self.assertEqual(gpfs._sizestr('0'), '100M')
         self.assertEqual(gpfs._sizestr('10'), '10G')
 
     @patch('cinder.utils.execute')
index b9d1529b903bc2338699c94e2fd9a9060a17a40f..657ff9aaccbc10103aacf1e48487fa2ef0c3a9f2 100644 (file)
@@ -43,7 +43,7 @@ class ScalityDriverTestCase(test.TestCase):
     TEST_VOLDIR = 'volumes'
 
     TEST_VOLNAME = 'volume_name'
-    TEST_VOLSIZE = '0'
+    TEST_VOLSIZE = '1'
     TEST_VOLUME = {
         'name': TEST_VOLNAME,
         'size': TEST_VOLSIZE
@@ -183,7 +183,7 @@ class ScalityDriverTestCase(test.TestCase):
                                       self.TEST_VOLNAME))
         self.assertTrue(os.path.isfile(self.TEST_VOLPATH))
         self.assertEqual(os.stat(self.TEST_VOLPATH).st_size,
-                         100 * units.Mi)
+                         1 * units.Gi)
 
     def test_delete_volume(self):
         """Expected behaviour for delete_volume."""
index 4d455f030e95a42782b8400da8a0326c258537aa..9396612d14eaa28760ed0d8e5e7b86f056fa8f1b 100644 (file)
@@ -97,9 +97,6 @@ def _same_filesystem(path1, path2):
 
 def _sizestr(size_in_g):
     """Convert the specified size into a string value."""
-    if int(size_in_g) == 0:
-        # return 100M size on zero input for testing
-        return '100M'
     return '%sG' % size_in_g
 
 
index 95c885902c1b29dcdb908b0578f9ac065e0ed386..3bd67b94dad918e669e20897e58d3f3170847f95 100644 (file)
@@ -115,8 +115,6 @@ class LVMVolumeDriver(driver.VolumeDriver):
                         data=exception_message)
 
     def _sizestr(self, size_in_g):
-        if int(size_in_g) == 0:
-            return '100m'
         return '%sg' % size_in_g
 
     def _volume_not_present(self, volume_name):
index 3c7dda251132b8e528a7b7c96a6f70cd50f8f149..703d14ff3ffac40db94cd15a3b6033594812ff88 100644 (file)
@@ -485,10 +485,7 @@ class RBDDriver(driver.VolumeDriver):
 
     def create_volume(self, volume):
         """Creates a logical volume."""
-        if int(volume['size']) == 0:
-            size = 100 * units.Mi
-        else:
-            size = int(volume['size']) * units.Gi
+        size = int(volume['size']) * units.Gi
 
         LOG.debug("creating volume '%s'" % (volume['name']))
 
index c75e0983aca9e361ac2db5432b94393e8436c351..6a105174dfa4f964af143ce7011f3fee5c31ac52 100644 (file)
@@ -274,10 +274,7 @@ class HPLeftHandCLIQProxy(SanISCSIDriver):
             cliq_args['thinProvision'] = '0'
 
         cliq_args['volumeName'] = volume['name']
-        if int(volume['size']) == 0:
-            cliq_args['size'] = '100MB'
-        else:
-            cliq_args['size'] = '%sGB' % volume['size']
+        cliq_args['size'] = '%sGB' % volume['size']
 
         self._cliq_run_xml("createVolume", cliq_args)
 
index 74ef541cd1eff8b038a3aefadaf3732b13e6f33c..2cb1d963a238979151c53b1f59cd8e2dc6224f20 100644 (file)
@@ -128,10 +128,7 @@ class SolarisISCSIDriver(SanISCSIDriver):
 
     def create_volume(self, volume):
         """Creates a volume."""
-        if int(volume['size']) == 0:
-            sizestr = '100M'
-        else:
-            sizestr = '%sG' % volume['size']
+        sizestr = '%sG' % volume['size']
 
         zfs_poolname = self._build_zfs_poolname(volume)
 
index 583fa3f4ad92a5ce23fb03b6cb313dd16d2ef340..82f2c1baca5ed58c5c7216f3a8b9c1c5bf466382 100644 (file)
@@ -114,8 +114,6 @@ class ScalityDriver(driver.VolumeDriver):
             raise exception.VolumeBackendAPIException(data=msg)
 
     def _size_bytes(self, size_in_g):
-        if int(size_in_g) == 0:
-            return 100 * units.Mi
         return int(size_in_g) * units.Gi
 
     def _create_file(self, path, size):