Merge "RemoteFS: Use summarize option for "du""
This commit is contained in:
commit
70a809dd21
@ -692,6 +692,20 @@ class NfsDriverTestCase(test.TestCase):
|
||||
provider_location=loc,
|
||||
size=size)
|
||||
|
||||
def test_get_provisioned_capacity(self):
|
||||
self._set_driver()
|
||||
drv = self._driver
|
||||
|
||||
mock_execute = self.mock_object(drv, '_execute')
|
||||
mock_execute.return_value = ("148418423\t/dir", "")
|
||||
|
||||
with mock.patch.object(drv, 'shares') as shares:
|
||||
shares.keys.return_value = {'192.0.2.1:/srv/nfs1'}
|
||||
shares.return_value = {'192.0.2.1:/srv/nfs1', ''}
|
||||
ret = drv._get_provisioned_capacity()
|
||||
|
||||
self.assertEqual(ret, 0.14)
|
||||
|
||||
def test_create_sparsed_volume(self):
|
||||
self._set_driver()
|
||||
drv = self._driver
|
||||
|
@ -217,7 +217,7 @@ class RemoteFSDriver(driver.BaseVD):
|
||||
provisioned_size = 0.0
|
||||
for share in self.shares.keys():
|
||||
mount_path = self._get_mount_point_for_share(share)
|
||||
out, _ = self._execute('du', '--bytes', mount_path,
|
||||
out, _ = self._execute('du', '--bytes', '-s', mount_path,
|
||||
run_as_root=self._execute_as_root)
|
||||
provisioned_size += int(out.split()[0])
|
||||
return round(provisioned_size / units.Gi, 2)
|
||||
|
Loading…
Reference in New Issue
Block a user