diff --git a/cinder/utils.py b/cinder/utils.py index 7c33dd4a708..df41e1e96f0 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -520,6 +520,21 @@ def require_driver_initialized(driver): driver_name = driver.__class__.__name__ LOG.error(_LE("Volume driver %s not initialized"), driver_name) raise exception.DriverNotInitialized() + else: + log_unsupported_driver_warning(driver) + + +def log_unsupported_driver_warning(driver): + """Annoy the log about unsupported drivers.""" + if not driver.supported: + # Check to see if the driver is flagged as supported. + LOG.warning(_LW("Volume driver (%(driver_name)s %(version)s) is " + "currently unsupported and may be removed in the " + "next release of OpenStack. Use at your own risk."), + {'driver_name': driver.__class__.__name__, + 'version': driver.get_version()}, + resource={'type': 'driver', + 'id': driver.__class__.__name__}) def get_file_mode(path): diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index 91886fff93d..100340d4e08 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -265,6 +265,13 @@ volume_opts = [ help='If this is set to True, the backup_use_temp_snapshot ' 'path will be used during the backup. Otherwise, it ' 'will use backup_use_temp_volume path.'), + cfg.BoolOpt('enable_unsupported_driver', + default=False, + help="Set this to True when you want to allow an usupported " + "driver to start. Drivers that haven't maintained a " + "working CI system and testing are marked as unsupported " + "until CI is working again. This also marks a driver as " + "deprecated and may be removed in the next release."), ] # for backward compatibility @@ -356,6 +363,12 @@ class BaseVD(object): # set True by manager after successful check_for_setup self._initialized = False + # If a driver hasn't maintained their CI system, this will get + # set to False, which prevents the driver from starting. + # Add enable_unsupported_driver = True inn cinder.conf to get + # the unsupported driver started. + self._supported = True + def _driver_data_namespace(self): namespace = self.__class__.__name__ if self.configuration: @@ -480,6 +493,10 @@ class BaseVD(object): def initialized(self): return self._initialized + @property + def supported(self): + return self._supported + def set_throttle(self): bps_limit = ((self.configuration and self.configuration.safe_get('volume_copy_bps_limit')) or diff --git a/cinder/volume/drivers/xio.py b/cinder/volume/drivers/xio.py index 407704b9890..be46071f786 100644 --- a/cinder/volume/drivers/xio.py +++ b/cinder/volume/drivers/xio.py @@ -62,7 +62,7 @@ def RaiseXIODriverException(): raise exception.XIODriverException() -class XIOISEDriver(object): +class XIOISEDriver(driver.VolumeDriver): VERSION = '1.1.4' diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index b02c88c48e6..aecdab0207a 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -375,6 +375,17 @@ class VolumeManager(manager.SchedulerDependentManager): def init_host(self, added_to_cluster=None): """Perform any required initialization.""" ctxt = context.get_admin_context() + if not self.driver.supported: + utils.log_unsupported_driver_warning(self.driver) + + if not self.configuration.enable_unsupported_driver: + LOG.error(_LE("Unsupported drivers are disabled." + " You can re-enable by adding " + "enable_unsupported_driver=True to the " + "driver section in cinder.conf"), + resource={'type': 'driver', + 'id': self.__class__.__name__}) + return # If we have just added this host to a cluster we have to include all # our resources in that cluster. @@ -485,6 +496,17 @@ class VolumeManager(manager.SchedulerDependentManager): {'driver_name': self.driver.__class__.__name__, 'version': self.driver.get_version()}) + try: + # Make sure the driver is initialized first + utils.log_unsupported_driver_warning(self.driver) + utils.require_driver_initialized(self.driver) + except exception.DriverNotInitialized: + LOG.error(_LE("Cannot complete RPC initialization because " + "driver isn't initialized properly."), + resource={'type': 'driver', + 'id': self.driver.__class__.__name__}) + return + stats = self.driver.get_volume_stats(refresh=True) svc_host = vol_utils.extract_host(self.host, 'backend') try: @@ -522,6 +544,9 @@ class VolumeManager(manager.SchedulerDependentManager): filter_properties=None, allow_reschedule=True, volume=None): """Creates the volume.""" + # Log about unsupported drivers + utils.log_unsupported_driver_warning(self.driver) + # FIXME(dulek): Remove this in v3.0 of RPC API. if volume is None: # For older clients, mimic the old behavior and look up the volume diff --git a/releasenotes/notes/supported-drivers-9c95dd2378cd308d.yaml b/releasenotes/notes/supported-drivers-9c95dd2378cd308d.yaml new file mode 100644 index 00000000000..b11c2c9de85 --- /dev/null +++ b/releasenotes/notes/supported-drivers-9c95dd2378cd308d.yaml @@ -0,0 +1,3 @@ +--- +features: + - Added supported driver checks on all drivers.