Merge "rbd: Correct local_attach disconnect test and showmapped arguments" into stable/rocky
This commit is contained in:
commit
8d3c71f438
|
@ -214,6 +214,7 @@ class RBDConnector(base.BaseLinuxConnector):
|
||||||
"""
|
"""
|
||||||
__, volume = connection_properties['name'].split('/')
|
__, volume = connection_properties['name'].split('/')
|
||||||
cmd = ['rbd', 'showmapped', '--format=json']
|
cmd = ['rbd', 'showmapped', '--format=json']
|
||||||
|
cmd += self._get_rbd_args(connection_properties)
|
||||||
(out, err) = self._execute(*cmd, root_helper=self._root_helper,
|
(out, err) = self._execute(*cmd, root_helper=self._root_helper,
|
||||||
run_as_root=True)
|
run_as_root=True)
|
||||||
for index, mapping in jsonutils.loads(out).items():
|
for index, mapping in jsonutils.loads(out).items():
|
||||||
|
|
|
@ -255,8 +255,8 @@ class RBDConnectorTestCase(test_connector.ConnectorTestCase):
|
||||||
'hosts': ['192.168.10.2'],
|
'hosts': ['192.168.10.2'],
|
||||||
'ports': ['6789']}
|
'ports': ['6789']}
|
||||||
mock_execute.side_effect = [("""
|
mock_execute.side_effect = [("""
|
||||||
{"0":{"pool":"pool","device":"/dev/rbd0","name":"pool-image"},
|
{"0":{"pool":"pool","device":"/dev/rbd0","name":"image"},
|
||||||
"1":{"pool":"pool","device":"/dev/rdb1","name":"pool-image_2"}}""", None),
|
"1":{"pool":"pool","device":"/dev/rdb1","name":"image_2"}}""", None),
|
||||||
(None, None)]
|
(None, None)]
|
||||||
show_cmd = ['rbd', 'showmapped', '--format=json', '--id', 'fake_user',
|
show_cmd = ['rbd', 'showmapped', '--format=json', '--id', 'fake_user',
|
||||||
'--mon_host', '192.168.10.2:6789']
|
'--mon_host', '192.168.10.2:6789']
|
||||||
|
@ -266,7 +266,7 @@ class RBDConnectorTestCase(test_connector.ConnectorTestCase):
|
||||||
rbd_connector.disconnect_volume(conn, None)
|
rbd_connector.disconnect_volume(conn, None)
|
||||||
|
|
||||||
# Assert that showmapped is used before we unmap the root device
|
# Assert that showmapped is used before we unmap the root device
|
||||||
mock_execute.has_calls([
|
mock_execute.assert_has_calls([
|
||||||
mock.call(*show_cmd, root_helper=None, run_as_root=True),
|
mock.call(*show_cmd, root_helper=None, run_as_root=True),
|
||||||
mock.call(*unmap_cmd, root_helper=None, run_as_root=True)])
|
mock.call(*unmap_cmd, root_helper=None, run_as_root=True)])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue