Merge pull request #1587 from Deixx/ioclass-0
Informative error for incorrect IO class 0 name
This commit is contained in:
commit
52d0ff4c7b
@ -70,7 +70,7 @@ static const char *core_states_name[] = {
|
|||||||
|
|
||||||
#define STANDBY_DETACHED_STATE "Standby detached"
|
#define STANDBY_DETACHED_STATE "Standby detached"
|
||||||
|
|
||||||
#define CACHE_STATE_LENGHT 20
|
#define CACHE_STATE_LENGTH 20
|
||||||
|
|
||||||
#define CAS_LOG_FILE "/var/log/opencas.log"
|
#define CAS_LOG_FILE "/var/log/opencas.log"
|
||||||
#define CAS_LOG_LEVEL LOG_INFO
|
#define CAS_LOG_LEVEL LOG_INFO
|
||||||
@ -2202,7 +2202,7 @@ int partition_list(unsigned int cache_id, unsigned int output_format)
|
|||||||
fclose(intermediate_file[1]);
|
fclose(intermediate_file[1]);
|
||||||
if (!result && stat_format_output(intermediate_file[0], stdout,
|
if (!result && stat_format_output(intermediate_file[0], stdout,
|
||||||
use_csv?RAW_CSV:TEXT)) {
|
use_csv?RAW_CSV:TEXT)) {
|
||||||
cas_printf(LOG_ERR, "An error occured during statistics formatting.\n");
|
cas_printf(LOG_ERR, "An error occurred during statistics formatting.\n");
|
||||||
result = FAILURE;
|
result = FAILURE;
|
||||||
}
|
}
|
||||||
fclose(intermediate_file[0]);
|
fclose(intermediate_file[0]);
|
||||||
@ -2327,6 +2327,10 @@ static inline int partition_get_line(CSVFILE *csv,
|
|||||||
}
|
}
|
||||||
strncpy_s(cnfg->info[part_id].name, sizeof(cnfg->info[part_id].name),
|
strncpy_s(cnfg->info[part_id].name, sizeof(cnfg->info[part_id].name),
|
||||||
name, strnlen_s(name, sizeof(cnfg->info[part_id].name)));
|
name, strnlen_s(name, sizeof(cnfg->info[part_id].name)));
|
||||||
|
if (0 == part_id && strcmp(name, "unclassified")) {
|
||||||
|
cas_printf(LOG_ERR, "IO class 0 must have the default name 'unclassified'\n");
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Validate Priority*/
|
/* Validate Priority*/
|
||||||
*error_col = part_csv_coll_prio;
|
*error_col = part_csv_coll_prio;
|
||||||
@ -2414,7 +2418,7 @@ int partition_get_config(CSVFILE *csv, struct kcas_io_classes *cnfg,
|
|||||||
return FAILURE;
|
return FAILURE;
|
||||||
} else {
|
} else {
|
||||||
cas_printf(LOG_ERR,
|
cas_printf(LOG_ERR,
|
||||||
"I/O error occured while reading"
|
"I/O error occurred while reading"
|
||||||
" IO Classes configuration file"
|
" IO Classes configuration file"
|
||||||
" supplied.\n");
|
" supplied.\n");
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
@ -2661,7 +2665,7 @@ void *list_printout(void *ctx)
|
|||||||
struct list_printout_ctx *spc = ctx;
|
struct list_printout_ctx *spc = ctx;
|
||||||
if (stat_format_output(spc->intermediate,
|
if (stat_format_output(spc->intermediate,
|
||||||
spc->out, spc->type)) {
|
spc->out, spc->type)) {
|
||||||
cas_printf(LOG_ERR, "An error occured during statistics formatting.\n");
|
cas_printf(LOG_ERR, "An error occurred during statistics formatting.\n");
|
||||||
spc->result = FAILURE;
|
spc->result = FAILURE;
|
||||||
} else {
|
} else {
|
||||||
spc->result = SUCCESS;
|
spc->result = SUCCESS;
|
||||||
@ -2800,7 +2804,7 @@ int list_caches(unsigned int list_format, bool by_id_path)
|
|||||||
for (i = 0; i < caches_count; ++i) {
|
for (i = 0; i < caches_count; ++i) {
|
||||||
curr_cache = caches[i];
|
curr_cache = caches[i];
|
||||||
|
|
||||||
char status_buf[CACHE_STATE_LENGHT];
|
char status_buf[CACHE_STATE_LENGTH];
|
||||||
const char *tmp_status;
|
const char *tmp_status;
|
||||||
char mode_string[12];
|
char mode_string[12];
|
||||||
char exp_obj[32];
|
char exp_obj[32];
|
||||||
@ -2867,7 +2871,7 @@ int list_caches(unsigned int list_format, bool by_id_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (core_flush_prog || cache_flush_prog) {
|
if (core_flush_prog || cache_flush_prog) {
|
||||||
snprintf(status_buf, CACHE_STATE_LENGHT,
|
snprintf(status_buf, CACHE_STATE_LENGTH,
|
||||||
"%s (%3.1f %%)", "Flushing", core_flush_prog);
|
"%s (%3.1f %%)", "Flushing", core_flush_prog);
|
||||||
tmp_status = status_buf;
|
tmp_status = status_buf;
|
||||||
} else {
|
} else {
|
||||||
@ -2895,7 +2899,7 @@ int list_caches(unsigned int list_format, bool by_id_path)
|
|||||||
pthread_join(thread, 0);
|
pthread_join(thread, 0);
|
||||||
if (printout_ctx.result) {
|
if (printout_ctx.result) {
|
||||||
result = 1;
|
result = 1;
|
||||||
cas_printf(LOG_ERR, "An error occured during list formatting.\n");
|
cas_printf(LOG_ERR, "An error occurred during list formatting.\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
fclose(intermediate_file[0]);
|
fclose(intermediate_file[0]);
|
||||||
@ -3029,7 +3033,7 @@ int zero_md(const char *cache_device, bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
cas_printf(LOG_INFO, "OpenCAS's metadata wiped succesfully from device '%s'.\n", cache_device);
|
cas_printf(LOG_INFO, "OpenCAS's metadata wiped successfully from device '%s'.\n", cache_device);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user