RemoteFS: Reporting configured reserved_percentage in _update_volume_stats
In remotefs, reserved_percentage will be always reported up to the scheduler as 0, irrespective of the value of cfg.reserved_percentage. This patch modifies the code to use reserved_percentage configuration parameter while updating status. Closes-Bug: #1458640 Change-Id: I53917835b79797417aca7b1b3c794c84b6143ab5
This commit is contained in:
parent
6b93625a3d
commit
53b736fb65
|
@ -371,6 +371,7 @@ class NfsDriverTestCase(test.TestCase):
|
|||
self.configuration.nas_ip = None
|
||||
self.configuration.nas_share_path = None
|
||||
self.configuration.nas_mount_options = None
|
||||
self.configuration.reserved_percentage = 0
|
||||
self.configuration.volume_dd_blocksize = '1M'
|
||||
self._driver = nfs.NfsDriver(configuration=self.configuration)
|
||||
self._driver.shares = {}
|
||||
|
@ -848,9 +849,39 @@ class NfsDriverTestCase(test.TestCase):
|
|||
drv.get_volume_stats()
|
||||
self.assertEqual(30.0, drv._stats['total_capacity_gb'])
|
||||
self.assertEqual(5.0, drv._stats['free_capacity_gb'])
|
||||
self.assertEqual(0, drv._stats['reserved_percentage'])
|
||||
|
||||
mox.VerifyAll()
|
||||
|
||||
def test_get_volume_stats_with_non_zero_reserved_percentage(self):
|
||||
"""get_volume_stats must fill the correct values."""
|
||||
mox = self.mox
|
||||
drv = self._driver
|
||||
self.configuration.reserved_percentage = 10.0
|
||||
|
||||
drv._mounted_shares = [self.TEST_NFS_EXPORT1, self.TEST_NFS_EXPORT2]
|
||||
|
||||
mox.StubOutWithMock(drv, '_ensure_shares_mounted')
|
||||
mox.StubOutWithMock(drv, '_get_capacity_info')
|
||||
|
||||
drv._ensure_shares_mounted()
|
||||
|
||||
drv._get_capacity_info(self.TEST_NFS_EXPORT1).\
|
||||
AndReturn((10 * units.Gi, 2 * units.Gi,
|
||||
2 * units.Gi))
|
||||
drv._get_capacity_info(self.TEST_NFS_EXPORT2).\
|
||||
AndReturn((20 * units.Gi, 3 * units.Gi,
|
||||
3 * units.Gi))
|
||||
|
||||
mox.ReplayAll()
|
||||
|
||||
drv.get_volume_stats()
|
||||
|
||||
self.assertEqual(30.0, drv._stats['total_capacity_gb'])
|
||||
self.assertEqual(5.0, drv._stats['free_capacity_gb'])
|
||||
self.assertEqual(10.0, drv._stats['reserved_percentage'])
|
||||
mox.VerifyAll()
|
||||
|
||||
def _check_is_share_eligible(self, total_size, total_available,
|
||||
total_allocated, requested_volume_size):
|
||||
with mock.patch.object(self._driver, '_get_capacity_info')\
|
||||
|
|
|
@ -505,7 +505,7 @@ class RemoteFSDriver(driver.LocalVD, driver.TransferVD, driver.BaseVD):
|
|||
|
||||
data['total_capacity_gb'] = global_capacity / float(units.Gi)
|
||||
data['free_capacity_gb'] = global_free / float(units.Gi)
|
||||
data['reserved_percentage'] = 0
|
||||
data['reserved_percentage'] = self.configuration.reserved_percentage
|
||||
data['QoS_support'] = False
|
||||
self._stats = data
|
||||
|
||||
|
|
Loading…
Reference in New Issue