From: Navneet Singh Date: Wed, 24 Jul 2013 09:52:28 +0000 (+0530) Subject: Fix cinder error for deprecated Netapp drivers X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f58bd6c6330ae8c828cc178130bcee5c1b3d17cd;p=openstack-build%2Fcinder-build.git Fix cinder error for deprecated Netapp drivers We deprecated some NetApp drivers in this release. This change fixes c-vol breakdown in case of cinder configured for deprecated drivers and helps in upgrade scenarios between releases by printing appropriate warning and suggestion message for deprecated drivers. bug 1217220 Change-Id: I533d42257d93f706303b475fb4f222adcc0df3ed --- diff --git a/cinder/tests/test_drivers_compatibility.py b/cinder/tests/test_drivers_compatibility.py index 8796b79e2..d9c6cd9dd 100644 --- a/cinder/tests/test_drivers_compatibility.py +++ b/cinder/tests/test_drivers_compatibility.py @@ -35,6 +35,7 @@ STORWIZE_SVC_MODULE = "cinder.volume.drivers.storwize_svc.StorwizeSVCDriver" WINDOWS_MODULE = "cinder.volume.drivers.windows.WindowsDriver" XIV_DS8K_MODULE = "cinder.volume.drivers.xiv_ds8k.XIVDS8KDriver" ZADARA_MODULE = "cinder.volume.drivers.zadara.ZadaraVPSAISCSIDriver" +NETAPP_MODULE = "cinder.volume.drivers.netapp.common.Deprecated" class VolumeDriverCompatibility(test.TestCase): @@ -161,3 +162,34 @@ class VolumeDriverCompatibility(test.TestCase): def test_zadara_new(self): self._load_driver(ZADARA_MODULE) self.assertEquals(self._driver_module_name(), ZADARA_MODULE) + + def test_netapp_7m_iscsi_old(self): + self._load_driver( + 'cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_7m_iscsi_old_old(self): + self._load_driver('cinder.volume.netapp.NetAppISCSIDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_cm_iscsi_old_old(self): + self._load_driver('cinder.volume.netapp.NetAppCmodeISCSIDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_cm_iscsi_old(self): + self._load_driver( + 'cinder.volume.drivers.netapp.iscsi.NetAppCmodeISCSIDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_7m_nfs_old_old(self): + self._load_driver('cinder.volume.netapp_nfs.NetAppNFSDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_7m_nfs_old(self): + self._load_driver('cinder.volume.drivers.netapp.nfs.NetAppNFSDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) + + def test_netapp_cm_nfs_old(self): + self._load_driver( + 'cinder.volume.drivers.netapp.nfs.NetAppCmodeNfsDriver') + self.assertEquals(self._driver_module_name(), NETAPP_MODULE) diff --git a/cinder/volume/drivers/netapp/common.py b/cinder/volume/drivers/netapp/common.py index 219cb26c9..eaab29c9a 100644 --- a/cinder/volume/drivers/netapp/common.py +++ b/cinder/volume/drivers/netapp/common.py @@ -21,11 +21,13 @@ Unified driver for NetApp storage systems. Supports call to multiple storage systems of different families and protocols. """ +from oslo.config import cfg + from cinder import exception from cinder.openstack.common import importutils from cinder.openstack.common import log as logging +from cinder.volume import driver from cinder.volume.drivers.netapp.options import netapp_proxy_opts -from oslo.config import cfg LOG = logging.getLogger(__name__) @@ -40,18 +42,18 @@ CONF.register_opts(netapp_proxy_opts) #No other code modification required. netapp_unified_plugin_registry =\ {'ontap_cluster': - { - 'iscsi': - 'cinder.volume.drivers.netapp.iscsi.NetAppDirectCmodeISCSIDriver', - 'nfs': 'cinder.volume.drivers.netapp.nfs.NetAppDirectCmodeNfsDriver' - }, 'ontap_7mode': + { + 'iscsi': + 'cinder.volume.drivers.netapp.iscsi.NetAppDirectCmodeISCSIDriver', + 'nfs': 'cinder.volume.drivers.netapp.nfs.NetAppDirectCmodeNfsDriver' + }, 'ontap_7mode': { 'iscsi': 'cinder.volume.drivers.netapp.iscsi.NetAppDirect7modeISCSIDriver', 'nfs': 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver' }, - } + } #NOTE(singn): Holds family:protocol information. #Protocol represents the default protocol driver option @@ -145,3 +147,37 @@ class NetAppDriverFactory(object): if location.find(".netapp.") == -1: raise exception.InvalidInput( reason=_("Only loading netapp drivers supported.")) + + +class Deprecated(driver.VolumeDriver): + """Deprecated driver for NetApp. + + This driver is used for mapping deprecated + drivers to itself in manager. It prevents cinder + from getting errored out in case of upgrade scenarios + and also suggests further steps. + """ + + def __init__(self, *args, **kwargs): + self._log_deprecated_warn() + + def _log_deprecated_warn(self): + """Logs appropriate warning and suggestion.""" + + link = "https://communities.netapp.com/groups/openstack" + msg = _("The configured NetApp driver is deprecated." + " Please refer the link to resolve the issue '%s'.") + LOG.warn(msg % link) + + def check_for_setup_error(self): + pass + + def ensure_export(self, context, volume): + pass + + def get_volume_stats(self, refresh=False): + """Return the current state of the volume service. If 'refresh' is + True, run the update first. + """ + self._log_deprecated_warn() + return None diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 7e2cf43be..0d4262e7f 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -108,7 +108,21 @@ MAPPING = { 'cinder.volume.zadara.ZadaraVPSAISCSIDriver': 'cinder.volume.drivers.zadara.ZadaraVPSAISCSIDriver', 'cinder.volume.driver.ISCSIDriver': - 'cinder.volume.drivers.lvm.LVMISCSIDriver'} + 'cinder.volume.drivers.lvm.LVMISCSIDriver', + 'cinder.volume.netapp.NetAppISCSIDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.netapp.NetAppCmodeISCSIDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.drivers.netapp.iscsi.NetAppCmodeISCSIDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.netapp_nfs.NetAppNFSDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.drivers.netapp.nfs.NetAppNFSDriver': + 'cinder.volume.drivers.netapp.common.Deprecated', + 'cinder.volume.drivers.netapp.nfs.NetAppCmodeNfsDriver': + 'cinder.volume.drivers.netapp.common.Deprecated'} class VolumeManager(manager.SchedulerDependentManager):