Forbid using load with other options in casadm
Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
parent
2ff055d689
commit
58b09c11a6
@ -406,17 +406,24 @@ int handle_start()
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
if (command_args_values.state == CACHE_INIT_LOAD && command_args_values.force) {
|
if (command_args_values.state == CACHE_INIT_LOAD) {
|
||||||
cas_printf(LOG_ERR, "Use of 'load' and 'force' simultaneously is forbidden.\n");
|
if (command_args_values.force ||
|
||||||
return FAILURE;
|
command_args_values.line_size != ocf_cache_line_size_none ||
|
||||||
}
|
command_args_values.cache_mode != ocf_cache_mode_none ||
|
||||||
|
command_args_values.cache_id != OCF_CACHE_ID_INVALID) {
|
||||||
|
cas_printf(LOG_ERR, "Use of 'load' with 'force', 'cache-id',"
|
||||||
|
" 'cache-mode' or 'cache-line-size'"
|
||||||
|
" simultaneously is forbidden.\n");
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (command_args_values.line_size == ocf_cache_line_size_none) {
|
||||||
|
command_args_values.line_size = ocf_cache_line_size_default;
|
||||||
|
}
|
||||||
|
|
||||||
if (command_args_values.line_size == ocf_cache_line_size_none) {
|
if (command_args_values.cache_mode == ocf_cache_mode_none) {
|
||||||
command_args_values.line_size = ocf_cache_line_size_default;
|
command_args_values.cache_mode = ocf_cache_mode_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command_args_values.cache_mode == ocf_cache_mode_none) {
|
|
||||||
command_args_values.cache_mode = ocf_cache_mode_default;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validate_cache_path(command_args_values.cache_device) == FAILURE)
|
if (validate_cache_path(command_args_values.cache_device) == FAILURE)
|
||||||
@ -1926,7 +1933,6 @@ static cli_option standby_params_options[] = {
|
|||||||
.args_count = 1,
|
.args_count = 1,
|
||||||
.arg = "ID",
|
.arg = "ID",
|
||||||
.priv = (1 << standby_opt_subcmd_init)
|
.priv = (1 << standby_opt_subcmd_init)
|
||||||
| (1 << standby_opt_subcmd_load)
|
|
||||||
| (1 << standby_opt_subcmd_detach)
|
| (1 << standby_opt_subcmd_detach)
|
||||||
| (1 << standby_opt_subcmd_activate)
|
| (1 << standby_opt_subcmd_activate)
|
||||||
| (1 << standby_opt_flag_required),
|
| (1 << standby_opt_flag_required),
|
||||||
@ -1941,7 +1947,6 @@ static cli_option standby_params_options[] = {
|
|||||||
.args_count = 1,
|
.args_count = 1,
|
||||||
.arg = "NUMBER",
|
.arg = "NUMBER",
|
||||||
.priv = (1 << standby_opt_subcmd_init)
|
.priv = (1 << standby_opt_subcmd_init)
|
||||||
| (1 << standby_opt_subcmd_load)
|
|
||||||
| (1 << standby_opt_flag_required),
|
| (1 << standby_opt_flag_required),
|
||||||
.flags = CLI_OPTION_DEFAULT_INT,
|
.flags = CLI_OPTION_DEFAULT_INT,
|
||||||
.default_value = ocf_cache_line_size_default / KiB,
|
.default_value = ocf_cache_line_size_default / KiB,
|
||||||
@ -2078,6 +2083,16 @@ int standby_handle() {
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (standby_params.subcmd == standby_opt_subcmd_load &&
|
||||||
|
(standby_params.force ||
|
||||||
|
standby_params.line_size != ocf_cache_line_size_none ||
|
||||||
|
standby_params.cache_id != OCF_CACHE_ID_INVALID)) {
|
||||||
|
cas_printf(LOG_ERR, "Use of 'load' with 'force', 'cache-id'"
|
||||||
|
" or 'cache-line-size' simultaneously is"
|
||||||
|
" forbidden.\n");
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if all required options are set */
|
/* Check if all required options are set */
|
||||||
if (standby_is_missing()) {
|
if (standby_is_missing()) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
Loading…
Reference in New Issue
Block a user