commit
c9d0b4385a
@ -2775,8 +2775,12 @@ int list_caches(unsigned int list_format, bool by_id_path)
|
||||
|
||||
if (curr_cache->state & (1 << ocf_cache_state_standby)) {
|
||||
strncpy(mode_string, "-", sizeof(mode_string));
|
||||
snprintf(cache_ctrl_dev, sizeof(cache_ctrl_dev),
|
||||
"/dev/cas-cache-%d", curr_cache->id);
|
||||
if (!curr_cache->standby_detached) {
|
||||
snprintf(cache_ctrl_dev, sizeof(cache_ctrl_dev),
|
||||
"/dev/cas-cache-%d", curr_cache->id);
|
||||
} else {
|
||||
strncpy(cache_ctrl_dev, "-", sizeof(cache_ctrl_dev));
|
||||
}
|
||||
} else {
|
||||
snprintf(mode_string, sizeof(mode_string), "%s",
|
||||
cache_mode_to_name(curr_cache->mode));
|
||||
|
@ -537,6 +537,9 @@ int cache_stats_conf(int ctrl_fd, const struct kcas_cache_info *cache_info,
|
||||
const char *cache_path;
|
||||
char dev_path[MAX_STR_LEN];
|
||||
int inactive_cores;
|
||||
bool standby = (cache_info->info.state & (1 << ocf_cache_state_standby));
|
||||
bool standby_detached = cache_info->info.standby_detached;
|
||||
bool cache_exported_obj_exists = (standby && !standby_detached);
|
||||
|
||||
if (strnlen(cache_info->cache_path_name, sizeof(cache_info->cache_path_name)) == 0) {
|
||||
cache_path = "-";
|
||||
@ -561,6 +564,12 @@ int cache_stats_conf(int ctrl_fd, const struct kcas_cache_info *cache_info,
|
||||
|
||||
print_kv_pair(outfile, "Cache Device", "%s",
|
||||
cache_path);
|
||||
if (cache_exported_obj_exists) {
|
||||
print_kv_pair(outfile, "Exported Object", "/dev/cas-cache-%d",
|
||||
cache_info->cache_id);
|
||||
} else {
|
||||
print_kv_pair(outfile, "Exported Object", "-");
|
||||
}
|
||||
print_kv_pair(outfile, "Core Devices", "%d",
|
||||
cache_info->info.core_count);
|
||||
inactive_cores = get_inactive_core_count(cache_info);
|
||||
@ -568,11 +577,11 @@ int cache_stats_conf(int ctrl_fd, const struct kcas_cache_info *cache_info,
|
||||
return FAILURE;
|
||||
print_kv_pair(outfile, "Inactive Core Devices", "%d", inactive_cores);
|
||||
|
||||
print_kv_pair(outfile, "Write Policy", "%s",
|
||||
print_kv_pair(outfile, "Write Policy", "%s", standby ? "-" :
|
||||
cache_mode_to_name(cache_info->info.cache_mode));
|
||||
print_kv_pair(outfile, "Cleaning Policy", "%s",
|
||||
print_kv_pair(outfile, "Cleaning Policy", "%s", standby ? "-" :
|
||||
cleaning_policy_to_name(cache_info->info.cleaning_policy));
|
||||
print_kv_pair(outfile, "Promotion Policy", "%s",
|
||||
print_kv_pair(outfile, "Promotion Policy", "%s", standby ? "-" :
|
||||
promotion_policy_to_name(cache_info->info.promotion_policy));
|
||||
print_kv_pair(outfile, "Cache line size", "%llu, [KiB]",
|
||||
cache_info->info.cache_line_size / KiB);
|
||||
|
@ -5,9 +5,9 @@
|
||||
|
||||
# Order in arrays is important!
|
||||
config_stats_cache = [
|
||||
"cache id", "cache size", "cache device", "core devices", "inactive core devices",
|
||||
"write policy", "cleaning policy", "promotion policy", "cache line size",
|
||||
"metadata memory footprint", "dirty for", "status"
|
||||
"cache id", "cache size", "cache device", "exported object", "core devices",
|
||||
"inactive core devices", "write policy", "cleaning policy", "promotion policy",
|
||||
"cache line size", "metadata memory footprint", "dirty for", "status"
|
||||
]
|
||||
config_stats_core = [
|
||||
"core id", "core device", "exported object", "core size", "dirty for", "status",
|
||||
@ -227,6 +227,7 @@ class CacheConfigStats:
|
||||
cache_id,
|
||||
cache_size,
|
||||
cache_dev,
|
||||
exp_obj,
|
||||
core_dev,
|
||||
inactive_core_dev,
|
||||
write_policy,
|
||||
@ -240,6 +241,7 @@ class CacheConfigStats:
|
||||
self.cache_id = cache_id
|
||||
self.cache_size = cache_size
|
||||
self.cache_dev = cache_dev
|
||||
self.exp_obj = exp_obj
|
||||
self.core_dev = core_dev
|
||||
self.inactive_core_dev = inactive_core_dev
|
||||
self.write_policy = write_policy
|
||||
@ -256,6 +258,7 @@ class CacheConfigStats:
|
||||
f"Cache ID: {self.cache_id}\n"
|
||||
f"Cache size: {self.cache_size}\n"
|
||||
f"Cache device: {self.cache_dev}\n"
|
||||
f"Exported object: {self.exp_obj}\n"
|
||||
f"Core devices: {self.core_dev}\n"
|
||||
f"Inactive core devices: {self.inactive_core_dev}\n"
|
||||
f"Write policy: {self.write_policy}\n"
|
||||
@ -274,6 +277,7 @@ class CacheConfigStats:
|
||||
self.cache_id == other.cache_id
|
||||
and self.cache_size == other.cache_size
|
||||
and self.cache_dev == other.cache_dev
|
||||
and self.exp_obj == other.exp_obj
|
||||
and self.core_dev == other.core_dev
|
||||
and self.inactive_core_dev == other.inactive_core_dev
|
||||
and self.write_policy == other.write_policy
|
||||
|
Loading…
Reference in New Issue
Block a user