LVM driver: Pass '--units g' to vgs invocation
This fixes an issue where "large" volume groups are reported with a VSize in 't' units and thus throw an IndexError in the applied regex match. Change-Id: If8d7ced15e9739baeb2aed280d3e8ff3503b16fe Closes-Bug: 1542054
This commit is contained in:
parent
cba78962a3
commit
a88c93ba2c
|
@ -192,7 +192,7 @@ class LVMShareDriver(LVMMixin, driver.ShareDriver):
|
|||
def get_share_server_pools(self, share_server=None):
|
||||
out, err = self._execute('sudo', 'vgs',
|
||||
self.configuration.lvm_share_volume_group,
|
||||
'--rows')
|
||||
'--rows', '--units', 'g')
|
||||
total_size = re.findall("VSize\s[0-9.]+g", out)[0][6:-1]
|
||||
free_size = re.findall("VFree\s[0-9.]+g", out)[0][6:-1]
|
||||
return [{
|
||||
|
|
|
@ -484,6 +484,8 @@ class LVMShareDriverTestCase(test.TestCase):
|
|||
|
||||
self.assertEqual(expected_result,
|
||||
self._driver.get_share_server_pools())
|
||||
self._driver._execute.assert_called_once_with(
|
||||
'sudo', 'vgs', 'fakevg', '--rows', '--units', 'g')
|
||||
|
||||
def test_copy_volume_error(self):
|
||||
def _fake_exec(*args, **kwargs):
|
||||
|
|
Loading…
Reference in New Issue