Merge "RBD: Fix missing root_helper"
This commit is contained in:
commit
d17e32ec0d
@ -127,7 +127,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."""
|
||||
@ -180,7 +180,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)
|
||||
|
||||
@staticmethod
|
||||
def _in_container():
|
||||
|
@ -292,8 +292,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')
|
||||
@ -333,8 +334,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()
|
||||
|
6
releasenotes/notes/rbd-non-root-ac971f51461d4d6b.yaml
Normal file
6
releasenotes/notes/rbd-non-root-ac971f51461d4d6b.yaml
Normal file
@ -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
Block a user