def do_setup(self, context): # If any of the deprecated options are set, we'll warn the operator to # use the new authentication method. DEPRECATED_OPTS = [ self.configuration.driver_client_cert_key, self.configuration.driver_client_cert, self.configuration.datera_api_token ] if any(DEPRECATED_OPTS): msg = _LW("Client cert verification and datera_api_token are " "deprecated in the Datera driver, and will be removed " "in the Liberty release. Please set the san_login and " "san_password in your cinder.conf instead.") versionutils.report_deprecated_feature(LOG, msg) return # If we can't authenticate through the old and new method, just fail # now. if not all([self.username, self.password]): msg = _("san_login and/or san_password is not set for Datera " "driver in the cinder.conf. Set this information and " "start the cinder-volume service again.") LOG.error(msg) raise exception.InvalidInput(msg) self._login()
def get_defaults(self, context, resources): """Given a list of resources, retrieve the default quotas. Use the class quotas named `_DEFAULT_QUOTA_NAME` as default quotas, if it exists. :param context: The request context, for access checks. :param resources: A dictionary of the registered resources. """ quotas = {} default_quotas = {} if CONF.use_default_quota_class: default_quotas = db.quota_class_get_default(context) for resource in resources.values(): if resource.name not in default_quotas: versionutils.report_deprecated_feature(LOG, _( "Default quota for resource: %(res)s is set " "by the default quota flag: quota_%(res)s, " "it is now deprecated. Please use the " "default quota class for default " "quota.") % {'res': resource.name}) quotas[resource.name] = default_quotas.get(resource.name, resource.default) return quotas
def index(self, req): """Return a list of all running services. Filter by host & service name. """ context = req.environ['cinder.context'] authorize(context) detailed = self.ext_mgr.is_loaded('os-extended-services') now = timeutils.utcnow() services = db.service_get_all(context) host = '' if 'host' in req.GET: host = req.GET['host'] service = '' if 'service' in req.GET: service = req.GET['service'] versionutils.report_deprecated_feature( LOG, _("Query by service parameter is deprecated. " "Please use binary parameter instead.")) binary = '' if 'binary' in req.GET: binary = req.GET['binary'] if host: services = [s for s in services if s['host'] == host] # NOTE(uni): deprecating service request key, binary takes precedence binary_key = binary or service if binary_key: services = [s for s in services if s['binary'] == binary_key] svcs = [] for svc in services: updated_at = svc['updated_at'] delta = now - (svc['updated_at'] or svc['created_at']) delta_sec = delta.total_seconds() if svc['modified_at']: delta_mod = now - svc['modified_at'] if abs(delta_sec) >= abs(delta_mod.total_seconds()): updated_at = svc['modified_at'] alive = abs(delta_sec) <= CONF.service_down_time art = (alive and "up") or "down" active = 'enabled' if svc['disabled']: active = 'disabled' ret_fields = { 'binary': svc['binary'], 'host': svc['host'], 'zone': svc['availability_zone'], 'status': active, 'state': art, 'updated_at': updated_at } if detailed: ret_fields['disabled_reason'] = svc['disabled_reason'] svcs.append(ret_fields) return {'services': svcs}
def index(self, req): """Return a list of all running services. Filter by host & service name. """ context = req.environ['cinder.context'] authorize(context) detailed = self.ext_mgr.is_loaded('os-extended-services') now = timeutils.utcnow() services = db.service_get_all(context) host = '' if 'host' in req.GET: host = req.GET['host'] service = '' if 'service' in req.GET: service = req.GET['service'] versionutils.report_deprecated_feature(LOG, _( "Query by service parameter is deprecated. " "Please use binary parameter instead.")) binary = '' if 'binary' in req.GET: binary = req.GET['binary'] if host: services = [s for s in services if s['host'] == host] # NOTE(uni): deprecating service request key, binary takes precedence binary_key = binary or service if binary_key: services = [s for s in services if s['binary'] == binary_key] svcs = [] for svc in services: updated_at = svc['updated_at'] delta = now - (svc['updated_at'] or svc['created_at']) delta_sec = delta.total_seconds() if svc['modified_at']: delta_mod = now - svc['modified_at'] if abs(delta_sec) >= abs(delta_mod.total_seconds()): updated_at = svc['modified_at'] alive = abs(delta_sec) <= CONF.service_down_time art = (alive and "up") or "down" active = 'enabled' if svc['disabled']: active = 'disabled' ret_fields = {'binary': svc['binary'], 'host': svc['host'], 'zone': svc['availability_zone'], 'status': active, 'state': art, 'updated_at': updated_at} if detailed: ret_fields['disabled_reason'] = svc['disabled_reason'] svcs.append(ret_fields) return {'services': svcs}
def __init__(self, *args, **kwargs): super(ISCSITarget, self).__init__(*args, **kwargs) self.iscsi_target_prefix = \ self.configuration.safe_get('iscsi_target_prefix') self.iscsi_protocol = \ self.configuration.safe_get('iscsi_protocol') self.protocol = 'iSCSI' self.volumes_dir = self.configuration.safe_get('volumes_dir') # If any of the deprecated options are set, we'll warn the operator. msg = _LW("The option %s has been deprecated and no longer has " "any effect. It will be removed in the Liberty release.") for opt in ('iscsi_num_targets', 'iser_num_targets'): if self.configuration.safe_get(opt) is not None: versionutils.report_deprecated_feature(LOG, msg, opt)
def __init__(self, scheduler_driver=None, service_name=None, *args, **kwargs): if not scheduler_driver: scheduler_driver = CONF.scheduler_driver if scheduler_driver in ['cinder.scheduler.chance.ChanceScheduler', 'cinder.scheduler.simple.SimpleScheduler']: scheduler_driver = ('cinder.scheduler.filter_scheduler.' 'FilterScheduler') versionutils.report_deprecated_feature(LOG, _( 'ChanceScheduler and SimpleScheduler have been ' 'deprecated due to lack of support for advanced ' 'features like: volume types, volume encryption,' ' QoS etc. These two schedulers can be fully ' 'replaced by FilterScheduler with certain ' 'combination of filters and weighers.')) self.driver = importutils.import_object(scheduler_driver) super(SchedulerManager, self).__init__(*args, **kwargs) self._startup_delay = True
def __init__(self, scheduler_driver=None, service_name=None, *args, **kwargs): if not scheduler_driver: scheduler_driver = CONF.scheduler_driver if scheduler_driver in [ 'cinder.scheduler.chance.ChanceScheduler', 'cinder.scheduler.simple.SimpleScheduler' ]: scheduler_driver = ('cinder.scheduler.filter_scheduler.' 'FilterScheduler') versionutils.report_deprecated_feature( LOG, _('ChanceScheduler and SimpleScheduler have been ' 'deprecated due to lack of support for advanced ' 'features like: volume types, volume encryption,' ' QoS etc. These two schedulers can be fully ' 'replaced by FilterScheduler with certain ' 'combination of filters and weighers.')) self.driver = importutils.import_object(scheduler_driver) super(SchedulerManager, self).__init__(*args, **kwargs) self._startup_delay = True