Merge pull request #614 from Ostrokrzew/message

Move message about by-id path higher
This commit is contained in:
Robert Baldyga 2021-01-08 12:25:36 +01:00 committed by GitHub
commit cbc1de7a37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -540,8 +540,12 @@ const char *get_core_state_name(int core_state)
/* check if device is atomic and print information about potential slow start */ /* check if device is atomic and print information about potential slow start */
void print_slow_atomic_cache_start_info(const char *device_path) void print_slow_atomic_cache_start_info(const char *device_path)
{ {
char buff[MAX_STR_LEN];
struct kcas_cache_check_device cmd_info; struct kcas_cache_check_device cmd_info;
int ret = _check_cache_device(device_path, &cmd_info); int ret;
get_dev_path(device_path, buff, sizeof(buff));
ret = _check_cache_device(device_path, &cmd_info);
if (!ret && cmd_info.format_atomic) { if (!ret && cmd_info.format_atomic) {
cas_printf(LOG_INFO, cas_printf(LOG_INFO,
@ -661,9 +665,6 @@ int set_device_path(char *dest_path, size_t dest_len, const char *src_path, size
return SUCCESS; return SUCCESS;
else else
cas_printf(LOG_ERR, "Internal error copying device path\n"); cas_printf(LOG_ERR, "Internal error copying device path\n");
} else {
cas_printf(LOG_ERR, "Please use correct by-id path to the device "
"%s.\n", src_path);
} }
return FAILURE; return FAILURE;
@ -1040,6 +1041,8 @@ int start_cache(uint16_t cache_id, unsigned int cache_init,
cmd.init_cache = cache_init; cmd.init_cache = cache_init;
if (set_device_path(cmd.cache_path_name, sizeof(cmd.cache_path_name), if (set_device_path(cmd.cache_path_name, sizeof(cmd.cache_path_name),
cache_device, MAX_STR_LEN) != SUCCESS) { cache_device, MAX_STR_LEN) != SUCCESS) {
cas_printf(LOG_ERR, "Please use correct by-id path to the device "
"%s.\n", cache_device);
close(fd); close(fd);
return FAILURE; return FAILURE;
} }
@ -1760,6 +1763,8 @@ int add_core(unsigned int cache_id, unsigned int core_id, const char *core_devic
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
if (set_device_path(cmd.core_path_name, sizeof(cmd.core_path_name), if (set_device_path(cmd.core_path_name, sizeof(cmd.core_path_name),
core_device, MAX_STR_LEN) != SUCCESS) { core_device, MAX_STR_LEN) != SUCCESS) {
cas_printf(LOG_ERR, "Please use correct by-id path to the device "
"%s.\n", core_device);
return FAILURE; return FAILURE;
} }
@ -1909,6 +1914,8 @@ int core_pool_remove(const char *core_device)
if (set_device_path(cmd.core_path_name, sizeof(cmd.core_path_name), if (set_device_path(cmd.core_path_name, sizeof(cmd.core_path_name),
core_device, MAX_STR_LEN) != SUCCESS) { core_device, MAX_STR_LEN) != SUCCESS) {
cas_printf(LOG_ERR, "Please use correct by-id path to the device "
"%s.\n", core_device);
close(fd); close(fd);
return FAILURE; return FAILURE;
} }
@ -2824,11 +2831,6 @@ int _check_cache_device(const char *device_path,
{ {
int result, fd; int result, fd;
if (set_device_path(cmd_info->path_name, sizeof(cmd_info->path_name),
device_path, MAX_STR_LEN) != SUCCESS) {
return FAILURE;
}
fd = open_ctrl_device(); fd = open_ctrl_device();
if (fd == -1) if (fd == -1)
return FAILURE; return FAILURE;
@ -2846,6 +2848,13 @@ int check_cache_device(const char *device_path)
FILE *intermediate_file[2]; FILE *intermediate_file[2];
int result; int result;
if (set_device_path(cmd_info.path_name, sizeof(cmd_info.path_name),
device_path, MAX_STR_LEN) != SUCCESS) {
cas_printf(LOG_ERR, "Please use correct by-id path to the device "
"%s.\n", device_path);
return FAILURE;
}
result = _check_cache_device(device_path, &cmd_info); result = _check_cache_device(device_path, &cmd_info);
if (result) { if (result) {