]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
GlusterFS: Remove glusterfs_disk_util option
authorEric Harney <eharney@redhat.com>
Thu, 5 Dec 2013 18:45:46 +0000 (13:45 -0500)
committerEric Harney <eharney@redhat.com>
Thu, 5 Dec 2013 18:59:57 +0000 (13:59 -0500)
The glusterfs_disk_util option lets one choose whether to
use df or du to calculate space usage.  This serves no real
useful purpose.  Should remove this option to simplify things.

Since this does not meaningfully impact behavior, removal of
this option shouldn't require any special deprecation efforts.

(This same change was made for the NFS driver in 5bf7b9be.)

DocImpact: Remove config option

Change-Id: I302692454b43de15688d65873a72a3dada0c67cb

cinder/tests/test_glusterfs.py
cinder/volume/drivers/glusterfs.py
etc/cinder/cinder.conf.sample

index cc748c5210e24f3280c48b49cc6249eca6084f63..a0bba2222faabec2762503af26b84cdcc0873d91 100644 (file)
@@ -236,50 +236,6 @@ class GlusterFsDriverTestCase(test.TestCase):
 
         delattr(glusterfs.CONF, 'glusterfs_disk_util')
 
-    def test_get_available_capacity_with_du(self):
-        """_get_available_capacity should calculate correct value."""
-        mox = self._mox
-        drv = self._driver
-
-        old_value = self._configuration.glusterfs_disk_util
-        self._configuration.glusterfs_disk_util = 'du'
-
-        df_total_size = 2620544
-        df_used_size = 996864
-        df_avail_size = 1490560
-        df_title = 'Filesystem 1-blocks Used Available Use% Mounted on\n'
-        df_mnt_data = 'glusterfs-host:/export %d %d %d 41%% /mnt' % \
-                      (df_total_size,
-                       df_used_size,
-                       df_avail_size)
-        df_output = df_title + df_mnt_data
-
-        du_used = 490560
-        du_output = '%d /mnt' % du_used
-
-        mox.StubOutWithMock(drv, '_get_mount_point_for_share')
-        drv._get_mount_point_for_share(self.TEST_EXPORT1).\
-            AndReturn(self.TEST_MNT_POINT)
-
-        mox.StubOutWithMock(drv, '_execute')
-        drv._execute('df', '--portability', '--block-size', '1',
-                     self.TEST_MNT_POINT,
-                     run_as_root=True).\
-            AndReturn((df_output, None))
-        drv._execute('du', '-sb', '--apparent-size',
-                     '--exclude', '*snapshot*',
-                     self.TEST_MNT_POINT,
-                     run_as_root=True).AndReturn((du_output, None))
-
-        mox.ReplayAll()
-
-        self.assertEqual((df_total_size - du_used, df_total_size),
-                         drv._get_available_capacity(self.TEST_EXPORT1))
-
-        mox.VerifyAll()
-
-        self._configuration.glusterfs_disk_util = old_value
-
     def test_load_shares_config(self):
         mox = self._mox
         drv = self._driver
index 89a1c54f4f9e9ae3e626f6ed19a59769373feaca..0cc1ccbcb4590a805db64f9e7a837cc8d4638be5 100644 (file)
@@ -41,9 +41,6 @@ volume_opts = [
     cfg.StrOpt('glusterfs_shares_config',
                default='/etc/cinder/glusterfs_shares',
                help='File with the list of available gluster shares'),
-    cfg.StrOpt('glusterfs_disk_util',
-               default='df',
-               help='Use du or df for free space calculation'),
     cfg.BoolOpt('glusterfs_sparsed_volumes',
                 default=True,
                 help=('Create volumes as sparsed files which take no space.'
@@ -1076,17 +1073,8 @@ class GlusterfsDriver(nfs.RemoteFsDriver):
                                mount_point, run_as_root=True)
         out = out.splitlines()[1]
 
-        available = 0
-
         size = int(out.split()[1])
-        if self.configuration.glusterfs_disk_util == 'df':
-            available = int(out.split()[3])
-        else:
-            out, _ = self._execute('du', '-sb', '--apparent-size',
-                                   '--exclude', '*snapshot*', mount_point,
-                                   run_as_root=True)
-            used = int(out.split()[0])
-            available = size - used
+        available = int(out.split()[3])
 
         return available, size
 
index 078bed7109b8be8a2c97480f6ae357bd627bbfa4..3af3b24ebc4cafda427de6ecc01b5f7e145f76d8 100644 (file)
 # value)
 #glusterfs_shares_config=/etc/cinder/glusterfs_shares
 
-# Use du or df for free space calculation (string value)
-#glusterfs_disk_util=df
-
 # Create volumes as sparsed files which take no space.If set
 # to False volume is created as regular file.In such case
 # volume creation takes a lot of time. (boolean value)