Merge pull request #1010 from arutk/failover_err_msg

failover standby fixes
This commit is contained in:
Robert Baldyga 2021-11-30 17:36:48 +01:00 committed by GitHub
commit ecda2431ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 34 deletions

View File

@ -3004,12 +3004,15 @@ int failover_activate(int cache_id, const char *cache_device)
{
struct kcas_failover_activate data = {.cache_id = cache_id};
if (cache_device) {
if (set_device_path(data.cache_path, sizeof(data.cache_path),
cache_device, MAX_STR_LEN) != SUCCESS) {
return FAILURE;
}
if (cas_ioctl(KCAS_IOCTL_FAILOVER_ACTIVATE, &data) != SUCCESS) {
print_err(data.ext_err_code ? : KCAS_ERR_SYSTEM);
return FAILURE;
}
return cas_ioctl(KCAS_IOCTL_FAILOVER_ACTIVATE, &data);
return SUCCESS;
}

View File

@ -1497,7 +1497,7 @@ static cli_option failover_detach_options[] = {
static cli_option failover_activate_options[] = {
{'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},
{}
};

View File

@ -166,6 +166,22 @@ struct {
OCF_ERR_NO_LOCK,
"Failed to lock cache for management operation."
},
{
OCF_ERR_METADATA_LAYOUT_MISMATCH,
"Metadata layout mismatch"
},
{
OCF_ERR_CACHE_LINE_SIZE_MISMATCH,
"Cache line size mismatch"
},
{
OCF_ERR_CACHE_STANDBY,
"Operation not permitted in failover standby mode"
},
{
OCF_ERR_FAILOVER_ATTACHED,
"Cache device is attached, please detach it first with --failover-detach"
},
/* CAS kernel error mappings*/
{

View File

@ -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,
char *cache_path)
{
int result = 0;
memset(cfg, 0, sizeof(*cfg));
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->perform_test = false;
if (cfg->uuid.size == 1) {
// empty string means empty uuid
cfg->uuid.size = 0;
return 0;
}
if (cfg->uuid.size <= 1)
return -OCF_ERR_INVAL;
if (cfg->uuid.size > 1) {
result = cas_blk_identify_type(cfg->uuid.data,
return cas_blk_identify_type(cfg->uuid.data,
&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;
ocf_cache_t cache;
struct cache_priv *cache_priv;
ocf_volume_t cache_volume;
const struct ocf_volume_uuid *cache_uuid;
char cache_name[OCF_CACHE_NAME_SIZE];
int result = 0;
@ -2274,17 +2263,9 @@ int cache_mngt_activate(struct ocf_mngt_cache_device_config *cfg,
if (result)
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);
if (result)
goto out_cache_unlock;
}
}
context = kzalloc(sizeof(*context), GFP_KERNEL);
if (!context) {

2
ocf

@ -1 +1 @@
Subproject commit e72018bc02478f3ac73ee8984fafaf61f09c425d
Subproject commit aac21cab6321632b4ccb159466b94ea41e148d9a