Alternative way to import emc.plugins.registry

Alternative way to import emc.plugins.registry and fix the related pep8 issues.

Change-Id: Idd0e8cbb7ecdaf2e57017863b57f699710db7082
This commit is contained in:
Jay Xu 2014-12-10 00:31:36 -05:00
parent 85a406aead
commit 5433fdafc7

View File

@ -24,7 +24,7 @@ from manila.i18n import _LE
from manila.i18n import _LW from manila.i18n import _LW
from manila.openstack.common import log from manila.openstack.common import log
from manila.share.drivers.emc.plugins import base as driver from manila.share.drivers.emc.plugins import base as driver
import manila.share.drivers.emc.plugins.registry from manila.share.drivers.emc.plugins import registry
from manila.share.drivers.emc.plugins.vnx import constants from manila.share.drivers.emc.plugins.vnx import constants
from manila.share.drivers.emc.plugins.vnx import helper from manila.share.drivers.emc.plugins.vnx import helper
from manila.share.drivers.emc.plugins.vnx import utils as vnx_utils from manila.share.drivers.emc.plugins.vnx import utils as vnx_utils
@ -64,7 +64,7 @@ class VNXStorageConnection(driver.StorageConnection):
elif share['share_proto'].startswith('CIFS'): elif share['share_proto'].startswith('CIFS'):
location = self._create_cifs_share(share_name, vdm) location = self._create_cifs_share(share_name, vdm)
else: else:
raise manila.exception.InvalidShare( raise exception.InvalidShare(
reason=(_('Invalid NAS protocol supplied: %s.') reason=(_('Invalid NAS protocol supplied: %s.')
% share['share_proto'])) % share['share_proto']))
@ -164,7 +164,7 @@ class VNXStorageConnection(driver.StorageConnection):
elif share['share_proto'].startswith('CIFS'): elif share['share_proto'].startswith('CIFS'):
location = self._create_cifs_share(share_name, vdm_ref) location = self._create_cifs_share(share_name, vdm_ref)
else: else:
raise manila.exception.InvalidShare( raise exception.InvalidShare(
reason=(_('Invalid NAS protocol supplied: %s.') reason=(_('Invalid NAS protocol supplied: %s.')
% share['share_proto'])) % share['share_proto']))
@ -202,7 +202,7 @@ class VNXStorageConnection(driver.StorageConnection):
elif share['share_proto'].startswith('CIFS'): elif share['share_proto'].startswith('CIFS'):
self._delete_cifs_share(share, share_server) self._delete_cifs_share(share, share_server)
else: else:
raise manila.exception.InvalidShare( raise exception.InvalidShare(
reason='Unsupported share type') reason='Unsupported share type')
@vnx_utils.log_enter_exit @vnx_utils.log_enter_exit
@ -350,7 +350,7 @@ class VNXStorageConnection(driver.StorageConnection):
elif share['share_proto'].startswith('CIFS'): elif share['share_proto'].startswith('CIFS'):
self._cifs_allow_access(context, share, access, share_server) self._cifs_allow_access(context, share, access, share_server)
else: else:
raise manila.exception.InvalidShare( raise exception.InvalidShare(
reason=(_('Invalid NAS protocol supplied: %s.') reason=(_('Invalid NAS protocol supplied: %s.')
% share['share_proto'])) % share['share_proto']))
@ -385,7 +385,7 @@ class VNXStorageConnection(driver.StorageConnection):
access_type = access['access_type'] access_type = access['access_type']
if access_type != 'ip': if access_type != 'ip':
reason = _('Only ip access type allowed.') reason = _('Only ip access type allowed.')
raise manila.exception.InvalidShareAccess(reason) raise exception.InvalidShareAccess(reason)
host_ip = access['access_to'] host_ip = access['access_to']
mover_name = self._get_vdm_name(share_server) mover_name = self._get_vdm_name(share_server)
@ -405,7 +405,7 @@ class VNXStorageConnection(driver.StorageConnection):
elif share['share_proto'].startswith('CIFS'): elif share['share_proto'].startswith('CIFS'):
self._cifs_deny_access(context, share, access, share_server) self._cifs_deny_access(context, share, access, share_server)
else: else:
raise manila.exception.InvalidShare( raise exception.InvalidShare(
reason=_('Unsupported share type')) reason=_('Unsupported share type'))
@vnx_utils.log_enter_exit @vnx_utils.log_enter_exit
@ -440,7 +440,7 @@ class VNXStorageConnection(driver.StorageConnection):
access_type = access['access_type'] access_type = access['access_type']
if access_type != 'ip': if access_type != 'ip':
reason = _('Only ip access type allowed.') reason = _('Only ip access type allowed.')
raise manila.exception.InvalidShareAccess(reason) raise exception.InvalidShareAccess(reason)
host_ip = access['access_to'] host_ip = access['access_to']
@ -743,7 +743,7 @@ class VNXStorageConnection(driver.StorageConnection):
message = (_("Could not find the storage pool by name: %s.") message = (_("Could not find the storage pool by name: %s.")
% name) % name)
LOG.error(message) LOG.error(message)
raise manila.exception.InvalidParameterValue(err=message) raise exception.InvalidParameterValue(err=message)
return self._pool return self._pool
@ -752,7 +752,7 @@ class VNXStorageConnection(driver.StorageConnection):
if constants.STATUS_ERROR == status: if constants.STATUS_ERROR == status:
message = _("Could not find Data Mover by name: %s.") % name message = _("Could not find Data Mover by name: %s.") % name
LOG.error(message) LOG.error(message)
raise manila.exception.InvalidParameterValue(err=message) raise exception.InvalidParameterValue(err=message)
return mover return mover
@ -765,7 +765,7 @@ class VNXStorageConnection(driver.StorageConnection):
message = (_("Could not find Virtual Data Mover by name: %s.") message = (_("Could not find Virtual Data Mover by name: %s.")
% name) % name)
LOG.error(message) LOG.error(message)
raise manila.exception.InvalidParameterValue(err=message) raise exception.InvalidParameterValue(err=message)
return vdm return vdm
@ -774,7 +774,7 @@ class VNXStorageConnection(driver.StorageConnection):
if constants.STATUS_OK != status: if constants.STATUS_OK != status:
message = _("Could not find Data Mover by id: %s.") % mover_id message = _("Could not find Data Mover by id: %s.") % mover_id
LOG.error(message) LOG.error(message)
raise manila.exception.InvalidParameterValue(err=message) raise exception.InvalidParameterValue(err=message)
return mover return mover
@ -920,5 +920,4 @@ class VNXStorageConnection(driver.StorageConnection):
raise exception.EMCVnxXMLAPIError(err=msg) raise exception.EMCVnxXMLAPIError(err=msg)
manila.share.drivers.emc.plugins.registry.register_storage_backend( registry.register_storage_backend("vnx", VNXStorageConnection)
"vnx", VNXStorageConnection)