Print separate messages for different "remove core" return codes

Change extended error message for `KCAS_ERR_REMOVED_DIRTY`.
Print informative messages when `remove core` command fails.
Make separate error messages for detaching.
Update help printouts.
Update documentation comments.

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
This commit is contained in:
Slawomir Jankowski
2021-02-17 15:35:57 +01:00
parent f955ce890c
commit 2bf6e42dea
4 changed files with 24 additions and 12 deletions

View File

@@ -1904,12 +1904,24 @@ int remove_core(unsigned int cache_id, unsigned int core_id,
if (run_ioctl_interruptible(fd, KCAS_IOCTL_REMOVE_CORE, &cmd,
"Removing core", cache_id, core_id) < 0) {
close(fd);
if (OCF_ERR_FLUSHING_INTERRUPTED == cmd.ext_err_code) {
cas_printf(LOG_ERR, "You have interrupted removal of core. CAS continues to operate normally.\n");
if (cmd.ext_err_code == OCF_ERR_FLUSHING_INTERRUPTED) {
cas_printf(LOG_ERR, "You have interrupted %s of core. "
"CAS continues to operate normally.\n",
detach ? "detaching" : "removal");
return INTERRUPTED;
} else if (cmd.ext_err_code == OCF_ERR_CORE_IN_INACTIVE_STATE) {
cas_printf(LOG_ERR, "Core is inactive. To manage the "
"inactive core use '--remove-inactive' "
"command.\n");
return FAILURE;
} else if (cmd.ext_err_code == KCAS_ERR_REMOVED_DIRTY) {
print_err(cmd.ext_err_code);
return SUCCESS;
} else {
cas_printf(LOG_ERR, "Error while removing core device %d from cache instance %d\n",
core_id, cache_id);
cas_printf(LOG_ERR, "Error while %s core device %d "
"from cache instance %d\n",
detach ? "detaching" : "removing",
core_id, cache_id);
print_err(cmd.ext_err_code);
return FAILURE;
}