def __init__(self, conf_file=None): self.doc = None if not os.path.exists(conf_file): raise ConfigError("config file not given") with open(conf_file, "r") as f: self.doc = yaml.safe_load(f) log.info("got config: \n%s" % self.doc)
def read(self): """ This function reads all the configurations parameters """ if self.doc is None: raise ConfigError('config file not given') self.shards = self.doc['config'].get('shards') # todo: better suited to be added under ceph_conf self.max_objects_per_shard = self.doc['config'].get('max_objects_per_shard') self.max_objects = None self.user_count = self.doc['config'].get('user_count') self.user_remove = self.doc['config'].get('user_remove', True) self.user_type = self.doc['config'].get('user_type') self.bucket_count = self.doc['config'].get('bucket_count') self.objects_count = self.doc['config'].get('objects_count') self.pseudo_dir_count = self.doc['config'].get('pseudo_dir_count') self.use_aws4 = self.doc['config'].get('use_aws4', None) self.objects_size_range = self.doc['config'].get('objects_size_range') self.sharding_type = self.doc['config'].get('sharding_type') self.split_size = self.doc['config'].get('split_size', 5) self.test_ops = self.doc['config'].get('test_ops') self.lifecycle_conf = self.doc['config'].get('lifecycle_conf') self.delete_marker_ops = self.doc['config'].get('delete_marker_ops') self.mapped_sizes = self.doc['config'].get('mapped_sizes') self.bucket_policy_op = self.doc['config'].get('bucket_policy_op') self.container_count = self.doc['config'].get('container_count') self.version_count = self.doc['config'].get('version_count') self.local_file_delete = self.doc['config'].get('local_file_delete', False) self.ceph_conf = self.doc['config'].get('ceph_conf') self.gc_verification = self.doc['config'].get('gc_verification', False) self.rgw_gc_obj_min_wait = self.doc['config'].get('rgw_gc_obj_min_wait',False) self.ssl = self.doc['config'].get('ssl',) self.frontend = self.doc['config'].get('frontend') self.io_op_config = self.doc.get('config').get('io_op_config') frontend_config = Frontend() # if frontend is set in config yaml if self.frontend: log.info('frontend is set in config.yaml: {}'.format(self.frontend)) if self.ssl is None: # if ssl is not set in config.yaml log.info('ssl is not set in config.yaml') self.ssl = frontend_config.curr_ssl # configuring frontend frontend_config.set_frontend(self.frontend, ssl=self.ssl) # if ssl is True or False in config yaml # and if frontend is not set in config yaml, elif self.ssl is not None and not self.frontend: # get the current frontend and add ssl to it. log.info('ssl is set in config.yaml') log.info('frontend is not set in config.yaml') frontend_config.set_frontend(frontend_config.curr_frontend, ssl=self.ssl) elif self.ssl is None: # if ssl is not set in config yaml, check if ssl_enabled and configured by default, # set sel.ssl = True or False based on ceph conf log.info('ssl is not set in config.yaml') self.ssl = frontend_config.curr_ssl
def read(self): if self.doc is None: raise ConfigError('config file not given') self.shards = None self.max_objects = None self.user_count = self.doc['config'].get('user_count') self.bucket_count = self.doc['config'].get('bucket_count') self.objects_count = self.doc['config'].get('objects_count') self.use_aws4 = self.doc['config'].get('use_aws4', None) self.objects_size_range = self.doc['config'].get('objects_size_range') self.sharding_type = self.doc['config'].get('sharding_type') self.split_size = self.doc['config'].get('split_size', 5) self.test_ops = self.doc['config'].get('test_ops') self.lifecycle_ops = self.doc['config'].get('lifecycle_ops') self.delete_marker_ops = self.doc['config'].get('delete_marker_ops') self.mapped_sizes = self.doc['config'].get('mapped_sizes') self.bucket_policy_op = self.doc['config'].get('bucket_policy_op') self.container_count = self.doc['config'].get('container_count') self.version_count = self.doc['config'].get('version_count') self.local_file_delete = self.doc['config'].get( 'local_file_delete', False) self.ssl = self.doc['config'].get('ssl', ) self.frontend = self.doc['config'].get('frontend') self.io_op_config = self.doc.get('io_op_config') frontend_config = Frontend() # if frontend is set in config yaml if self.frontend: log.info('frontend is set in config.yaml: {}'.format( self.frontend)) if self.ssl is None: # if ssl is not set in config.yaml log.info('ssl is not set in config.yaml') self.ssl = frontend_config.curr_ssl # configuring frontend frontend_config.set_frontend(self.frontend, ssl=self.ssl) # if ssl is True or False in config yaml # and if frontend is not set in config yaml, elif self.ssl is not None and not self.frontend: # get the current frontend and add ssl to it. log.info('ssl is set in config.yaml') log.info('frontend is not set in config.yaml') frontend_config.set_frontend(frontend_config.curr_frontend, ssl=self.ssl) elif self.ssl is None: # if ssl is not set in config yaml, check if ssl_enabled and configured by default, # set sel.ssl = True or False based on ceph conf log.info('ssl is not set in config.yaml') self.ssl = frontend_config.curr_ssl
def read(self): """ This function reads all the configurations parameters """ if self.doc is None: raise ConfigError("config file not given") self.shards = self.doc["config"].get("shards") # todo: better suited to be added under ceph_conf self.max_objects_per_shard = self.doc["config"].get( "max_objects_per_shard") self.max_objects = None self.user_count = self.doc["config"].get("user_count") self.user_remove = self.doc["config"].get("user_remove", True) self.user_type = self.doc["config"].get("user_type") self.bucket_count = self.doc["config"].get("bucket_count") self.objects_count = self.doc["config"].get("objects_count") self.pseudo_dir_count = self.doc["config"].get("pseudo_dir_count") self.use_aws4 = self.doc["config"].get("use_aws4", None) self.objects_size_range = self.doc["config"].get("objects_size_range") self.sharding_type = self.doc["config"].get("sharding_type") self.split_size = self.doc["config"].get("split_size", 5) self.test_ops = self.doc["config"].get("test_ops", {}) self.lifecycle_conf = self.doc["config"].get("lifecycle_conf") self.delete_marker_ops = self.doc["config"].get("delete_marker_ops") self.mapped_sizes = self.doc["config"].get("mapped_sizes") self.bucket_policy_op = self.doc["config"].get("bucket_policy_op") self.container_count = self.doc["config"].get("container_count") self.version_count = self.doc["config"].get("version_count") self.version_enable = self.doc["config"].get("version_enable", False) self.copy_version_object = self.doc["config"].get( "copy_version_object", False) self.object_expire = self.doc["config"].get("object_expire", False) self.dynamic_resharding = self.doc["config"].get( "dynamic_resharding", False) self.manual_resharding = self.doc["config"].get( "manual_resharding", False) self.large_object_upload = self.doc["config"].get( "large_object_upload", False) self.large_object_download = self.doc["config"].get( "large_object_download", False) self.local_file_delete = self.doc["config"].get( "local_file_delete", False) self.sts = self.doc["config"].get("sts") self.ceph_conf = self.doc["config"].get("ceph_conf") self.gc_verification = self.doc["config"].get("gc_verification", False) self.bucket_sync_crash = self.doc["config"].get( "bucket_sync_crash", False) self.bucket_stats = self.doc["config"].get("bucket_stats", False) self.header_size = self.doc["config"].get("header_size", False) self.test_datalog_trim_command = self.doc["config"].get( "test_datalog_trim_command", False) self.rgw_gc_obj_min_wait = self.doc["config"].get( "rgw_gc_obj_min_wait", False) self.ssl = self.doc["config"].get("ssl", ) self.frontend = self.doc["config"].get("frontend") self.io_op_config = self.doc.get("config").get("io_op_config") self.radoslist_all = self.test_ops.get("radoslist_all", False) self.dbr_scenario = self.doc["config"].get("dbr_scenario", None) self.enable_sharding = self.doc["config"].get("enable_sharding", False) self.change_datalog_backing = self.test_ops.get( "change_datalog_backing", False) self.persistent_flag = self.test_ops.get("persistent_flag", False) self.copy_object = self.test_ops.get("copy_object", False) self.get_topic_info = self.test_ops.get("get_topic_info", False) ceph_version_id, ceph_version_name = utils.get_ceph_version() # todo: improve Frontend class if ceph_version_name in ["luminous", "nautilus"]: frontend_config = Frontend() else: frontend_config = Frontend_CephAdm() # if frontend is set in config yaml if self.frontend: log.info("frontend is set in config.yaml: {}".format( self.frontend)) if self.ssl is None: # if ssl is not set in config.yaml log.info("ssl is not set in config.yaml") self.ssl = frontend_config.curr_ssl # configuring frontend frontend_config.set_frontend(self.frontend, ssl=self.ssl) # if ssl is True or False in config yaml # and if frontend is not set in config yaml, elif self.ssl is not None and not self.frontend: # get the current frontend and add ssl to it. log.info("ssl is set in config.yaml") log.info("frontend is not set in config.yaml") frontend_config.set_frontend(frontend_config.curr_frontend, ssl=self.ssl) elif self.ssl is None: # if ssl is not set in config yaml, check if ssl_enabled and configured by default, # set sel.ssl = True or False based on ceph conf log.info("ssl is not set in config.yaml") self.ssl = frontend_config.curr_ssl