def get_performance_enabled(request): settings = vsmapi.get_settings(request) perf_settings = [setting for setting in settings if setting.name in ('ceph_diamond_collect_interval', 'cpu_diamond_collect_interval')] enabled = any(setting.value != '0' for setting in perf_settings) perf_enabled = { "enabled": enabled } perf_enabled_data = json.dumps(perf_enabled) return perf_enabled_data
def __init__(self, request, *args, **kwargs): super(AddCacheTier, self).__init__(request, *args, **kwargs) cache_tier_pool_list = [('', "Select a Cache Tier Pool")] storage_tier_pool_list = [('', "Select a Storage Tier Pool")] cache_mode_list = [('', "Select Cache Tier Mode"), ('writeback', "Writeback"), ('readonly', "Read-only")] hit_set_type_list = [('bloom', "bloom")] pools = vsm_api.pool_status(request) cache_tier_pool_list += [(pool.pool_id, pool.name) for pool in pools if not pool.cache_tier_status] storage_tier_pool_list += [(pool.pool_id, pool.name) for pool in pools if not pool.cache_tier_status] self.fields['cache_tier_pool'].choices = cache_tier_pool_list self.fields['storage_tier_pool'].choices = storage_tier_pool_list self.fields['cache_mode'].choices = cache_mode_list self.fields['hit_set_type'].choices = hit_set_type_list settings = vsm_api.get_settings(request) setting_dict = dict([(setting.name, setting.value) for setting in settings]) self.fields['hit_set_count'].initial = setting_dict["ct_hit_set_count"] self.fields['hit_set_period_s'].initial = setting_dict[ "ct_hit_set_period_s"] self.fields['target_max_mem_mb'].initial = setting_dict[ "ct_target_max_mem_mb"] self.fields['target_dirty_ratio'].initial = setting_dict[ "ct_target_dirty_ratio"] self.fields['target_full_ratio'].initial = setting_dict[ "ct_target_full_ratio"] self.fields['target_max_objects'].initial = setting_dict[ "ct_target_max_objects"] self.fields['target_min_flush_age_m'].initial = setting_dict[ "ct_target_min_flush_age_m"] self.fields['target_min_evict_age_m'].initial = setting_dict[ "ct_target_min_evict_age_m"]
def get_context_data(self, **kwargs): context = super(AddCacheTierView, self).get_context_data(**kwargs) #get pool list pools = vsmapi.pool_status(None) context["pool_list"] = [(pool.pool_id, pool.name) for pool in pools if not pool.cache_tier_status] context["cache_mode_list"] = [('writeback', "Writeback"), ('readonly', "Read-only")] context["hit_set_type_list"] = [('bloom', "bloom")] #get the settings setting_list = vsmapi.get_settings(None) context["settings"] = dict([(setting.name, setting.value) for setting in setting_list]) return context
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = [{ 'name': "storage_group_near_full_threshold", 'value': 80, }] settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() context['settings'] = [x for x in settings if x.verbose_name in ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD","HOST_NEAR_FULL_THRESHOLD","HOST_FULL_THRESHOLD")] return context
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = [{ 'name': "storage_group_near_full_threshold", 'value': 80, }] settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() context['settings'] = [x for x in settings if x.verbose_name in ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD","DISK_NEAR_FULL_THRESHOLD","DISK_FULL_THRESHOLD",'CPU_DIAMOND_COLLECT_INTERVAL','CEPH_DIAMOND_COLLECT_INTERVAL','KEEP_PERFORMANCE_DATA_DAYS')] return context
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = [{ 'name': "storage_group_near_full_threshold", 'value': 80, }] settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() context['settings'] = [x for x in settings if x.verbose_name in ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD")] return context
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = [{ 'name': "storage_group_near_full_threshold", 'value': 80, }] settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() context['settings'] = [ x for x in settings if x.verbose_name in ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD", "DISK_NEAR_FULL_THRESHOLD", "DISK_FULL_THRESHOLD", 'CPU_DIAMOND_COLLECT_INTERVAL', 'CEPH_DIAMOND_COLLECT_INTERVAL', 'KEEP_PERFORMANCE_DATA_DAYS') ] return context
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() pagination_value = utils.get_page_size(self.request) pagination_setting = {"name": "pagination", "verbose_name": "PAGINATION", "value": pagination_value} setting_name_tuple = ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD", "DISK_NEAR_FULL_THRESHOLD", "DISK_FULL_THRESHOLD", "CPU_DIAMOND_COLLECT_INTERVAL", "CEPH_DIAMOND_COLLECT_INTERVAL", "KEEP_PERFORMANCE_DATA_DAYS") context['settings'] = [x for x in settings if x.verbose_name in setting_name_tuple] context['settings'].append(pagination_setting) return context
def __init__(self, request, *args, **kwargs): super(AddCacheTier, self).__init__(request, *args, **kwargs) cache_tier_pool_list = [('',"Select a Cache Tier Pool")] storage_tier_pool_list = [('',"Select a Storage Tier Pool")] cache_mode_list = [('',"Select Cache Tier Mode"), ('writeback', "Writeback"), ('readonly', "Read-only")] hit_set_type_list = [('bloom', "bloom")] pools = vsm_api.pool_status(request) cache_tier_pool_list += [(pool.pool_id, pool.name) for pool in pools if not pool.cache_tier_status] storage_tier_pool_list += [(pool.pool_id, pool.name) for pool in pools if not pool.cache_tier_status] self.fields['cache_tier_pool'].choices = cache_tier_pool_list self.fields['storage_tier_pool'].choices = storage_tier_pool_list self.fields['cache_mode'].choices = cache_mode_list self.fields['hit_set_type'].choices = hit_set_type_list settings = vsm_api.get_settings(request) setting_dict = dict([(setting.name, setting.value) for setting in settings]) self.fields['hit_set_count'].initial = setting_dict["ct_hit_set_count"] self.fields['hit_set_period_s'].initial = setting_dict["ct_hit_set_period_s"] self.fields['target_max_mem_mb'].initial = setting_dict["ct_target_max_mem_mb"] self.fields['target_dirty_ratio'].initial = setting_dict["ct_target_dirty_ratio"] self.fields['target_full_ratio'].initial = setting_dict["ct_target_full_ratio"] self.fields['target_max_objects'].initial = setting_dict["ct_target_max_objects"] self.fields['target_min_flush_age_m'].initial = setting_dict["ct_target_min_flush_age_m"] self.fields['target_min_evict_age_m'].initial = setting_dict["ct_target_min_evict_age_m"]
def get_context_data(self, **kwargs): context = super(IndexView, self).get_context_data(**kwargs) settings = vsmapi.get_settings(self.request) for setting in settings: setting.verbose_name = setting.name.upper() pagination_value = utils.get_page_size(self.request) pagination_setting = { "name": "pagination", "verbose_name": "PAGINATION", "value": pagination_value } setting_name_tuple = ("STORAGE_GROUP_NEAR_FULL_THRESHOLD", "STORAGE_GROUP_FULL_THRESHOLD", "DISK_NEAR_FULL_THRESHOLD", "DISK_FULL_THRESHOLD", "CPU_DIAMOND_COLLECT_INTERVAL", "CEPH_DIAMOND_COLLECT_INTERVAL", "KEEP_PERFORMANCE_DATA_DAYS") context['settings'] = [ x for x in settings if x.verbose_name in setting_name_tuple ] context['settings'].append(pagination_setting) return context