Make device parameter obligatory in failover activate
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
8f53682954
commit
0f6a024025
@ -3004,12 +3004,10 @@ int failover_activate(int cache_id, const char *cache_device)
|
|||||||
{
|
{
|
||||||
struct kcas_failover_activate data = {.cache_id = cache_id};
|
struct kcas_failover_activate data = {.cache_id = cache_id};
|
||||||
|
|
||||||
if (cache_device) {
|
|
||||||
if (set_device_path(data.cache_path, sizeof(data.cache_path),
|
if (set_device_path(data.cache_path, sizeof(data.cache_path),
|
||||||
cache_device, MAX_STR_LEN) != SUCCESS) {
|
cache_device, MAX_STR_LEN) != SUCCESS) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (cas_ioctl(KCAS_IOCTL_FAILOVER_ACTIVATE, &data) != SUCCESS) {
|
if (cas_ioctl(KCAS_IOCTL_FAILOVER_ACTIVATE, &data) != SUCCESS) {
|
||||||
print_err(data.ext_err_code ? : KCAS_ERR_SYSTEM);
|
print_err(data.ext_err_code ? : KCAS_ERR_SYSTEM);
|
||||||
|
@ -1497,7 +1497,7 @@ static cli_option failover_detach_options[] = {
|
|||||||
|
|
||||||
static cli_option failover_activate_options[] = {
|
static cli_option failover_activate_options[] = {
|
||||||
{'i', "cache-id", CACHE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
{'i', "cache-id", CACHE_ID_DESC, 1, "ID", CLI_OPTION_REQUIRED},
|
||||||
{'d', "cache-device", CACHE_DEVICE_DESC, 1, "DEVICE"},
|
{'d', "cache-device", CACHE_DEVICE_DESC, 1, "DEVICE", CLI_OPTION_REQUIRED},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1819,8 +1819,6 @@ static int cache_mngt_initialize_cache_exported_object(ocf_cache_t cache)
|
|||||||
int cache_mngt_prepare_cache_device_cfg(struct ocf_mngt_cache_device_config *cfg,
|
int cache_mngt_prepare_cache_device_cfg(struct ocf_mngt_cache_device_config *cfg,
|
||||||
char *cache_path)
|
char *cache_path)
|
||||||
{
|
{
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
memset(cfg, 0, sizeof(*cfg));
|
memset(cfg, 0, sizeof(*cfg));
|
||||||
|
|
||||||
if (strnlen(cache_path, MAX_STR_LEN) == MAX_STR_LEN)
|
if (strnlen(cache_path, MAX_STR_LEN) == MAX_STR_LEN)
|
||||||
@ -1830,18 +1828,11 @@ int cache_mngt_prepare_cache_device_cfg(struct ocf_mngt_cache_device_config *cfg
|
|||||||
cfg->uuid.size = strnlen(cfg->uuid.data, MAX_STR_LEN) + 1;
|
cfg->uuid.size = strnlen(cfg->uuid.data, MAX_STR_LEN) + 1;
|
||||||
cfg->perform_test = false;
|
cfg->perform_test = false;
|
||||||
|
|
||||||
if (cfg->uuid.size == 1) {
|
if (cfg->uuid.size <= 1)
|
||||||
// empty string means empty uuid
|
return -OCF_ERR_INVAL;
|
||||||
cfg->uuid.size = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cfg->uuid.size > 1) {
|
return cas_blk_identify_type(cfg->uuid.data,
|
||||||
result = cas_blk_identify_type(cfg->uuid.data,
|
|
||||||
&cfg->volume_type);
|
&cfg->volume_type);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2250,8 +2241,6 @@ int cache_mngt_activate(struct ocf_mngt_cache_device_config *cfg,
|
|||||||
struct _cache_mngt_attach_context *context;
|
struct _cache_mngt_attach_context *context;
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
struct cache_priv *cache_priv;
|
struct cache_priv *cache_priv;
|
||||||
ocf_volume_t cache_volume;
|
|
||||||
const struct ocf_volume_uuid *cache_uuid;
|
|
||||||
char cache_name[OCF_CACHE_NAME_SIZE];
|
char cache_name[OCF_CACHE_NAME_SIZE];
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
@ -2274,17 +2263,9 @@ int cache_mngt_activate(struct ocf_mngt_cache_device_config *cfg,
|
|||||||
if (result)
|
if (result)
|
||||||
goto out_cache_put;
|
goto out_cache_put;
|
||||||
|
|
||||||
if (strnlen(cmd->cache_path, MAX_STR_LEN) > 0) {
|
|
||||||
cache_volume = ocf_cache_get_volume(cache);
|
|
||||||
cache_uuid = ocf_volume_get_uuid(cache_volume);
|
|
||||||
if (cache_uuid->size > 0 &&
|
|
||||||
strcmp(cfg->uuid.data, cache_uuid->data)
|
|
||||||
!= 0) {
|
|
||||||
result = cache_mngt_check_bdev(cfg, false);
|
result = cache_mngt_check_bdev(cfg, false);
|
||||||
if (result)
|
if (result)
|
||||||
goto out_cache_unlock;
|
goto out_cache_unlock;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context = kzalloc(sizeof(*context), GFP_KERNEL);
|
context = kzalloc(sizeof(*context), GFP_KERNEL);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
Loading…
Reference in New Issue
Block a user