GPFS Path: Fix bugs related to initialization of GPFS Driver
Due to lack of GPFS path ('/usr/lpp/mmfs/bin/') export, driver is not able to find the GPFS commands causing the initialization failure. With this patch, GPFS will be able to run all GPFS commands irrespective of GPFS path export. Change-Id: I1aa8baf884dfaa42c37e575f0b6e1317f18543a1 Closes-bug: #1690785
This commit is contained in:
parent
481da3d9c6
commit
e90dd3d711
@ -139,6 +139,10 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
self.sshpool = None
|
self.sshpool = None
|
||||||
self.ssh_connections = {}
|
self.ssh_connections = {}
|
||||||
self._gpfs_execute = None
|
self._gpfs_execute = None
|
||||||
|
if self.configuration.is_gpfs_node:
|
||||||
|
self.GPFS_PATH = ''
|
||||||
|
else:
|
||||||
|
self.GPFS_PATH = '/usr/lpp/mmfs/bin/'
|
||||||
|
|
||||||
def do_setup(self, context):
|
def do_setup(self, context):
|
||||||
"""Any initialization the share driver does while starting."""
|
"""Any initialization the share driver does while starting."""
|
||||||
@ -236,7 +240,7 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
def _check_gpfs_state(self):
|
def _check_gpfs_state(self):
|
||||||
try:
|
try:
|
||||||
out, __ = self._gpfs_execute('mmgetstate', '-Y')
|
out, __ = self._gpfs_execute(self.GPFS_PATH + 'mmgetstate', '-Y')
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to check GPFS state. Error: %(excmsg)s.') %
|
msg = (_('Failed to check GPFS state. Error: %(excmsg)s.') %
|
||||||
{'excmsg': e})
|
{'excmsg': e})
|
||||||
@ -269,7 +273,7 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
def _is_gpfs_path(self, directory):
|
def _is_gpfs_path(self, directory):
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmlsattr', directory)
|
self._gpfs_execute(self.GPFS_PATH + 'mmlsattr', directory)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('%(dir)s is not on GPFS filesystem. Error: %(excmsg)s.') %
|
msg = (_('%(dir)s is not on GPFS filesystem. Error: %(excmsg)s.') %
|
||||||
{'dir': directory, 'excmsg': e})
|
{'dir': directory, 'excmsg': e})
|
||||||
@ -320,8 +324,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
# create fileset for the share, link it to root path and set max size
|
# create fileset for the share, link it to root path and set max size
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmcrfileset', fsdev, sharename,
|
self._gpfs_execute(self.GPFS_PATH + 'mmcrfileset', fsdev,
|
||||||
'--inode-space', 'new')
|
sharename, '--inode-space', 'new')
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to create fileset on %(fsdev)s for '
|
msg = (_('Failed to create fileset on %(fsdev)s for '
|
||||||
'the share %(sharename)s. Error: %(excmsg)s.') %
|
'the share %(sharename)s. Error: %(excmsg)s.') %
|
||||||
@ -331,8 +335,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
raise exception.GPFSException(msg)
|
raise exception.GPFSException(msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmlinkfileset', fsdev, sharename, '-J',
|
self._gpfs_execute(self.GPFS_PATH + 'mmlinkfileset', fsdev,
|
||||||
sharepath)
|
sharename, '-J', sharepath)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to link fileset for the share %(sharename)s. '
|
msg = (_('Failed to link fileset for the share %(sharename)s. '
|
||||||
'Error: %(excmsg)s.') %
|
'Error: %(excmsg)s.') %
|
||||||
@ -341,8 +345,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
raise exception.GPFSException(msg)
|
raise exception.GPFSException(msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmsetquota', fsdev + ':' + sharename,
|
self._gpfs_execute(self.GPFS_PATH + 'mmsetquota', fsdev + ':' +
|
||||||
'--block', '0:' + sizestr)
|
sharename, '--block', '0:' + sizestr)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to set quota for the share %(sharename)s. '
|
msg = (_('Failed to set quota for the share %(sharename)s. '
|
||||||
'Error: %(excmsg)s.') %
|
'Error: %(excmsg)s.') %
|
||||||
@ -373,7 +377,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
# unlink and delete the share's fileset
|
# unlink and delete the share's fileset
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmunlinkfileset', fsdev, sharename, '-f',
|
self._gpfs_execute(self.GPFS_PATH + 'mmunlinkfileset', fsdev,
|
||||||
|
sharename, '-f',
|
||||||
ignore_exit_code=ignore_exit_code)
|
ignore_exit_code=ignore_exit_code)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed unlink fileset for share %(sharename)s. '
|
msg = (_('Failed unlink fileset for share %(sharename)s. '
|
||||||
@ -383,7 +388,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
raise exception.GPFSException(msg)
|
raise exception.GPFSException(msg)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmdelfileset', fsdev, sharename, '-f',
|
self._gpfs_execute(self.GPFS_PATH + 'mmdelfileset', fsdev,
|
||||||
|
sharename, '-f',
|
||||||
ignore_exit_code=ignore_exit_code)
|
ignore_exit_code=ignore_exit_code)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed delete fileset for share %(sharename)s. '
|
msg = (_('Failed delete fileset for share %(sharename)s. '
|
||||||
@ -420,8 +426,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmcrsnapshot', fsdev, snapshot['name'],
|
self._gpfs_execute(self.GPFS_PATH + 'mmcrsnapshot', fsdev,
|
||||||
'-j', sharename)
|
snapshot['name'], '-j', sharename)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to create snapshot %(snapshot)s. '
|
msg = (_('Failed to create snapshot %(snapshot)s. '
|
||||||
'Error: %(excmsg)s.') %
|
'Error: %(excmsg)s.') %
|
||||||
@ -435,8 +441,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
fsdev = self._get_gpfs_device()
|
fsdev = self._get_gpfs_device()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmdelsnapshot', fsdev, snapshot['name'],
|
self._gpfs_execute(self.GPFS_PATH + 'mmdelsnapshot', fsdev,
|
||||||
'-j', sharename)
|
snapshot['name'], '-j', sharename)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to delete snapshot %(snapshot)s. '
|
msg = (_('Failed to delete snapshot %(snapshot)s. '
|
||||||
'Error: %(excmsg)s.') %
|
'Error: %(excmsg)s.') %
|
||||||
@ -464,8 +470,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
sizestr = '%sG' % new_size
|
sizestr = '%sG' % new_size
|
||||||
fsdev = self._get_gpfs_device()
|
fsdev = self._get_gpfs_device()
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmsetquota', fsdev + ':' + sharename,
|
self._gpfs_execute(self.GPFS_PATH + 'mmsetquota', fsdev + ':' +
|
||||||
'--block', '0:' + sizestr)
|
sharename, '--block', '0:' + sizestr)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('Failed to set quota for the share %(sharename)s. '
|
msg = (_('Failed to set quota for the share %(sharename)s. '
|
||||||
'Error: %(excmsg)s.') %
|
'Error: %(excmsg)s.') %
|
||||||
@ -571,8 +577,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
def _is_share_valid(self, fsdev, location):
|
def _is_share_valid(self, fsdev, location):
|
||||||
try:
|
try:
|
||||||
out, __ = self._gpfs_execute('mmlsfileset', fsdev, '-J',
|
out, __ = self._gpfs_execute(self.GPFS_PATH + 'mmlsfileset', fsdev,
|
||||||
location, '-L', '-Y')
|
'-J', location, '-L', '-Y')
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = (_('Given share path %(share_path)s does not exist at '
|
msg = (_('Given share path %(share_path)s does not exist at '
|
||||||
'mount point %(mount_point)s.')
|
'mount point %(mount_point)s.')
|
||||||
@ -593,8 +599,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
|
|
||||||
def _get_share_name(self, fsdev, location):
|
def _get_share_name(self, fsdev, location):
|
||||||
try:
|
try:
|
||||||
out, __ = self._gpfs_execute('mmlsfileset', fsdev, '-J',
|
out, __ = self._gpfs_execute(self.GPFS_PATH + 'mmlsfileset', fsdev,
|
||||||
location, '-L', '-Y')
|
'-J', location, '-L', '-Y')
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = (_('Given share path %(share_path)s does not exist at '
|
msg = (_('Given share path %(share_path)s does not exist at '
|
||||||
'mount point %(mount_point)s.')
|
'mount point %(mount_point)s.')
|
||||||
@ -617,7 +623,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
new_share_name = share['name']
|
new_share_name = share['name']
|
||||||
new_export_location = self._local_path(new_share_name)
|
new_export_location = self._local_path(new_share_name)
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmunlinkfileset', fsdev, old_share_name, '-f')
|
self._gpfs_execute(self.GPFS_PATH + 'mmunlinkfileset', fsdev,
|
||||||
|
old_share_name, '-f')
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to unlink fileset for share %s.') % new_share_name
|
msg = _('Failed to unlink fileset for share %s.') % new_share_name
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
@ -625,8 +632,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
LOG.debug('Unlinked the fileset of share %s.', old_share_name)
|
LOG.debug('Unlinked the fileset of share %s.', old_share_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmchfileset', fsdev, old_share_name,
|
self._gpfs_execute(self.GPFS_PATH + 'mmchfileset', fsdev,
|
||||||
'-j', new_share_name)
|
old_share_name, '-j', new_share_name)
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to rename fileset for share %s.') % new_share_name
|
msg = _('Failed to rename fileset for share %s.') % new_share_name
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
@ -635,8 +642,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
{'old_share': old_share_name, 'new_share': new_share_name})
|
{'old_share': old_share_name, 'new_share': new_share_name})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmlinkfileset', fsdev, new_share_name, '-J',
|
self._gpfs_execute(self.GPFS_PATH + 'mmlinkfileset', fsdev,
|
||||||
new_export_location)
|
new_share_name, '-J', new_export_location)
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to link fileset for the share %s.'
|
msg = _('Failed to link fileset for the share %s.'
|
||||||
) % new_share_name
|
) % new_share_name
|
||||||
@ -656,8 +663,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
LOG.debug('Changed the permission of share %s.', new_share_name)
|
LOG.debug('Changed the permission of share %s.', new_share_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
out, __ = self._gpfs_execute('mmlsquota', '-j', new_share_name,
|
out, __ = self._gpfs_execute(self.GPFS_PATH + 'mmlsquota', '-j',
|
||||||
'-Y', fsdev)
|
new_share_name, '-Y', fsdev)
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to check size for share %s.') % new_share_name
|
msg = _('Failed to check size for share %s.') % new_share_name
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
@ -678,8 +685,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
# (units.Mi * KB = 1GB)
|
# (units.Mi * KB = 1GB)
|
||||||
if share_size < units.Mi:
|
if share_size < units.Mi:
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmsetquota', fsdev + ':' + new_share_name,
|
self._gpfs_execute(self.GPFS_PATH + 'mmsetquota', fsdev + ':' +
|
||||||
'--block', '0:1G')
|
new_share_name, '--block', '0:1G')
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to set quota for share %s.') % new_share_name
|
msg = _('Failed to set quota for share %s.') % new_share_name
|
||||||
LOG.exception(msg)
|
LOG.exception(msg)
|
||||||
@ -693,8 +700,8 @@ class GPFSShareDriver(driver.ExecuteMixin, driver.GaneshaMixin,
|
|||||||
share_size = int(math.ceil(float(share_size) / units.Mi))
|
share_size = int(math.ceil(float(share_size) / units.Mi))
|
||||||
if orig_share_size != share_size * units.Mi:
|
if orig_share_size != share_size * units.Mi:
|
||||||
try:
|
try:
|
||||||
self._gpfs_execute('mmsetquota', fsdev + ':' +
|
self._gpfs_execute(self.GPFS_PATH + 'mmsetquota', fsdev +
|
||||||
new_share_name, '--block', '0:' +
|
':' + new_share_name, '--block', '0:' +
|
||||||
str(share_size) + 'G')
|
str(share_size) + 'G')
|
||||||
except exception.ProcessExecutionError:
|
except exception.ProcessExecutionError:
|
||||||
msg = _('Failed to set quota for share %s.'
|
msg = _('Failed to set quota for share %s.'
|
||||||
@ -1027,10 +1034,14 @@ class CESHelper(NASHelperBase):
|
|||||||
def __init__(self, execute, config_object):
|
def __init__(self, execute, config_object):
|
||||||
super(CESHelper, self).__init__(execute, config_object)
|
super(CESHelper, self).__init__(execute, config_object)
|
||||||
self._execute = execute
|
self._execute = execute
|
||||||
|
if self.configuration.is_gpfs_node:
|
||||||
|
self.GPFS_PATH = ''
|
||||||
|
else:
|
||||||
|
self.GPFS_PATH = '/usr/lpp/mmfs/bin/'
|
||||||
|
|
||||||
def _execute_mmnfs_command(self, cmd, err_msg):
|
def _execute_mmnfs_command(self, cmd, err_msg):
|
||||||
try:
|
try:
|
||||||
out, __ = self._execute('mmnfs', 'export', *cmd)
|
out, __ = self._execute(self.GPFS_PATH + 'mmnfs', 'export', *cmd)
|
||||||
except exception.ProcessExecutionError as e:
|
except exception.ProcessExecutionError as e:
|
||||||
msg = (_('%(err_msg)s Error: %(e)s.')
|
msg = (_('%(err_msg)s Error: %(e)s.')
|
||||||
% {'err_msg': err_msg, 'e': e})
|
% {'err_msg': err_msg, 'e': e})
|
||||||
|
@ -42,6 +42,7 @@ class GPFSShareDriverTestCase(test.TestCase):
|
|||||||
super(GPFSShareDriverTestCase, self).setUp()
|
super(GPFSShareDriverTestCase, self).setUp()
|
||||||
self._context = context.get_admin_context()
|
self._context = context.get_admin_context()
|
||||||
self._gpfs_execute = mock.Mock(return_value=('', ''))
|
self._gpfs_execute = mock.Mock(return_value=('', ''))
|
||||||
|
self.GPFS_PATH = '/usr/lpp/mmfs/bin/'
|
||||||
|
|
||||||
self._helper_fake = mock.Mock()
|
self._helper_fake = mock.Mock()
|
||||||
CONF.set_default('driver_handles_share_servers', False)
|
CONF.set_default('driver_handles_share_servers', False)
|
||||||
@ -398,8 +399,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._gpfs_execute = mock.Mock(return_value=0)
|
self._driver._gpfs_execute = mock.Mock(return_value=0)
|
||||||
self._driver._delete_share_snapshot(self.snapshot)
|
self._driver._delete_share_snapshot(self.snapshot)
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmdelsnapshot', self.fakedev, self.snapshot['name'],
|
self.GPFS_PATH + 'mmdelsnapshot', self.fakedev,
|
||||||
'-j', self.snapshot['share_name']
|
self.snapshot['name'], '-j', self.snapshot['share_name']
|
||||||
)
|
)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
|
|
||||||
@ -412,8 +413,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._delete_share_snapshot, self.snapshot)
|
self._driver._delete_share_snapshot, self.snapshot)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmdelsnapshot', self.fakedev, self.snapshot['name'],
|
self.GPFS_PATH + 'mmdelsnapshot', self.fakedev,
|
||||||
'-j', self.snapshot['share_name']
|
self.snapshot['name'], '-j', self.snapshot['share_name']
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_extend_share(self):
|
def test_extend_share(self):
|
||||||
@ -426,10 +427,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
||||||
self._driver._extend_share(self.share, 10)
|
self._driver._extend_share(self.share, 10)
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmsetquota',
|
self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
self.fakedev + ':' + self.share['name'],
|
self.share['name'], '--block', '0:10G')
|
||||||
'--block',
|
|
||||||
'0:10G')
|
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
|
|
||||||
def test__extend_share_exception(self):
|
def test__extend_share_exception(self):
|
||||||
@ -439,12 +438,9 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
)
|
)
|
||||||
self.assertRaises(exception.GPFSException,
|
self.assertRaises(exception.GPFSException,
|
||||||
self._driver._extend_share, self.share, 10)
|
self._driver._extend_share, self.share, 10)
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmsetquota',
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
self.fakedev +
|
self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
':' +
|
self.share['name'], '--block', '0:10G')
|
||||||
self.share['name'],
|
|
||||||
'--block',
|
|
||||||
'0:10G')
|
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
|
|
||||||
def test_update_access_allow(self):
|
def test_update_access_allow(self):
|
||||||
@ -535,14 +531,16 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
fakeout = "mmgetstate::state:\nmmgetstate::active:"
|
fakeout = "mmgetstate::state:\nmmgetstate::active:"
|
||||||
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
||||||
result = self._driver._check_gpfs_state()
|
result = self._driver._check_gpfs_state()
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmgetstate', '-Y')
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
|
self.GPFS_PATH + 'mmgetstate', '-Y')
|
||||||
self.assertEqual(result, True)
|
self.assertEqual(result, True)
|
||||||
|
|
||||||
def test__check_gpfs_state_down(self):
|
def test__check_gpfs_state_down(self):
|
||||||
fakeout = "mmgetstate::state:\nmmgetstate::down:"
|
fakeout = "mmgetstate::state:\nmmgetstate::down:"
|
||||||
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
||||||
result = self._driver._check_gpfs_state()
|
result = self._driver._check_gpfs_state()
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmgetstate', '-Y')
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
|
self.GPFS_PATH + 'mmgetstate', '-Y')
|
||||||
self.assertEqual(result, False)
|
self.assertEqual(result, False)
|
||||||
|
|
||||||
def test__check_gpfs_state_wrong_output_exception(self):
|
def test__check_gpfs_state_wrong_output_exception(self):
|
||||||
@ -550,7 +548,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
self._driver._gpfs_execute = mock.Mock(return_value=(fakeout, ''))
|
||||||
self.assertRaises(exception.GPFSException,
|
self.assertRaises(exception.GPFSException,
|
||||||
self._driver._check_gpfs_state)
|
self._driver._check_gpfs_state)
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmgetstate', '-Y')
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
|
self.GPFS_PATH + 'mmgetstate', '-Y')
|
||||||
|
|
||||||
def test__check_gpfs_state_exception(self):
|
def test__check_gpfs_state_exception(self):
|
||||||
self._driver._gpfs_execute = mock.Mock(
|
self._driver._gpfs_execute = mock.Mock(
|
||||||
@ -558,7 +557,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
)
|
)
|
||||||
self.assertRaises(exception.GPFSException,
|
self.assertRaises(exception.GPFSException,
|
||||||
self._driver._check_gpfs_state)
|
self._driver._check_gpfs_state)
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmgetstate', '-Y')
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
|
self.GPFS_PATH + 'mmgetstate', '-Y')
|
||||||
|
|
||||||
def test__is_dir_success(self):
|
def test__is_dir_success(self):
|
||||||
fakeoutput = "directory"
|
fakeoutput = "directory"
|
||||||
@ -591,8 +591,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
def test__is_gpfs_path_ok(self):
|
def test__is_gpfs_path_ok(self):
|
||||||
self._driver._gpfs_execute = mock.Mock(return_value=0)
|
self._driver._gpfs_execute = mock.Mock(return_value=0)
|
||||||
result = self._driver._is_gpfs_path(self.fakefspath)
|
result = self._driver._is_gpfs_path(self.fakefspath)
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmlsattr',
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
self.fakefspath)
|
self.GPFS_PATH + 'mmlsattr', self.fakefspath)
|
||||||
self.assertEqual(result, True)
|
self.assertEqual(result, True)
|
||||||
|
|
||||||
def test__is_gpfs_path_exception(self):
|
def test__is_gpfs_path_exception(self):
|
||||||
@ -602,8 +602,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.assertRaises(exception.GPFSException,
|
self.assertRaises(exception.GPFSException,
|
||||||
self._driver._is_gpfs_path,
|
self._driver._is_gpfs_path,
|
||||||
self.fakefspath)
|
self.fakefspath)
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmlsattr',
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
self.fakefspath)
|
self.GPFS_PATH + 'mmlsattr', self.fakefspath)
|
||||||
|
|
||||||
def test__get_gpfs_device(self):
|
def test__get_gpfs_device(self):
|
||||||
fakeout = "Filesystem\n" + self.fakedev
|
fakeout = "Filesystem\n" + self.fakedev
|
||||||
@ -628,20 +628,17 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
||||||
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
||||||
self._driver._create_share(self.share)
|
self._driver._create_share(self.share)
|
||||||
self._driver._gpfs_execute.assert_any_call('mmcrfileset',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self.fakedev,
|
self.GPFS_PATH + 'mmcrfileset', self.fakedev, self.share['name'],
|
||||||
self.share['name'],
|
|
||||||
'--inode-space', 'new')
|
'--inode-space', 'new')
|
||||||
self._driver._gpfs_execute.assert_any_call('mmlinkfileset',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self.fakedev,
|
self.GPFS_PATH + 'mmlinkfileset', self.fakedev, self.share['name'],
|
||||||
self.share['name'],
|
|
||||||
'-J', self.fakesharepath)
|
'-J', self.fakesharepath)
|
||||||
self._driver._gpfs_execute.assert_any_call('mmsetquota', self.fakedev +
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
':' + self.share['name'],
|
self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
'--block', '0:' + sizestr)
|
self.share['name'], '--block', '0:' + sizestr)
|
||||||
self._driver._gpfs_execute.assert_any_call('chmod',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'777',
|
'chmod', '777', self.fakesharepath)
|
||||||
self.fakesharepath)
|
|
||||||
|
|
||||||
self._driver._local_path.assert_called_once_with(self.share['name'])
|
self._driver._local_path.assert_called_once_with(self.share['name'])
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
@ -656,21 +653,19 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._create_share, self.share)
|
self._driver._create_share, self.share)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
self._driver._local_path.assert_called_once_with(self.share['name'])
|
self._driver._local_path.assert_called_once_with(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_called_once_with('mmcrfileset',
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
self.fakedev,
|
self.GPFS_PATH + 'mmcrfileset', self.fakedev, self.share['name'],
|
||||||
self.share['name'],
|
'--inode-space', 'new')
|
||||||
'--inode-space',
|
|
||||||
'new')
|
|
||||||
|
|
||||||
def test__delete_share(self):
|
def test__delete_share(self):
|
||||||
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
||||||
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
||||||
self._driver._delete_share(self.share)
|
self._driver._delete_share(self.share)
|
||||||
self._driver._gpfs_execute.assert_any_call(
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'mmunlinkfileset', self.fakedev, self.share['name'],
|
self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f', ignore_exit_code=[2])
|
self.share['name'], '-f', ignore_exit_code=[2])
|
||||||
self._driver._gpfs_execute.assert_any_call(
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'mmdelfileset', self.fakedev, self.share['name'],
|
self.GPFS_PATH + 'mmdelfileset', self.fakedev, self.share['name'],
|
||||||
'-f', ignore_exit_code=[2])
|
'-f', ignore_exit_code=[2])
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
|
|
||||||
@ -683,16 +678,16 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._delete_share, self.share)
|
self._driver._delete_share, self.share)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmunlinkfileset', self.fakedev, self.share['name'],
|
self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f', ignore_exit_code=[2])
|
self.share['name'], '-f', ignore_exit_code=[2])
|
||||||
|
|
||||||
def test__create_share_snapshot(self):
|
def test__create_share_snapshot(self):
|
||||||
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
self._driver._gpfs_execute = mock.Mock(return_value=True)
|
||||||
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
self._driver._get_gpfs_device = mock.Mock(return_value=self.fakedev)
|
||||||
self._driver._create_share_snapshot(self.snapshot)
|
self._driver._create_share_snapshot(self.snapshot)
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmcrsnapshot', self.fakedev, self.snapshot['name'],
|
self.GPFS_PATH + 'mmcrsnapshot', self.fakedev,
|
||||||
'-j', self.snapshot['share_name']
|
self.snapshot['name'], '-j', self.snapshot['share_name']
|
||||||
)
|
)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
|
|
||||||
@ -705,8 +700,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._driver._create_share_snapshot, self.snapshot)
|
self._driver._create_share_snapshot, self.snapshot)
|
||||||
self._driver._get_gpfs_device.assert_called_once_with()
|
self._driver._get_gpfs_device.assert_called_once_with()
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmcrsnapshot', self.fakedev, self.snapshot['name'],
|
self.GPFS_PATH + 'mmcrsnapshot', self.fakedev,
|
||||||
'-j', self.snapshot['share_name']
|
self.snapshot['name'], '-j', self.snapshot['share_name']
|
||||||
)
|
)
|
||||||
|
|
||||||
def test__create_share_from_snapshot(self):
|
def test__create_share_from_snapshot(self):
|
||||||
@ -746,7 +741,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
result = self._driver._is_share_valid(self.fakedev, self.fakesharepath)
|
result = self._driver._is_share_valid(self.fakedev, self.fakesharepath)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmlsfileset', self.fakedev, '-J', self.fakesharepath, '-L', '-Y')
|
self.GPFS_PATH + 'mmlsfileset', self.fakedev, '-J',
|
||||||
|
self.fakesharepath, '-L', '-Y')
|
||||||
if fakeout == "mmlsfileset::allocInodes:\nmmlsfileset::100096:":
|
if fakeout == "mmlsfileset::allocInodes:\nmmlsfileset::100096:":
|
||||||
self.assertTrue(result)
|
self.assertTrue(result)
|
||||||
else:
|
else:
|
||||||
@ -761,7 +757,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.fakesharepath)
|
self.fakesharepath)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmlsfileset', self.fakedev, '-J', self.fakesharepath, '-L', '-Y')
|
self.GPFS_PATH + 'mmlsfileset', self.fakedev, '-J',
|
||||||
|
self.fakesharepath, '-L', '-Y')
|
||||||
|
|
||||||
def test__is_share_valid_no_share_exist_exception(self):
|
def test__is_share_valid_no_share_exist_exception(self):
|
||||||
fakeout = "mmlsfileset::allocInodes:"
|
fakeout = "mmlsfileset::allocInodes:"
|
||||||
@ -772,7 +769,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.fakesharepath)
|
self.fakesharepath)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmlsfileset', self.fakedev, '-J', self.fakesharepath, '-L', '-Y')
|
self.GPFS_PATH + 'mmlsfileset', self.fakedev, '-J',
|
||||||
|
self.fakesharepath, '-L', '-Y')
|
||||||
|
|
||||||
def test__get_share_name(self):
|
def test__get_share_name(self):
|
||||||
fakeout = "mmlsfileset::filesetName:\nmmlsfileset::existingshare:"
|
fakeout = "mmlsfileset::filesetName:\nmmlsfileset::existingshare:"
|
||||||
@ -791,7 +789,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.fakesharepath)
|
self.fakesharepath)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmlsfileset', self.fakedev, '-J', self.fakesharepath, '-L', '-Y')
|
self.GPFS_PATH + 'mmlsfileset', self.fakedev, '-J',
|
||||||
|
self.fakesharepath, '-L', '-Y')
|
||||||
|
|
||||||
def test__get_share_name_no_share_exist_exception(self):
|
def test__get_share_name_no_share_exist_exception(self):
|
||||||
fakeout = "mmlsfileset::filesetName:"
|
fakeout = "mmlsfileset::filesetName:"
|
||||||
@ -802,7 +801,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.fakesharepath)
|
self.fakesharepath)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmlsfileset', self.fakedev, '-J', self.fakesharepath, '-L', '-Y')
|
self.GPFS_PATH + 'mmlsfileset', self.fakedev, '-J',
|
||||||
|
self.fakesharepath, '-L', '-Y')
|
||||||
|
|
||||||
@ddt.data("mmlsquota::blockLimit:\nmmlsquota::1048577",
|
@ddt.data("mmlsquota::blockLimit:\nmmlsquota::1048577",
|
||||||
"mmlsquota::blockLimit:\nmmlsquota::1048576",
|
"mmlsquota::blockLimit:\nmmlsquota::1048576",
|
||||||
@ -815,35 +815,27 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
actual_size, actual_path = self._driver._manage_existing(
|
actual_size, actual_path = self._driver._manage_existing(
|
||||||
self.fakedev, self.share, self.fakeexistingshare)
|
self.fakedev, self.share, self.fakeexistingshare)
|
||||||
|
|
||||||
self._driver._gpfs_execute.assert_any_call('mmunlinkfileset',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self.fakedev,
|
self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
self.fakeexistingshare,
|
self.fakeexistingshare, '-f')
|
||||||
'-f')
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self._driver._gpfs_execute.assert_any_call('mmchfileset',
|
self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
self.fakedev,
|
self.fakeexistingshare, '-j', self.share['name'])
|
||||||
self.fakeexistingshare,
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'-j', self.share['name'])
|
self.GPFS_PATH + 'mmlinkfileset', self.fakedev, self.share['name'],
|
||||||
self._driver._gpfs_execute.assert_any_call('mmlinkfileset',
|
|
||||||
self.fakedev,
|
|
||||||
self.share['name'],
|
|
||||||
'-J', self.fakesharepath)
|
'-J', self.fakesharepath)
|
||||||
self._driver._gpfs_execute.assert_any_call('chmod',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'777',
|
'chmod', '777', self.fakesharepath)
|
||||||
self.fakesharepath)
|
|
||||||
if fakeout == "mmlsquota::blockLimit:\nmmlsquota::1048577":
|
if fakeout == "mmlsquota::blockLimit:\nmmlsquota::1048577":
|
||||||
self._driver._gpfs_execute.assert_called_with('mmsetquota',
|
self._driver._gpfs_execute.assert_called_with(
|
||||||
self.fakedev + ':' +
|
self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
self.share['name'],
|
self.share['name'], '--block', '0:2G')
|
||||||
'--block',
|
|
||||||
'0:2G')
|
|
||||||
self.assertEqual(2, actual_size)
|
self.assertEqual(2, actual_size)
|
||||||
self.assertEqual('fakelocation', actual_path)
|
self.assertEqual('fakelocation', actual_path)
|
||||||
elif fakeout == "mmlsquota::blockLimit:\nmmlsquota::0":
|
elif fakeout == "mmlsquota::blockLimit:\nmmlsquota::0":
|
||||||
self._driver._gpfs_execute.assert_called_with('mmsetquota',
|
self._driver._gpfs_execute.assert_called_with(
|
||||||
self.fakedev + ':' +
|
self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
self.share['name'],
|
self.share['name'], '--block', '0:1G')
|
||||||
'--block',
|
|
||||||
'0:1G')
|
|
||||||
self.assertEqual(1, actual_size)
|
self.assertEqual(1, actual_size)
|
||||||
self.assertEqual('fakelocation', actual_path)
|
self.assertEqual('fakelocation', actual_path)
|
||||||
else:
|
else:
|
||||||
@ -861,7 +853,8 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_called_once_with(self.share['name'])
|
self._driver._local_path.assert_called_once_with(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_called_once_with(
|
self._driver._gpfs_execute.assert_called_once_with(
|
||||||
'mmunlinkfileset', self.fakedev, self.fakeexistingshare, '-f')
|
self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
|
self.fakeexistingshare, '-f')
|
||||||
|
|
||||||
def test__manage_existing_fileset_creation_exception(self):
|
def test__manage_existing_fileset_creation_exception(self):
|
||||||
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
||||||
@ -874,10 +867,10 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name'])])
|
self.fakeexistingshare, '-j', self.share['name'])])
|
||||||
|
|
||||||
def test__manage_existing_fileset_relink_exception(self):
|
def test__manage_existing_fileset_relink_exception(self):
|
||||||
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
||||||
@ -890,12 +883,12 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name']),
|
self.fakeexistingshare, '-j', self.share['name']),
|
||||||
mock.call('mmlinkfileset', self.fakedev, self.share['name'], '-J',
|
mock.call(self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self.fakesharepath)])
|
self.share['name'], '-J', self.fakesharepath)])
|
||||||
|
|
||||||
def test__manage_existing_permission_change_exception(self):
|
def test__manage_existing_permission_change_exception(self):
|
||||||
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
self._driver._local_path = mock.Mock(return_value=self.fakesharepath)
|
||||||
@ -908,12 +901,12 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name']),
|
self.fakeexistingshare, '-j', self.share['name']),
|
||||||
mock.call('mmlinkfileset', self.fakedev, self.share['name'], '-J',
|
mock.call(self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self.fakesharepath),
|
self.share['name'], '-J', self.fakesharepath),
|
||||||
mock.call('chmod', '777', self.fakesharepath)])
|
mock.call('chmod', '777', self.fakesharepath)])
|
||||||
|
|
||||||
def test__manage_existing_checking_quota_of_fileset_exception(self):
|
def test__manage_existing_checking_quota_of_fileset_exception(self):
|
||||||
@ -927,15 +920,15 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name']),
|
self.fakeexistingshare, '-j', self.share['name']),
|
||||||
mock.call('mmlinkfileset', self.fakedev, self.share['name'], '-J',
|
mock.call(self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self.fakesharepath),
|
self.share['name'], '-J', self.fakesharepath),
|
||||||
mock.call('chmod', '777', self.fakesharepath),
|
mock.call('chmod', '777', self.fakesharepath),
|
||||||
mock.call('mmlsquota', '-j', self.share['name'], '-Y',
|
mock.call(self.GPFS_PATH + 'mmlsquota', '-j', self.share['name'],
|
||||||
self.fakedev)])
|
'-Y', self.fakedev)])
|
||||||
|
|
||||||
def test__manage_existing_unable_to_get_quota_of_fileset_exception(self):
|
def test__manage_existing_unable_to_get_quota_of_fileset_exception(self):
|
||||||
fakeout = "mmlsquota::blockLimit:"
|
fakeout = "mmlsquota::blockLimit:"
|
||||||
@ -947,23 +940,20 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.share, self.fakeexistingshare)
|
self.share, self.fakeexistingshare)
|
||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_any_call('mmunlinkfileset',
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self.fakedev,
|
self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
self.fakeexistingshare,
|
self.fakeexistingshare, '-f')
|
||||||
'-f')
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self._driver._gpfs_execute.assert_any_call('mmchfileset',
|
self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
self.fakedev,
|
self.fakeexistingshare, '-j', self.share['name'])
|
||||||
self.fakeexistingshare,
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
'-j', self.share['name'])
|
self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self._driver._gpfs_execute.assert_any_call('mmlinkfileset',
|
self.share['name'], '-J', self.fakesharepath)
|
||||||
self.fakedev,
|
self._driver._gpfs_execute.assert_any_call(
|
||||||
self.share['name'],
|
'chmod', '777', self.fakesharepath)
|
||||||
'-J', self.fakesharepath)
|
|
||||||
self._driver._gpfs_execute.assert_any_call('chmod',
|
|
||||||
'777',
|
|
||||||
self.fakesharepath)
|
|
||||||
self._driver._gpfs_execute.assert_called_with(
|
self._driver._gpfs_execute.assert_called_with(
|
||||||
'mmlsquota', '-j', self.share['name'], '-Y', self.fakedev)
|
self.GPFS_PATH + 'mmlsquota', '-j', self.share['name'],
|
||||||
|
'-Y', self.fakedev)
|
||||||
|
|
||||||
def test__manage_existing_set_quota_of_fileset_less_than_1G_exception(
|
def test__manage_existing_set_quota_of_fileset_less_than_1G_exception(
|
||||||
self):
|
self):
|
||||||
@ -980,17 +970,17 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name']),
|
self.fakeexistingshare, '-j', self.share['name']),
|
||||||
mock.call('mmlinkfileset', self.fakedev, self.share['name'], '-J',
|
mock.call(self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self.fakesharepath),
|
self.share['name'], '-J', self.fakesharepath),
|
||||||
mock.call('chmod', '777', self.fakesharepath),
|
mock.call('chmod', '777', self.fakesharepath),
|
||||||
mock.call('mmlsquota', '-j', self.share['name'], '-Y',
|
mock.call(self.GPFS_PATH + 'mmlsquota', '-j', self.share['name'],
|
||||||
self.fakedev),
|
'-Y', self.fakedev),
|
||||||
mock.call('mmsetquota', self.fakedev + ':' + self.share['name'],
|
mock.call(self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
'--block', '0:' + sizestr)])
|
self.share['name'], '--block', '0:' + sizestr)])
|
||||||
|
|
||||||
def test__manage_existing_set_quota_of_fileset_grater_than_1G_exception(
|
def test__manage_existing_set_quota_of_fileset_grater_than_1G_exception(
|
||||||
self):
|
self):
|
||||||
@ -1007,17 +997,17 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
|
|
||||||
self._driver._local_path.assert_any_call(self.share['name'])
|
self._driver._local_path.assert_any_call(self.share['name'])
|
||||||
self._driver._gpfs_execute.assert_has_calls([
|
self._driver._gpfs_execute.assert_has_calls([
|
||||||
mock.call('mmunlinkfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmunlinkfileset', self.fakedev,
|
||||||
'-f'),
|
self.fakeexistingshare, '-f'),
|
||||||
mock.call('mmchfileset', self.fakedev, self.fakeexistingshare,
|
mock.call(self.GPFS_PATH + 'mmchfileset', self.fakedev,
|
||||||
'-j', self.share['name']),
|
self.fakeexistingshare, '-j', self.share['name']),
|
||||||
mock.call('mmlinkfileset', self.fakedev, self.share['name'], '-J',
|
mock.call(self.GPFS_PATH + 'mmlinkfileset', self.fakedev,
|
||||||
self.fakesharepath),
|
self.share['name'], '-J', self.fakesharepath),
|
||||||
mock.call('chmod', '777', self.fakesharepath),
|
mock.call('chmod', '777', self.fakesharepath),
|
||||||
mock.call('mmlsquota', '-j', self.share['name'], '-Y',
|
mock.call(self.GPFS_PATH + 'mmlsquota', '-j', self.share['name'],
|
||||||
self.fakedev),
|
'-Y', self.fakedev),
|
||||||
mock.call('mmsetquota', self.fakedev + ':' + self.share['name'],
|
mock.call(self.GPFS_PATH + 'mmsetquota', self.fakedev + ':' +
|
||||||
'--block', '0:' + sizestr)])
|
self.share['name'], '--block', '0:' + sizestr)])
|
||||||
|
|
||||||
def test_manage_existing(self):
|
def test_manage_existing(self):
|
||||||
self._driver._manage_existing = mock.Mock(return_value=('1',
|
self._driver._manage_existing = mock.Mock(return_value=('1',
|
||||||
@ -1417,7 +1407,7 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
local_path)
|
local_path)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_called_once_with(
|
self._ces_helper._execute.assert_called_once_with(
|
||||||
'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
||||||
|
|
||||||
@ddt.data('44.3.2.11', '1:2:3:4:5:6:7:8')
|
@ddt.data('44.3.2.11', '1:2:3:4:5:6:7:8')
|
||||||
def test__fix_export_data(self, ip):
|
def test__fix_export_data(self, ip):
|
||||||
@ -1456,7 +1446,7 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper._has_client_access(local_path, ip))
|
self._ces_helper._has_client_access(local_path, ip))
|
||||||
|
|
||||||
self._ces_helper._execute.assert_called_once_with(
|
self._ces_helper._execute.assert_called_once_with(
|
||||||
'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
||||||
|
|
||||||
def test_ces_remove_export_no_exports(self):
|
def test_ces_remove_export_no_exports(self):
|
||||||
mock_out = self.fake_ces_exports_not_found
|
mock_out = self.fake_ces_exports_not_found
|
||||||
@ -1467,7 +1457,7 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.remove_export(local_path, self.share)
|
self._ces_helper.remove_export(local_path, self.share)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_called_once_with(
|
self._ces_helper._execute.assert_called_once_with(
|
||||||
'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
||||||
|
|
||||||
def test_ces_remove_export_existing_exports(self):
|
def test_ces_remove_export_existing_exports(self):
|
||||||
mock_out = self.fake_ces_exports
|
mock_out = self.fake_ces_exports
|
||||||
@ -1478,8 +1468,10 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.remove_export(local_path, self.share)
|
self._ces_helper.remove_export(local_path, self.share)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'remove', local_path),
|
local_path, '-Y'),
|
||||||
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'remove',
|
||||||
|
local_path),
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_ces_remove_export_exception(self):
|
def test_ces_remove_export_exception(self):
|
||||||
@ -1505,9 +1497,10 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.allow_access(local_path, self.share, access)
|
self._ces_helper.allow_access(local_path, self.share, access)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'add', local_path, '-c',
|
local_path, '-Y'),
|
||||||
access['access_to'] + '(' + export_opts + ')')])
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'add', local_path,
|
||||||
|
'-c', access['access_to'] + '(' + export_opts + ')')])
|
||||||
|
|
||||||
def test_ces_allow_access_existing_exports(self):
|
def test_ces_allow_access_existing_exports(self):
|
||||||
mock_out = self.fake_ces_exports
|
mock_out = self.fake_ces_exports
|
||||||
@ -1525,9 +1518,11 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self.access)
|
self.access)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'change', local_path, '--nfsadd',
|
local_path, '-Y'),
|
||||||
access['access_to'] + '(' + export_opts + ')')])
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'change', local_path,
|
||||||
|
'--nfsadd', access['access_to'] + '(' +
|
||||||
|
export_opts + ')')])
|
||||||
|
|
||||||
def test_ces_allow_access_invalid_access_type(self):
|
def test_ces_allow_access_invalid_access_type(self):
|
||||||
access = fake_share.fake_access(access_type='test')
|
access = fake_share.fake_access(access_type='test')
|
||||||
@ -1556,9 +1551,10 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.deny_access(local_path, self.share, access)
|
self._ces_helper.deny_access(local_path, self.share, access)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'change', local_path, '--nfsremove',
|
local_path, '-Y'),
|
||||||
access['access_to'])])
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'change', local_path,
|
||||||
|
'--nfsremove', access['access_to'])])
|
||||||
|
|
||||||
def test_ces_deny_access_exception(self):
|
def test_ces_deny_access_exception(self):
|
||||||
access = self.access
|
access = self.access
|
||||||
@ -1580,9 +1576,11 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.resync_access(local_path, self.share, access_rules)
|
self._ces_helper.resync_access(local_path, self.share, access_rules)
|
||||||
|
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'add', local_path, '-c',
|
local_path, '-Y'),
|
||||||
self.access['access_to'] + '(' + "access_type=rw" + ')')
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'add', local_path,
|
||||||
|
'-c', self.access['access_to'] + '(' + "access_type=rw" +
|
||||||
|
')')
|
||||||
])
|
])
|
||||||
share_types.get_extra_specs_from_share.assert_called_once_with(
|
share_types.get_extra_specs_from_share.assert_called_once_with(
|
||||||
self.share)
|
self.share)
|
||||||
@ -1618,8 +1616,9 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
to_add = access_rules[0]['access_to'] + '(' + "access_type=rw" + ')'
|
to_add = access_rules[0]['access_to'] + '(' + "access_type=rw" + ')'
|
||||||
to_change = access_rules[1]['access_to'] + '(' + "access_type=ro" + ')'
|
to_change = access_rules[1]['access_to'] + '(' + "access_type=ro" + ')'
|
||||||
self._ces_helper._execute.assert_has_calls([
|
self._ces_helper._execute.assert_has_calls([
|
||||||
mock.call('mmnfs', 'export', 'list', '-n', local_path, '-Y'),
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n',
|
||||||
mock.call('mmnfs', 'export', 'change', local_path,
|
local_path, '-Y'),
|
||||||
|
mock.call(self.GPFS_PATH + 'mmnfs', 'export', 'change', local_path,
|
||||||
'--nfsremove', SortedMatch(self.assertEqual, to_remove),
|
'--nfsremove', SortedMatch(self.assertEqual, to_remove),
|
||||||
'--nfsadd', to_add,
|
'--nfsadd', to_add,
|
||||||
'--nfschange', to_change)
|
'--nfschange', to_change)
|
||||||
@ -1634,4 +1633,4 @@ mmcesnfslsexport:nfsexports:HEADER:version:reserved:reserved:Path:Delegations:Cl
|
|||||||
self._ces_helper.resync_access(local_path, None, [])
|
self._ces_helper.resync_access(local_path, None, [])
|
||||||
|
|
||||||
self._ces_helper._execute.assert_called_once_with(
|
self._ces_helper._execute.assert_called_once_with(
|
||||||
'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
self.GPFS_PATH + 'mmnfs', 'export', 'list', '-n', local_path, '-Y')
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- Fixed the prerequisite of GPFS path export needed for initializing driver.
|
Loading…
Reference in New Issue
Block a user