From 2a247e89e568945e71893ee5edb237e120fe1533 Mon Sep 17 00:00:00 2001 From: Vipin Balachandran Date: Wed, 16 Nov 2016 17:59:12 +0530 Subject: [PATCH] Add unsupported status to driver listing Appending "unsupported" to the driver name in the driver listing for unsupported drivers. The instance variable "_supported" in BaseVD is changed to class variable "SUPPORTED" so that the supported status of drivers can be read after loading the driver modules. Change-Id: I21ca9137a847873f2ec026520daf8b97603d1888 --- cinder/interface/util.py | 1 + cinder/volume/driver.py | 14 +++++++------- cinder/volume/drivers/scality.py | 8 ++++---- cinder/zonemanager/drivers/fc_zone_driver.py | 14 +++++++------- tools/generate_driver_list.py | 7 +++++-- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/cinder/interface/util.py b/cinder/interface/util.py index 8bab173b867..15226b0853e 100644 --- a/cinder/interface/util.py +++ b/cinder/interface/util.py @@ -68,6 +68,7 @@ class DriverInfo(object): self.class_name) self.version = getattr(cls, 'VERSION', None) self.ci_wiki_name = getattr(cls, 'CI_WIKI_NAME', None) + self.supported = getattr(cls, 'SUPPORTED', True) def __str__(self): return self.class_name diff --git a/cinder/volume/driver.py b/cinder/volume/driver.py index d534e1bc089..abe04b49413 100644 --- a/cinder/volume/driver.py +++ b/cinder/volume/driver.py @@ -329,6 +329,12 @@ class BaseVD(object): # method since the manager will do the check after that. SUPPORTS_ACTIVE_ACTIVE = 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 in cinder.conf to get + # the unsupported driver started. + SUPPORTED = True + def __init__(self, execute=utils.execute, *args, **kwargs): # NOTE(vish): db is set by Manager self.db = kwargs.get('db') @@ -364,12 +370,6 @@ 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: @@ -496,7 +496,7 @@ class BaseVD(object): @property def supported(self): - return self._supported + return self.SUPPORTED def set_throttle(self): bps_limit = ((self.configuration and diff --git a/cinder/volume/drivers/scality.py b/cinder/volume/drivers/scality.py index f3c9fdb5d73..42c8f1ed047 100644 --- a/cinder/volume/drivers/scality.py +++ b/cinder/volume/drivers/scality.py @@ -70,6 +70,10 @@ class ScalityDriver(remotefs_drv.RemoteFSSnapDriver): # ThirdPartySystems wiki page CI_WIKI_NAME = "Scality_CI" + # TODO(smcginnis) Either remove this if CI requirements are met, or + # remove this driver in the Ocata release per normal deprecation + SUPPORTED = False + def __init__(self, *args, **kwargs): super(ScalityDriver, self).__init__(*args, **kwargs) self.configuration.append_config_values(volume_opts) @@ -85,10 +89,6 @@ class ScalityDriver(remotefs_drv.RemoteFSSnapDriver): # as a config switch to customers. self.configuration.scality_sofs_sparsed_volumes = True - # TODO(smcginnis) Either remove this if CI requirements are met, or - # remove this driver in the Ocata release per normal deprecation - self._supported = False - def check_for_setup_error(self): """Sanity checks before attempting to mount SOFS.""" diff --git a/cinder/zonemanager/drivers/fc_zone_driver.py b/cinder/zonemanager/drivers/fc_zone_driver.py index 7704e4409fb..db8a8841d85 100644 --- a/cinder/zonemanager/drivers/fc_zone_driver.py +++ b/cinder/zonemanager/drivers/fc_zone_driver.py @@ -41,16 +41,16 @@ class FCZoneDriver( fc_common.FCCommon, fczm_driver.FibreChannelZoneManagerDriver): """Interface to manage Connection control during attach/detach.""" + # 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 in cinder.conf to get the + # unsupported driver started. + SUPPORTED = True + def __init__(self, **kwargs): super(FCZoneDriver, self).__init__(**kwargs) LOG.debug("Initializing FCZoneDriver") - # 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 in cinder.conf to get the - # unsupported driver started. - self._supported = True - @property def supported(self): - return self._supported + return self.SUPPORTED diff --git a/tools/generate_driver_list.py b/tools/generate_driver_list.py index 7e400772e7f..a09ad909669 100755 --- a/tools/generate_driver_list.py +++ b/tools/generate_driver_list.py @@ -68,8 +68,11 @@ def format_description(desc, output): def print_drivers(drivers, config_name, output): for driver in sorted(drivers, key=lambda x: x.class_fqn): - output.write(driver.class_name) - output.write('-' * len(driver.class_name)) + driver_name = driver.class_name + if not driver.supported: + driver_name += " (unsupported)" + output.write(driver_name) + output.write('-' * len(driver_name)) if driver.version: output.write('* Version: %s' % driver.version) output.write('* %s=%s' % (config_name, driver.class_fqn))