Add connector object to create_export

This patch adds the connector object as a parameter
to all driver create_export calls.  This will enable
drivers to actually use create_export method for doing
what they are now doing inside of initialize_connection.

Change-Id: Ia13897a3704080fc5da71e6c8445f308d474f64a
Implements: blueprint add-create-export-connector
This commit is contained in:
Walter A. Boring IV 2015-07-16 14:48:37 -07:00
parent 3a8b27c752
commit ecab4005f0
66 changed files with 76 additions and 75 deletions

View File

@ -1299,7 +1299,7 @@ class CloudByteISCSIDriverTestCase(testtools.TestCase):
mock_api_req.side_effect = self._side_effect_api_req
# now run the test
model_update = self.driver.create_export({}, {})
model_update = self.driver.create_export({}, {}, {})
# assert the result
self.assertEqual('CHAP fakeauthgroupchapuser fakeauthgroupchapsecret',
@ -1317,7 +1317,7 @@ class CloudByteISCSIDriverTestCase(testtools.TestCase):
mock_api_req.side_effect = self._side_effect_api_req
# now run the test
model_update = self.driver.create_export({}, {})
model_update = self.driver.create_export({}, {}, {})
# assert the result
self.assertEqual(None,
@ -1354,7 +1354,7 @@ class CloudByteISCSIDriverTestCase(testtools.TestCase):
mock_api_req.side_effect = self._side_effect_api_req
# now run the test
model_update = self.driver.create_export({}, {})
model_update = self.driver.create_export({}, {}, {})
# assert the result
self.assertEqual(None,

View File

@ -1084,7 +1084,7 @@ class GPFSDriverTestCase(test.TestCase):
self.assertEqual(None, self.driver.ensure_export('', ''))
def test_create_export(self):
self.assertEqual(None, self.driver.create_export('', ''))
self.assertEqual(None, self.driver.create_export('', '', {}))
def test_remove_export(self):
self.assertEqual(None, self.driver.remove_export('', ''))

View File

@ -643,7 +643,7 @@ class NetAppDirectCmodeISCSIDriverTestCase(test.TestCase):
'get_operational_network_interface_addresses',
mock.Mock(return_value=[]))
self.driver.create_volume(self.volume)
updates = self.driver.create_export(None, self.volume)
updates = self.driver.create_export(None, self.volume, {})
self.assertTrue(updates['provider_location'])
self.volume['provider_location'] = updates['provider_location']
@ -667,7 +667,7 @@ class NetAppDirectCmodeISCSIDriverTestCase(test.TestCase):
'get_operational_network_interface_addresses',
mock.Mock(return_value=[]))
self.driver.create_volume(self.volume)
updates = self.driver.create_export(None, self.volume)
updates = self.driver.create_export(None, self.volume, {})
self.assertTrue(updates['provider_location'])
self.volume['provider_location'] = updates['provider_location']
connector_new = {'initiator': 'iqn.1993-08.org.debian:01:1001'}

View File

@ -222,7 +222,7 @@ class StorPoolTestCase(test.TestCase):
self.assertDictEqual({'client_id': 2, 'volume': '616'}, c['data'])
self.driver.terminate_connection(None, None)
self.driver.create_export(None, None)
self.driver.create_export(None, None, {})
self.driver.remove_export(None, None)
def test_stats(self):

View File

@ -2117,7 +2117,7 @@ class StorwizeSVCDriverTestCase(test.TestCase):
self.driver.ensure_export(None, volume)
# Do nothing
self.driver.create_export(None, volume)
self.driver.create_export(None, volume, {})
self.driver.remove_export(None, volume)
# Make sure volume attributes are as they should be

View File

@ -267,7 +267,7 @@ class VMwareEsxVmdkDriverTestCase(test.TestCase):
def test_create_export(self):
"""Test create_export."""
self._driver.create_export(mox.IgnoreArg(), mox.IgnoreArg())
self._driver.create_export(mox.IgnoreArg(), mox.IgnoreArg(), {})
def test_ensure_export(self):
"""Test ensure_export."""

View File

@ -179,13 +179,14 @@ class DateraVolumeTestCase(test.TestCase):
}
self.assertEqual(expected, self.driver.create_export(ctxt,
self.volume))
self.volume,
{}))
def test_create_export_fails(self):
self.mock_api.side_effect = exception.DateraAPIException
ctxt = context.get_admin_context()
self.assertRaises(exception.DateraAPIException,
self.driver.create_export, ctxt, self.volume)
self.driver.create_export, ctxt, self.volume, {})
def test_detach_volume_success(self):
self.mock_api.return_value = {}

