Skip to content

Commit

Permalink
Use the local configuration in the nfs drivers
Browse files Browse the repository at this point in the history
Fixes bug 1158681

Change-Id: If797a5d3241d6129a8fefea1222b723f03f86452
  • Loading branch information
Mehdi Abaakouk committed Mar 22, 2013
1 parent c38a347 commit d158308
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions cinder/tests/test_nfs.py
Expand Up @@ -156,6 +156,7 @@ def setUp(self):
self.configuration = mox_lib.MockObject(conf.Configuration)
self.configuration.append_config_values(mox_lib.IgnoreArg())
self.configuration.nfs_shares_config = None
self.configuration.nfs_mount_options = None
self.configuration.nfs_mount_point_base = '$state_path/mnt'
self.configuration.nfs_disk_util = 'df'
self.configuration.nfs_sparsed_volumes = True
Expand Down Expand Up @@ -477,8 +478,7 @@ def test_ensure_shares_mounted_should_not_save_mounting_with_error(self):
def test_setup_should_throw_error_if_shares_config_not_configured(self):
"""do_setup should throw error if shares config is not configured."""
drv = self._driver

cfg.CONF.nfs_shares_config = self.TEST_SHARES_CONFIG_FILE
self.configuration.nfs_shares_config = self.TEST_SHARES_CONFIG_FILE

self.assertRaises(exception.NfsException,
drv.do_setup, IsA(context.RequestContext))
Expand All @@ -488,7 +488,6 @@ def test_setup_should_throw_exception_if_nfs_client_is_not_installed(self):
mox = self._mox
drv = self._driver
self.configuration.nfs_shares_config = self.TEST_SHARES_CONFIG_FILE
cfg.CONF.nfs_shares_config = self.TEST_SHARES_CONFIG_FILE

mox.StubOutWithMock(os.path, 'exists')
os.path.exists(self.TEST_SHARES_CONFIG_FILE).AndReturn(True)
Expand Down
4 changes: 2 additions & 2 deletions cinder/volume/drivers/nfs.py
Expand Up @@ -312,8 +312,8 @@ def _mount_nfs(self, nfs_share, mount_path, ensure=False):

# Construct the NFS mount command.
nfs_cmd = ['mount', '-t', 'nfs']
if cfg.CONF.nfs_mount_options is not None:
nfs_cmd.extend(['-o', cfg.CONF.nfs_mount_options])
if self.configuration.nfs_mount_options is not None:
nfs_cmd.extend(['-o', self.configuration.nfs_mount_options])
nfs_cmd.extend([nfs_share, mount_path])

try:
Expand Down

0 comments on commit d158308

Please sign in to comment.