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:
parent
f955ce890c
commit
2bf6e42dea
@ -1904,11 +1904,23 @@ int remove_core(unsigned int cache_id, unsigned int core_id,
|
|||||||
if (run_ioctl_interruptible(fd, KCAS_IOCTL_REMOVE_CORE, &cmd,
|
if (run_ioctl_interruptible(fd, KCAS_IOCTL_REMOVE_CORE, &cmd,
|
||||||
"Removing core", cache_id, core_id) < 0) {
|
"Removing core", cache_id, core_id) < 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
if (OCF_ERR_FLUSHING_INTERRUPTED == cmd.ext_err_code) {
|
if (cmd.ext_err_code == OCF_ERR_FLUSHING_INTERRUPTED) {
|
||||||
cas_printf(LOG_ERR, "You have interrupted removal of core. CAS continues to operate normally.\n");
|
cas_printf(LOG_ERR, "You have interrupted %s of core. "
|
||||||
|
"CAS continues to operate normally.\n",
|
||||||
|
detach ? "detaching" : "removal");
|
||||||
return INTERRUPTED;
|
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 {
|
} else {
|
||||||
cas_printf(LOG_ERR, "Error while removing core device %d from cache instance %d\n",
|
cas_printf(LOG_ERR, "Error while %s core device %d "
|
||||||
|
"from cache instance %d\n",
|
||||||
|
detach ? "detaching" : "removing",
|
||||||
core_id, cache_id);
|
core_id, cache_id);
|
||||||
print_err(cmd.ext_err_code);
|
print_err(cmd.ext_err_code);
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
@ -1109,7 +1109,7 @@ int handle_add()
|
|||||||
static cli_option remove_options[] = {
|
static cli_option remove_options[] = {
|
||||||
{'i', "cache-id", CACHE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
{'i', "cache-id", CACHE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
||||||
{'j', "core-id", CORE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
{'j', "core-id", CORE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
||||||
{'f', "force", "Force remove inactive core"},
|
{'f', "force", "Force active core removal without data flush"},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1961,7 +1961,7 @@ static cli_command cas_commands[] = {
|
|||||||
{
|
{
|
||||||
.name = "remove-core",
|
.name = "remove-core",
|
||||||
.short_name = 'R',
|
.short_name = 'R',
|
||||||
.desc = "Remove core device from cache instance",
|
.desc = "Remove active core device from cache instance",
|
||||||
.long_desc = NULL,
|
.long_desc = NULL,
|
||||||
.options = remove_options,
|
.options = remove_options,
|
||||||
.command_handle_opts = remove_core_command_handle_option,
|
.command_handle_opts = remove_core_command_handle_option,
|
||||||
|
@ -222,8 +222,8 @@ struct {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
KCAS_ERR_REMOVED_DIRTY,
|
KCAS_ERR_REMOVED_DIRTY,
|
||||||
"Flush error occured. Core has been set to detached state.\n"
|
"Warning: Core has been removed or detached without flush.\n"
|
||||||
"Warning: Core device may contain inconsistent data.\n"
|
"Core device may contain inconsistent data.\n"
|
||||||
"To access your data please add core back to the cache."
|
"To access your data please add core back to the cache."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ struct kcas_insert_core {
|
|||||||
struct kcas_remove_core {
|
struct kcas_remove_core {
|
||||||
uint16_t cache_id; /**< id of an running cache */
|
uint16_t cache_id; /**< id of an running cache */
|
||||||
uint16_t core_id; /**< id core object to be removed */
|
uint16_t core_id; /**< id core object to be removed */
|
||||||
bool force_no_flush; /**< remove core without flushing */
|
bool force_no_flush; /**< remove active core without flushing */
|
||||||
bool detach; /**< detach core without removing it from cache metadata */
|
bool detach; /**< detach core without removing it from cache metadata */
|
||||||
|
|
||||||
int ext_err_code;
|
int ext_err_code;
|
||||||
@ -473,7 +473,7 @@ struct kcas_get_cache_param {
|
|||||||
/** Add core object to an running cache instance */
|
/** Add core object to an running cache instance */
|
||||||
#define KCAS_IOCTL_INSERT_CORE _IOWR(KCAS_IOCTL_MAGIC, 22, struct kcas_insert_core)
|
#define KCAS_IOCTL_INSERT_CORE _IOWR(KCAS_IOCTL_MAGIC, 22, struct kcas_insert_core)
|
||||||
|
|
||||||
/** Remove core object from an running cache instance */
|
/** Remove active core object from an running cache instance */
|
||||||
#define KCAS_IOCTL_REMOVE_CORE _IOR(KCAS_IOCTL_MAGIC, 23, struct kcas_remove_core)
|
#define KCAS_IOCTL_REMOVE_CORE _IOR(KCAS_IOCTL_MAGIC, 23, struct kcas_remove_core)
|
||||||
|
|
||||||
/** Retrieve properties of a running cache instance (incl. mode etc.) */
|
/** Retrieve properties of a running cache instance (incl. mode etc.) */
|
||||||
@ -566,7 +566,7 @@ enum kcas_error {
|
|||||||
/** Given device is a partition */
|
/** Given device is a partition */
|
||||||
KCAS_ERR_A_PART,
|
KCAS_ERR_A_PART,
|
||||||
|
|
||||||
/** Core has been removed with flush error */
|
/** Core has been removed, but it may contain dirty data */
|
||||||
KCAS_ERR_REMOVED_DIRTY,
|
KCAS_ERR_REMOVED_DIRTY,
|
||||||
|
|
||||||
/** Cache has been stopped, but it may contain dirty data */
|
/** Cache has been stopped, but it may contain dirty data */
|
||||||
|
Loading…
Reference in New Issue
Block a user