From 02dbc56ebaaed4f606b67b82a3cd0e98a3e1dbb6 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Tue, 29 Mar 2022 22:18:25 +0200 Subject: [PATCH] More specific error msg for core statistics in standby Signed-off-by: Adam Rutkowski --- casadm/statistics_model.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/casadm/statistics_model.c b/casadm/statistics_model.c index 886148a..5c84ddc 100644 --- a/casadm/statistics_model.c +++ b/casadm/statistics_model.c @@ -778,6 +778,17 @@ int cache_status(unsigned int cache_id, unsigned int core_id, int io_class_id, goto cleanup; } + if ((cache_info.info.state & (1 << ocf_cache_state_standby)) && + core_id != OCF_CORE_ID_INVALID) { + /* Explicitly fail due to standby mode rather than + * bouncing off the fact that there are 0 cores in the + * cache and saying "no such core device" + */ + print_err(OCF_ERR_CACHE_STANDBY); + ret = FAILURE; + goto cleanup; + } + /* Check if core exists in cache */ if (core_id != OCF_CORE_ID_INVALID) { for (i = 0; i < cache_info.info.core_count; ++i) {