RBD: Fix missing root_helper
When using the RBD driver and running the cinderlib process as a non-root user within a container we'll get a "Command requested root, but did not specify a root helper." error. This error happens because the library is not passing the "root_helper" parameter in a couple of "_execute" calls. Trivial-Fix Closes-Bug: #1885291 Change-Id: Idf664fdab3daf21b99215edfe3e2c053c3a9e85c
This commit is contained in:
parent
c8e59f5d97
commit
9e17143194
|
@ -128,7 +128,7 @@ class RBDConnector(connectors.rbd.RBDConnector):
|
|||
raise
|
||||
else:
|
||||
self._execute('ln', '-s', '-f', source, link_name,
|
||||
run_as_root=True)
|
||||
root_helper=self._root_helper, run_as_root=True)
|
||||
|
||||
def check_valid_device(self, path, run_as_root=True):
|
||||
"""Verify an existing RBD handle is connected and valid."""
|
||||
|
@ -181,7 +181,8 @@ class RBDConnector(connectors.rbd.RBDConnector):
|
|||
if exc.errno != errno.EEXIST:
|
||||
raise
|
||||
else:
|
||||
self._execute('mkdir', '-p', '-m0755', path, run_as_root=True)
|
||||
self._execute('mkdir', '-p', '-m0755', path,
|
||||
root_helper=self._root_helper, run_as_root=True)
|
||||
|
||||
def _setup_class(self):
|
||||
try:
|
||||
|
|
|
@ -243,8 +243,9 @@ class TestRBDConnector(base.BaseTest):
|
|||
@mock.patch('os.makedirs')
|
||||
def test__ensure_dir(self, mkdir_mock, exec_mock):
|
||||
self.connector._ensure_dir(mock.sentinel.path)
|
||||
exec_mock.assert_called_once_with('mkdir', '-p', '-m0755',
|
||||
mock.sentinel.path, run_as_root=True)
|
||||
exec_mock.assert_called_once_with(
|
||||
'mkdir', '-p', '-m0755', mock.sentinel.path,
|
||||
root_helper=self.connector._root_helper, run_as_root=True)
|
||||
mkdir_mock.assert_not_called()
|
||||
|
||||
@mock.patch.object(nos_brick.RBDConnector, '_execute')
|
||||
|
@ -284,8 +285,9 @@ class TestRBDConnector(base.BaseTest):
|
|||
link = '/dev/rbd/rbd/volume-xyz'
|
||||
self.connector._ensure_link(source, link)
|
||||
dir_mock.assert_called_once_with('/dev/rbd/rbd')
|
||||
exec_mock.assert_called_once_with('ln', '-s', '-f', source, link,
|
||||
run_as_root=True)
|
||||
exec_mock.assert_called_once_with(
|
||||
'ln', '-s', '-f', source, link,
|
||||
root_helper=self.connector._root_helper, run_as_root=True)
|
||||
exists_mock.assert_not_called()
|
||||
remove_mock.assert_not_called()
|
||||
link_mock.assert_not_called()
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix issue on RBD driver about not specifying a root helper when running as
|
||||
a non-root user inside a container.
|
||||
(Bug #1885291).
|
Loading…
Reference in New Issue