Skip to content
Permalink
Browse files

Brick connector fix for NFS drivers

This change fixes the error that comes
while getting brick connector and attaching volumes
in case of NFS drivers in cinder. The attribute for
mount point base was not passed to attach_volume method
as the connector initialization logic is common for all
types of protocols. It is fixed by populating
the required parameter in the RemoteFsConnector
for NFS drivers.

Change-Id: I8601326b318f6f8c53a03610f1b4f2bfd14070ff
Closes-Bug: #1238085
  • Loading branch information...
singn committed Oct 20, 2013
1 parent 727175b commit b6b9df2940ac07f715f759f4c315b2cf088c2320
Showing with 17 additions and 6 deletions.
  1. +11 −1 cinder/brick/initiator/connector.py
  2. +1 −1 cinder/tests/test_coraid.py
  3. +1 −0 cinder/volume/driver.py
  4. +4 −4 cinder/volume/drivers/nfs.py
@@ -797,6 +797,15 @@ def __init__(self, mount_type, root_helper, driver=None,
execute=putils.execute,
device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
*args, **kwargs):
if mount_type.lower() == 'nfs':
if driver:
kwargs = kwargs or {}
kwargs['nfs_mount_point_base'] =\
kwargs.get('nfs_mount_point_base') or\
getattr(driver, 'base', None)
else:
LOG.warn(_("NFS volume driver is absent."
" RemoteFsClient may not initialize properly."))
self._remotefsclient = remotefs.RemoteFsClient(mount_type, root_helper,
execute=execute,
*args, **kwargs)
@@ -822,7 +831,8 @@ def connect_volume(self, connection_properties):
"""

mnt_flags = []
if 'options' in connection_properties:
if ('options' in connection_properties and
connection_properties['options']):
mnt_flags = connection_properties['options'].split()

nfs_share = connection_properties['export']
@@ -785,7 +785,7 @@ def setUp(self):

aoe_initiator = self.mox.CreateMockAnything()

utils.brick_get_connector('aoe',
utils.brick_get_connector('aoe', driver=mox.IgnoreArg(),
device_scan_attempts=3,
use_multipath=False).\
AndReturn(aoe_initiator)
@@ -371,6 +371,7 @@ def _attach_volume(self, context, volume, properties, remote=False):
device_scan_attempts = self.configuration.num_volume_device_scan_tries
protocol = conn['driver_volume_type']
connector = utils.brick_get_connector(protocol,
driver=self,
use_multipath=use_multipath,
device_scan_attempts=
device_scan_attempts)
@@ -373,15 +373,15 @@ def __init__(self, execute=putils.execute, *args, **kwargs):
super(NfsDriver, self).__init__(*args, **kwargs)
self.configuration.append_config_values(volume_opts)
root_helper = utils.get_root_helper()
base = getattr(self.configuration,
'nfs_mount_point_base',
CONF.nfs_mount_point_base)
self.base = getattr(self.configuration,
'nfs_mount_point_base',
CONF.nfs_mount_point_base)
opts = getattr(self.configuration,
'nfs_mount_options',
CONF.nfs_mount_options)
self._remotefsclient = remotefs.RemoteFsClient(
'nfs', root_helper, execute=execute,
nfs_mount_point_base=base,
nfs_mount_point_base=self.base,
nfs_mount_options=opts)

def set_execute(self, execute):

0 comments on commit b6b9df2

Please sign in to comment.
You can’t perform that action at this time.