From d15830883eba4b8fb64e0e4760a217ff832f288f Mon Sep 17 00:00:00 2001
From: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
Date: Fri, 22 Mar 2013 10:26:09 +0100
Subject: [PATCH] Use the local configuration in the nfs drivers

Fixes bug 1158681

Change-Id: If797a5d3241d6129a8fefea1222b723f03f86452
---
 cinder/tests/test_nfs.py     | 5 ++---
 cinder/volume/drivers/nfs.py | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/cinder/tests/test_nfs.py b/cinder/tests/test_nfs.py
index ebeb0d1cd..a79304531 100644
--- a/cinder/tests/test_nfs.py
+++ b/cinder/tests/test_nfs.py
@@ -156,6 +156,7 @@ class NfsDriverTestCase(test.TestCase):
         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
@@ -477,8 +478,7 @@ class NfsDriverTestCase(test.TestCase):
     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))
@@ -488,7 +488,6 @@ class NfsDriverTestCase(test.TestCase):
         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)
diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py
index f95dbec6b..767a26efa 100755
--- a/cinder/volume/drivers/nfs.py
+++ b/cinder/volume/drivers/nfs.py
@@ -312,8 +312,8 @@ class NfsDriver(RemoteFsDriver):
 
         # 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:
-- 
2.45.2