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,11 +406,17 @@ int handle_start()
|
||||
{
|
||||
int status;
|
||||
|
||||
if (command_args_values.state == CACHE_INIT_LOAD && command_args_values.force) {
|
||||
cas_printf(LOG_ERR, "Use of 'load' and 'force' simultaneously is forbidden.\n");
|
||||
if (command_args_values.state == CACHE_INIT_LOAD) {
|
||||
if (command_args_values.force ||
|
||||
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;
|
||||
}
|
||||
@ -418,6 +424,7 @@ int handle_start()
|
||||
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)
|
||||
return FAILURE;
|
||||
@ -1926,7 +1933,6 @@ static cli_option standby_params_options[] = {
|
||||
.args_count = 1,
|
||||
.arg = "ID",
|
||||
.priv = (1 << standby_opt_subcmd_init)
|
||||
| (1 << standby_opt_subcmd_load)
|
||||
| (1 << standby_opt_subcmd_detach)
|
||||
| (1 << standby_opt_subcmd_activate)
|
||||
| (1 << standby_opt_flag_required),
|
||||
@ -1941,7 +1947,6 @@ static cli_option standby_params_options[] = {
|
||||
.args_count = 1,
|
||||
.arg = "NUMBER",
|
||||
.priv = (1 << standby_opt_subcmd_init)
|
||||
| (1 << standby_opt_subcmd_load)
|
||||
| (1 << standby_opt_flag_required),
|
||||
.flags = CLI_OPTION_DEFAULT_INT,
|
||||
.default_value = ocf_cache_line_size_default / KiB,
|
||||
@ -2078,6 +2083,16 @@ int standby_handle() {
|
||||
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 */
|
||||
if (standby_is_missing()) {
|
||||
return FAILURE;
|
||||
|
Loading…
Reference in New Issue
Block a user