Add dedupe report in HNAS driver
HNAS backend has support for enabling dedupe in file systems. This commit adds a report for this capability in Manila HNAS driver. DocImpact Closes-Bug: #1610956 Change-Id: I6f83da1e51cfdcd8d20b607619c131d13f9e513f
This commit is contained in:
parent
dfb9e587b1
commit
9a178f5254
@ -180,7 +180,7 @@ Mapping of share drivers and common capabilities
|
|||||||
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
||||||
| HDFS | \- | K | \- | \- | \- | L | \- |
|
| HDFS | \- | K | \- | \- | \- | L | \- |
|
||||||
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
||||||
| Hitachi HNAS | \- | L | \- | \- | L | \- | \- |
|
| Hitachi HNAS | \- | L | N | \- | L | \- | \- |
|
||||||
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
||||||
| HPE 3PAR | L | K | L | \- | L | L | \- |
|
| HPE 3PAR | L | K | L | \- | L | L | \- |
|
||||||
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
+----------------------------------------+-----------+------------+--------+-------------+-------------------+--------------------+-----+
|
||||||
|
@ -420,7 +420,7 @@ class HDSHNASDriver(driver.ShareDriver):
|
|||||||
|
|
||||||
self._check_fs_mounted()
|
self._check_fs_mounted()
|
||||||
|
|
||||||
total_space, free_space = self.hnas.get_stats()
|
total_space, free_space, dedupe = self.hnas.get_stats()
|
||||||
|
|
||||||
reserved = self.configuration.safe_get('reserved_share_percentage')
|
reserved = self.configuration.safe_get('reserved_share_percentage')
|
||||||
|
|
||||||
@ -435,6 +435,7 @@ class HDSHNASDriver(driver.ShareDriver):
|
|||||||
'reserved_percentage': reserved,
|
'reserved_percentage': reserved,
|
||||||
'qos': False,
|
'qos': False,
|
||||||
'thin_provisioning': True,
|
'thin_provisioning': True,
|
||||||
|
'dedupe': dedupe,
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info(_LI("HNAS Capabilities: %(data)s."),
|
LOG.info(_LI("HNAS Capabilities: %(data)s."),
|
||||||
@ -661,7 +662,7 @@ class HDSHNASDriver(driver.ShareDriver):
|
|||||||
self._ensure_share(share, hnas_share_id)
|
self._ensure_share(share, hnas_share_id)
|
||||||
|
|
||||||
old_size = share['size']
|
old_size = share['size']
|
||||||
total, available_space = self.hnas.get_stats()
|
available_space = self.hnas.get_stats()[1]
|
||||||
|
|
||||||
LOG.debug("Available space in filesystem: %(space)sG.",
|
LOG.debug("Available space in filesystem: %(space)sG.",
|
||||||
{'space': available_space})
|
{'space': available_space})
|
||||||
|
@ -53,6 +53,7 @@ class HNASSSHBackend(object):
|
|||||||
:returns:
|
:returns:
|
||||||
fs_capacity.size = Total size from filesystem.
|
fs_capacity.size = Total size from filesystem.
|
||||||
available_space = Free space currently on filesystem.
|
available_space = Free space currently on filesystem.
|
||||||
|
dedupe = True if dedupe is enabled on filesystem.
|
||||||
"""
|
"""
|
||||||
command = ['df', '-a', '-f', self.fs_name]
|
command = ['df', '-a', '-f', self.fs_name]
|
||||||
output, err = self._execute(command)
|
output, err = self._execute(command)
|
||||||
@ -60,7 +61,7 @@ class HNASSSHBackend(object):
|
|||||||
line = output.split('\n')
|
line = output.split('\n')
|
||||||
fs = Filesystem(line[3])
|
fs = Filesystem(line[3])
|
||||||
available_space = fs.size - fs.used
|
available_space = fs.size - fs.used
|
||||||
return fs.size, available_space
|
return fs.size, available_space, fs.dedupe
|
||||||
|
|
||||||
def nfs_export_add(self, share_id):
|
def nfs_export_add(self, share_id):
|
||||||
path = '/shares/' + share_id
|
path = '/shares/' + share_id
|
||||||
@ -612,6 +613,7 @@ class Filesystem(object):
|
|||||||
self.used_measure = items[6]
|
self.used_measure = items[6]
|
||||||
if self.used_measure == 'TB':
|
if self.used_measure == 'TB':
|
||||||
self.used = self.used * units.Ki
|
self.used = self.used * units.Ki
|
||||||
|
self.dedupe = 'dedupe enabled' in data
|
||||||
|
|
||||||
|
|
||||||
class Quota(object):
|
class Quota(object):
|
||||||
|
@ -547,7 +547,7 @@ class HDSHNASTestCase(test.TestCase):
|
|||||||
|
|
||||||
def test_extend_share(self):
|
def test_extend_share(self):
|
||||||
self.mock_object(ssh.HNASSSHBackend, "get_stats", mock.Mock(
|
self.mock_object(ssh.HNASSSHBackend, "get_stats", mock.Mock(
|
||||||
return_value=(500, 200)))
|
return_value=(500, 200, True)))
|
||||||
self.mock_object(ssh.HNASSSHBackend, "modify_quota", mock.Mock())
|
self.mock_object(ssh.HNASSSHBackend, "modify_quota", mock.Mock())
|
||||||
|
|
||||||
self._driver.extend_share(share_nfs, 150)
|
self._driver.extend_share(share_nfs, 150)
|
||||||
@ -558,7 +558,7 @@ class HDSHNASTestCase(test.TestCase):
|
|||||||
|
|
||||||
def test_extend_share_with_no_available_space_in_fs(self):
|
def test_extend_share_with_no_available_space_in_fs(self):
|
||||||
self.mock_object(ssh.HNASSSHBackend, "get_stats", mock.Mock(
|
self.mock_object(ssh.HNASSSHBackend, "get_stats", mock.Mock(
|
||||||
return_value=(500, 200)))
|
return_value=(500, 200, False)))
|
||||||
self.mock_object(ssh.HNASSSHBackend, "modify_quota", mock.Mock())
|
self.mock_object(ssh.HNASSSHBackend, "modify_quota", mock.Mock())
|
||||||
|
|
||||||
self.assertRaises(exception.HNASBackendException,
|
self.assertRaises(exception.HNASBackendException,
|
||||||
@ -729,10 +729,11 @@ class HDSHNASTestCase(test.TestCase):
|
|||||||
'reserved_percentage': hds_hnas.CONF.reserved_share_percentage,
|
'reserved_percentage': hds_hnas.CONF.reserved_share_percentage,
|
||||||
'qos': False,
|
'qos': False,
|
||||||
'thin_provisioning': True,
|
'thin_provisioning': True,
|
||||||
|
'dedupe': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.mock_object(ssh.HNASSSHBackend, 'get_stats', mock.Mock(
|
self.mock_object(ssh.HNASSSHBackend, 'get_stats', mock.Mock(
|
||||||
return_value=(1000, 200)))
|
return_value=(1000, 200, True)))
|
||||||
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
|
self.mock_object(hds_hnas.HDSHNASDriver, "_check_fs_mounted",
|
||||||
mock.Mock())
|
mock.Mock())
|
||||||
self.mock_object(manila.share.driver.ShareDriver,
|
self.mock_object(manila.share.driver.ShareDriver,
|
||||||
|
@ -363,6 +363,15 @@ HNAS_RESULT_df_tb = """
|
|||||||
18.3 GB (25%) No 4 KB,WFS-2,128 DSBs
|
18.3 GB (25%) No 4 KB,WFS-2,128 DSBs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
HNAS_RESULT_df_dedupe_on = """
|
||||||
|
ID Label EVS Size Used Snapshots Deduped \
|
||||||
|
Avail Thin ThinSize ThinAvail FS Type
|
||||||
|
---- ------------- --- -------- -------------- --------- ------- \
|
||||||
|
------------- ---- -------- --------- -------------------
|
||||||
|
1051 FS-ManilaDev1 3.00 7.00 TB 2 TB (75%) NA 0 B (0%) \
|
||||||
|
18.3 GB (25%) No 4 KB,WFS-2,128 DSBs,dedupe enabled
|
||||||
|
"""
|
||||||
|
|
||||||
HNAS_RESULT_df_unmounted = """
|
HNAS_RESULT_df_unmounted = """
|
||||||
ID Label EVS Size Used Snapshots Deduped \
|
ID Label EVS Size Used Snapshots Deduped \
|
||||||
Avail Thin ThinSize ThinAvail FS Type
|
Avail Thin ThinSize ThinAvail FS Type
|
||||||
@ -505,11 +514,26 @@ class HNASSSHTestCase(test.TestCase):
|
|||||||
self.mock_object(ssh.HNASSSHBackend, '_execute',
|
self.mock_object(ssh.HNASSSHBackend, '_execute',
|
||||||
mock.Mock(return_value=(HNAS_RESULT_df_tb, "")))
|
mock.Mock(return_value=(HNAS_RESULT_df_tb, "")))
|
||||||
|
|
||||||
total, free = self._driver_ssh.get_stats()
|
total, free, dedupe = self._driver_ssh.get_stats()
|
||||||
|
|
||||||
ssh.HNASSSHBackend._execute.assert_called_with(fake_list_command)
|
ssh.HNASSSHBackend._execute.assert_called_with(fake_list_command)
|
||||||
self.assertEqual(7168.0, total)
|
self.assertEqual(7168.0, total)
|
||||||
self.assertEqual(5120.0, free)
|
self.assertEqual(5120.0, free)
|
||||||
|
self.assertFalse(dedupe)
|
||||||
|
|
||||||
|
def test_get_stats_dedupe_on(self):
|
||||||
|
fake_list_command = ['df', '-a', '-f', self.fs_name]
|
||||||
|
|
||||||
|
self.mock_object(
|
||||||
|
ssh.HNASSSHBackend, '_execute',
|
||||||
|
mock.Mock(return_value=(HNAS_RESULT_df_dedupe_on, "")))
|
||||||
|
|
||||||
|
total, free, dedupe = self._driver_ssh.get_stats()
|
||||||
|
|
||||||
|
ssh.HNASSSHBackend._execute.assert_called_with(fake_list_command)
|
||||||
|
self.assertEqual(7168.0, total)
|
||||||
|
self.assertEqual(5120.0, free)
|
||||||
|
self.assertTrue(dedupe)
|
||||||
|
|
||||||
def test_nfs_export_add(self):
|
def test_nfs_export_add(self):
|
||||||
fake_nfs_command = ['nfs-export', 'add', '-S', 'disable', '-c',
|
fake_nfs_command = ['nfs-export', 'add', '-S', 'disable', '-c',
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Hitachi HNAS driver now reports ``dedupe`` capability and
|
||||||
|
it can be used in extra-specs to choose a HNAS file system
|
||||||
|
that has dedupe enabled when creating a manila share on HNAS.
|
Loading…
Reference in New Issue
Block a user