View File

@ -189,7 +189,7 @@ class TestWindowsDriver(test.TestCase):
self.mox.ReplayAll()
export_info = drv.create_export(None, volume)
export_info = drv.create_export(None, volume, {})
self.assertEqual(initiator_name, export_info['provider_location'])
if chap_enabled:

View File

@ -682,7 +682,7 @@ class BaseVD(object):
model_update = None
try:
LOG.debug("Volume %s: creating export", volume['id'])
model_update = self.create_export(context, volume)
model_update = self.create_export(context, volume, properties)
if model_update:
volume = self.db.volume_update(context, volume['id'],
model_update)
@ -929,7 +929,7 @@ class BaseVD(object):
return
@abc.abstractmethod
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume.
Can optionally return a Dictionary of changes
@ -1363,7 +1363,7 @@ class VolumeDriver(ConsistencyGroupVD, TransferVD, ManageableVD, ExtendVD,
def ensure_export(self, context, volume):
raise NotImplementedError()
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
raise NotImplementedError()
def remove_export(self, context, volume):
@ -1811,7 +1811,7 @@ class FakeISCSIDriver(ISCSIDriver):
"""Synchronously recreates an export for a volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume.
Can optionally return a Dictionary of changes to the volume object to

View File

@ -199,7 +199,7 @@ class BlockDeviceDriver(driver.BaseVD, driver.LocalVD, driver.CloneableVD,
volume_path)
return model_update
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
volume_path = self.local_path(volume)
export_info = self.target_driver.create_export(context,
volume,

View File

@ -435,7 +435,7 @@ class BlockbridgeISCSIDriver(driver.ISCSIDriver):
user_id=snapshot['user_id'],
project_id=snapshot['project_id'])
def create_export(self, _ctx, volume):
def create_export(self, _ctx, volume, connector):
"""Do nothing: target created during instance attachment."""
pass

View File

@ -1012,7 +1012,7 @@ class CloudByteISCSIDriver(san.SanISCSIDriver):
# Request the CloudByte api to update the volume
self._api_request_for_cloudbyte('updateFileSystem', params)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Setup the iscsi export info."""
return self._export()

View File

@ -194,7 +194,7 @@ class DateraDriver(san.SanISCSIDriver):
def ensure_export(self, context, volume):
return self._do_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self._do_export(context, volume)
def detach_volume(self, context, volume, attachment=None):

View File

@ -289,7 +289,7 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
raise exception.VolumeBackendAPIException(
_('Failed to delete snapshot %s') % snapshot_id)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Create an export of a volume.
The volume exists on creation and will be visible on

View File

@ -141,7 +141,7 @@ class DotHillFCDriver(cinder.volume.driver.FibreChannelDriver):
self.__class__.__name__)
return stats
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -153,7 +153,7 @@ class DotHillISCSIDriver(cinder.volume.driver.ISCSIDriver):
self.__class__.__name__)
return stats
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -507,7 +507,7 @@ class DrbdManageDriver(driver.VolumeDriver):
volume,
volume_path)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
volume_path = self.local_path(volume)
export_info = self.target_driver.create_export(
context,

View File

@ -109,7 +109,7 @@ class EMCCLIFCDriver(driver.FibreChannelDriver):
"""Driver entry point to get the export info for an existing volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
pass

View File

@ -106,7 +106,7 @@ class EMCCLIISCSIDriver(driver.ISCSIDriver):
"""Driver entry point to get the export info for an existing volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
pass

View File

@ -117,7 +117,7 @@ class EMCVMAXFCDriver(driver.FibreChannelDriver):
"""Driver entry point to get the export info for an existing volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
pass

View File

@ -124,7 +124,7 @@ class EMCVMAXISCSIDriver(driver.ISCSIDriver):
"""Driver entry point to get the export info for an existing volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
pass

View File

@ -1141,7 +1141,7 @@ class ScaleIODriver(driver.VolumeDriver):
"""Driver entry point to get the export info for an existing volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
pass

View File

@ -510,7 +510,7 @@ class DellEQLSanISCSIDriver(san.SanISCSIDriver):
'to volume "%s".'),
volume['name'])
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Create an export of a volume.
Driver has nothing to do here for the volume has been exported

View File

@ -275,7 +275,7 @@ class GlusterfsDriver(remotefs_drv.RemoteFSSnapDriver, driver.CloneableVD,
self._ensure_share_mounted(volume['provider_location'])
def create_export(self, ctx, volume):
def create_export(self, ctx, volume, connector):
"""Exports the volume."""
pass

View File

@ -585,7 +585,7 @@ class HGSTDriver(driver.VolumeDriver):
"""Query the provider_id to figure out the proper devnode."""
return "/dev/" + self._get_space_name(volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
# Not needed for spaces
pass

View File

@ -473,7 +473,7 @@ class HBSDFCDriver(cinder.volume.driver.FibreChannelDriver):
def discard_zero_page(self, volume):
self.common.command.discard_zero_page(self.common.get_ldev(volume))
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -384,7 +384,7 @@ class HBSDISCSIDriver(cinder.volume.driver.ISCSIDriver):
self.common.volume_info[ldev]['in_use']:
self._terminate_connection(ldev, connector, hostgroups)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -424,7 +424,7 @@ class HDSISCSIDriver(driver.ISCSIDriver):
def ensure_export(self, context, volume):
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Create an export. Moved to initialize_connection.
:param context:

View File

@ -566,7 +566,7 @@ class HuaweiBaseDriver(driver.VolumeDriver):
def migrate_volume(self, context, volume, host):
return (False, None)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Export a volume."""
pass

View File

@ -742,7 +742,7 @@ class GPFSDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
"""Synchronously recreates an export for a logical volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -315,7 +315,7 @@ class StorwizeSVCDriver(san.SanDriver,
LOG.error(_LE('ensure_export: Volume %s not found on storage.'),
volume['name'])
def create_export(self, ctxt, volume):
def create_export(self, ctxt, volume, connector):
model_update = None
return model_update

View File

@ -110,7 +110,7 @@ class XIVDS8KDriver(san.SanDriver,
return self.xiv_ds8k_proxy.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Create an export."""
return self.xiv_ds8k_proxy.create_export(context, volume)

View File

@ -123,7 +123,7 @@ class InfortrendCLIFCDriver(driver.FibreChannelDriver):
"""Synchronously recreates an export for a volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume.
Can optionally return a Dictionary of changes

View File

@ -121,7 +121,7 @@ class InfortrendCLIISCSIDriver(driver.ISCSIDriver):
"""Synchronously recreates an export for a volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume.
Can optionally return a Dictionary of changes

View File

@ -651,7 +651,7 @@ class LVMVolumeDriver(driver.VolumeDriver):
self.target_driver.ensure_export(context, volume, volume_path)
return model_update
def create_export(self, context, volume, vg=None):
def create_export(self, context, volume, connector, vg=None):
if vg is None:
vg = self.configuration.volume_group

View File

@ -68,7 +68,7 @@ class NetApp7modeFibreChannelDriver(driver.FibreChannelDriver):
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -68,7 +68,7 @@ class NetAppCmodeFibreChannelDriver(driver.FibreChannelDriver):
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -67,7 +67,7 @@ class NetApp7modeISCSIDriver(driver.ISCSIDriver):
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -67,7 +67,7 @@ class NetAppCmodeISCSIDriver(driver.ISCSIDriver):
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -75,7 +75,7 @@ class NetAppEseriesFibreChannelDriver(driver.BaseVD,
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -77,7 +77,7 @@ class NetAppEseriesISCSIDriver(driver.BaseVD,
def ensure_export(self, context, volume):
return self.library.ensure_export(context, volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.library.create_export(context, volume)
def remove_export(self, context, volume):

View File

@ -227,7 +227,7 @@ class NimbleISCSIDriver(san.SanISCSIDriver):
self._clone_volume_from_snapshot(volume, snapshot)
return self._get_model_info(volume['name'])
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
return self._get_model_info(volume['name'])

View File

@ -857,7 +857,7 @@ class DPLCOMMONDriver(driver.ConsistencyGroupVD, driver.ExtendVD,
raise exception.VolumeBackendAPIException(data=msg)
return snapshotID
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -205,7 +205,7 @@ class PureBaseVolumeDriver(san.SanDriver):
def ensure_export(self, context, volume):
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def _get_host(self, connector):

View File

@ -790,7 +790,7 @@ class RBDDriver(driver.RetypeVD, driver.TransferVD, driver.ExtendVD,
"""Synchronously recreates an export for a logical volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -281,7 +281,7 @@ class RemoteFSDriver(driver.LocalVD, driver.TransferVD, driver.BaseVD):
"""Synchronously recreates an export for a logical volume."""
self._ensure_share_mounted(volume['provider_location'])
def create_export(self, ctx, volume):
def create_export(self, ctx, volume, connector):
"""Exports the volume.
Can optionally return a dictionary of changes

View File

@ -411,7 +411,7 @@ class HP3PARFCDriver(cinder.volume.driver.FibreChannelDriver):
host = common._get_3par_host(host['name'])
return host
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -554,7 +554,7 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
return model_update
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
common = self._login()
try:
return self._do_export(common, volume)

View File

@ -450,7 +450,7 @@ class HPLeftHandCLIQProxy(san.SanISCSIDriver):
def create_cloned_volume(self, volume, src_vref):
raise NotImplementedError()
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -148,8 +148,8 @@ class HPLeftHandISCSIDriver(driver.TransferVD,
def create_cloned_volume(self, volume, src_vref):
return self.proxy.create_cloned_volume(volume, src_vref)
def create_export(self, context, volume):
return self.proxy.create_export(context, volume)
def create_export(self, context, volume, connector):
return self.proxy.create_export(context, volume, connector)
def ensure_export(self, context, volume):
return self.proxy.ensure_export(context, volume)

View File

@ -508,7 +508,7 @@ class HPLeftHandRESTProxy(driver.ISCSIDriver):
optional)
return server_info
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -134,7 +134,7 @@ class HPXPFCDriver(driver.FibreChannelDriver):
def ensure_export(self, context, volume):
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def remove_export(self, context, volume):

View File

@ -153,7 +153,7 @@ class SanDriver(driver.BaseVD):
"""Synchronously recreates an export for a logical volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -194,7 +194,7 @@ class ScalityDriver(driver.VolumeDriver):
"""Synchronously recreates an export for a logical volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume.
Can optionally return a Dictionary of changes to the volume

View File

@ -218,7 +218,7 @@ class SheepdogDriver(driver.VolumeDriver):
"""Safely and synchronously recreate an export for a logical volume."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Export a volume."""
pass

View File

@ -1229,7 +1229,7 @@ class SolidFireDriver(san.SanISCSIDriver):
def ensure_export(self, context, volume):
return self.target_driver.ensure_export(context, volume, None)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.target_driver.create_export(
context,
volume,

View File

@ -850,7 +850,7 @@ class SRBISCSIDriver(SRBDriver, driver.ISCSIDriver):
if model_update:
self.db.volume_update(context, volume['id'], model_update)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Creates an export for a logical volume."""
self._attach_file(volume)
vg = self._get_lvm_vg(volume)

View File

@ -183,7 +183,7 @@ class StorPoolDriver(driver.TransferVD, driver.ExtendVD, driver.CloneableVD,
"%(msg)s"),
{'name': snapname, 'msg': e})
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def remove_export(self, context, volume):

View File

@ -125,7 +125,7 @@ class V6000FCDriver(driver.FibreChannelDriver):
"""Synchronously checks and re-exports volumes at cinder start time."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -150,7 +150,7 @@ class V6000ISCSIDriver(driver.ISCSIDriver):
"""Synchronously checks and re-exports volumes at cinder start time."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -122,7 +122,7 @@ class V7000FCPDriver(driver.FibreChannelDriver):
"""Synchronously checks and re-exports volumes at cinder start time."""
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Exports the volume."""
pass

View File

@ -587,7 +587,7 @@ class VMwareEsxVmdkDriver(driver.VolumeDriver):
def terminate_connection(self, volume, connector, force=False, **kwargs):
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def ensure_export(self, context, volume):

View File

@ -133,7 +133,7 @@ class WindowsDriver(driver.ISCSIDriver):
# iSCSI targets exported by WinTarget persist after host reboot.
pass
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
"""Driver entry point to get the export info for a new volume."""
# Since the iSCSI targets are not reused, being deleted when the
# volume is detached, we should clean up existing targets before

View File

@ -1486,7 +1486,7 @@ class XIOISEISCSIDriver(driver.ISCSIDriver):
def delete_snapshot(self, snapshot):
return self.driver.delete_snapshot(snapshot)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.driver.create_export(context, volume)
def ensure_export(self, context, volume):
@ -1595,7 +1595,7 @@ class XIOISEFCDriver(driver.FibreChannelDriver):
def delete_snapshot(self, snapshot):
return self.driver.delete_snapshot(snapshot)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
return self.driver.create_export(context, volume)
def ensure_export(self, context, volume):

View File

@ -366,7 +366,7 @@ class ZFSSAISCSIDriver(driver.ISCSIDriver):
self._update_volume_status()
return self._stats
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
pass
def remove_export(self, context, volume):

View File

@ -1085,7 +1085,7 @@ class VolumeManager(manager.SchedulerDependentManager):
try:
model_update = self.driver.create_export(context.elevated(),
volume)
volume, connector)
except exception.CinderException:
err_msg = (_("Create export for volume failed."))
LOG.exception(err_msg, resource=volume)