casadm: prevent using init
and load
at once
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
583af2e229
commit
08307ce77b
@ -1990,22 +1990,32 @@ struct {
|
|||||||
/* Parser of option for IO class command */
|
/* Parser of option for IO class command */
|
||||||
int standby_handle_option(char *opt, const char **arg)
|
int standby_handle_option(char *opt, const char **arg)
|
||||||
{
|
{
|
||||||
if (io_class_opt_subcmd_unknown == io_class_params.subcmd) {
|
|
||||||
/* First parameters which defines sub-command */
|
/* First parameters which defines sub-command */
|
||||||
if (!strcmp(opt, "init")) {
|
if (!strcmp(opt, "init")) {
|
||||||
|
if (standby_opt_subcmd_unknown != standby_params.subcmd)
|
||||||
|
goto err;
|
||||||
|
|
||||||
standby_params.subcmd = standby_opt_subcmd_init;
|
standby_params.subcmd = standby_opt_subcmd_init;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(opt, "load")) {
|
} else if (!strcmp(opt, "load")) {
|
||||||
|
if (standby_opt_subcmd_unknown != standby_params.subcmd)
|
||||||
|
goto err;
|
||||||
|
|
||||||
standby_params.subcmd = standby_opt_subcmd_load;
|
standby_params.subcmd = standby_opt_subcmd_load;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(opt, "detach")) {
|
} else if (!strcmp(opt, "detach")) {
|
||||||
|
if (standby_opt_subcmd_unknown != standby_params.subcmd)
|
||||||
|
goto err;
|
||||||
|
|
||||||
standby_params.subcmd = standby_opt_subcmd_detach;
|
standby_params.subcmd = standby_opt_subcmd_detach;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(opt, "activate")) {
|
} else if (!strcmp(opt, "activate")) {
|
||||||
|
if (standby_opt_subcmd_unknown != standby_params.subcmd)
|
||||||
|
goto err;
|
||||||
|
|
||||||
standby_params.subcmd = standby_opt_subcmd_activate;
|
standby_params.subcmd = standby_opt_subcmd_activate;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(opt, "cache-id")) {
|
if (!strcmp(opt, "cache-id")) {
|
||||||
if (validate_str_num(arg[0], "cache id", OCF_CACHE_ID_MIN,
|
if (validate_str_num(arg[0], "cache id", OCF_CACHE_ID_MIN,
|
||||||
@ -2038,6 +2048,12 @@ int standby_handle_option(char *opt, const char **arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err:
|
||||||
|
cas_printf(LOG_ERR, "Can't use '%s' and '%s' options simultaneously\n",
|
||||||
|
opt, standby_params_options[standby_params.subcmd].long_name);
|
||||||
|
|
||||||
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if all required command were set depending on command type */
|
/* Check if all required command were set depending on command type */
|
||||||
|
Loading…
Reference in New Issue
Block a user