Merge "StorPool: parse the output of `blockdev` correctly."

This commit is contained in:
Zuul 2020-02-18 17:43:01 +00:00 committed by Gerrit Code Review
commit 35f0ac5bfa
2 changed files with 2 additions and 2 deletions

View File

@ -191,7 +191,7 @@ class StorPoolConnector(base.BaseLinuxConnector):
(out, _err) = self._execute('blockdev', '--getsize64',
device, run_as_root=True,
root_helper=self._root_helper)
var = six.text_type(out)
var = six.text_type(out).strip()
if var.isnumeric():
return int(var)
else:

View File

@ -85,7 +85,7 @@ class StorPoolConnectorTestCase(test_connector.ConnectorTestCase):
self.assertEqual(cmd[1], '--getsize64')
self.assertEqual(cmd[2], '/dev/storpool/' +
self.volumeName(self.fakeProp['volume']))
return (str(self.fakeSize), None)
return (str(self.fakeSize) + '\n', None)
raise Exception("Unrecognized command passed to " +
type(self).__name__ + ".execute(): " +
str.join(", ", map(lambda s: "'" + s + "'", cmd)))