From 436b28b514806661bcb4afd239923d7a495f795e Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Fri, 20 Sep 2013 10:33:54 -0700 Subject: [PATCH] Remove default root_helper of sudo for remotefs This patch removes the default root_helper of sudo for the RemoteFsClient. We should be using the cinder.utils.get_root_helper() Fixes Bug #1223879 Change-Id: I8ba61cd6ac09b85b9ca924a9cf43c2dcea8e6c15 --- cinder/brick/initiator/connector.py | 4 ++-- cinder/brick/remotefs/remotefs.py | 4 ++-- cinder/tests/brick/test_brick_remotefs.py | 2 +- cinder/volume/drivers/nfs.py | 5 ++++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cinder/brick/initiator/connector.py b/cinder/brick/initiator/connector.py index f31d5968d..ae78c24a9 100644 --- a/cinder/brick/initiator/connector.py +++ b/cinder/brick/initiator/connector.py @@ -780,8 +780,8 @@ class RemoteFsConnector(InitiatorConnector): def __init__(self, mount_type, root_helper, driver=None, execute=putils.execute, *args, **kwargs): - self._remotefsclient = remotefs.RemoteFsClient(mount_type, - execute, root_helper) + self._remotefsclient = remotefs.RemoteFsClient(mount_type, root_helper, + execute=execute) super(RemoteFsConnector, self).__init__(root_helper, driver=driver, execute=execute, *args, **kwargs) diff --git a/cinder/brick/remotefs/remotefs.py b/cinder/brick/remotefs/remotefs.py index 8812bd6ed..73e3c3cca 100644 --- a/cinder/brick/remotefs/remotefs.py +++ b/cinder/brick/remotefs/remotefs.py @@ -48,8 +48,8 @@ CONF.register_opts(remotefs_client_opts) class RemoteFsClient(object): - def __init__(self, mount_type, execute=putils.execute, - root_helper="sudo", *args, **kwargs): + def __init__(self, mount_type, root_helper, + execute=putils.execute, *args, **kwargs): self._mount_type = mount_type if mount_type == "nfs": diff --git a/cinder/tests/brick/test_brick_remotefs.py b/cinder/tests/brick/test_brick_remotefs.py index 88d0243ab..7bd28e2a3 100644 --- a/cinder/tests/brick/test_brick_remotefs.py +++ b/cinder/tests/brick/test_brick_remotefs.py @@ -34,7 +34,7 @@ class BrickRemoteFsTestCase(test.TestCase): def setUp(self): super(BrickRemoteFsTestCase, self).setUp() self._mox = mox.Mox() - self._nfsclient = remotefs.RemoteFsClient('nfs') + self._nfsclient = remotefs.RemoteFsClient('nfs', 'sudo') self._nfsclient._mount_options = None self._nfsclient._mount_base = self.TEST_MNT_BASE self.addCleanup(self._mox.UnsetStubs) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index c9e3b8c7e..2e58e9430 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -26,6 +26,7 @@ from cinder.image import image_utils from cinder.openstack.common import log as logging from cinder.openstack.common import processutils as putils from cinder import units +from cinder import utils from cinder.volume import driver VERSION = '1.1.0' @@ -359,7 +360,9 @@ class NfsDriver(RemoteFsDriver): self._remotefsclient = None super(NfsDriver, self).__init__(*args, **kwargs) self.configuration.append_config_values(volume_opts) - self._remotefsclient = remotefs.RemoteFsClient('nfs', execute) + root_helper = utils.get_root_helper() + self._remotefsclient = remotefs.RemoteFsClient('nfs', root_helper, + execute=execute) def set_execute(self, execute): super(NfsDriver, self).set_execute(execute) -- 2.45.2