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
This commit is contained in:
parent
e99cd785d8
commit
e997f8b06e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue