From: Eric Harney Date: Thu, 5 Dec 2013 18:45:46 +0000 (-0500) Subject: GlusterFS: Remove glusterfs_disk_util option X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e997f8b06ecd4ed0a13c557d621db69eb68f2f3d;p=openstack-build%2Fcinder-build.git GlusterFS: Remove glusterfs_disk_util option 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 --- diff --git a/cinder/tests/test_glusterfs.py b/cinder/tests/test_glusterfs.py index cc748c521..a0bba2222 100644 --- a/cinder/tests/test_glusterfs.py +++ b/cinder/tests/test_glusterfs.py @@ -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 diff --git a/cinder/volume/drivers/glusterfs.py b/cinder/volume/drivers/glusterfs.py index 89a1c54f4..0cc1ccbcb 100644 --- a/cinder/volume/drivers/glusterfs.py +++ b/cinder/volume/drivers/glusterfs.py @@ -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 diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 078bed710..3af3b24eb 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -1168,9 +1168,6 @@ # 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)