mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-10-04 09:27:09 +00:00
main: Move sched paramaters to config file
The reason for this change is, that number of corosync CLI options kind of exploded and scheduler based one are really beter to be kept in config file. Nice side-effect of this move is better "integration" with systemd, because currently used EnvironmentFile should be really used for environment and not that much for passing extra options to CLI. Signed-off-by: Jan Friesse <jfriesse@redhat.com> Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
This commit is contained in:
parent
00ca339e00
commit
cd4d5fd38e
@ -593,7 +593,10 @@ static void remove_ro_entries(icmap_map_t temp_map)
|
||||
delete_and_notify_if_changed(temp_map, "totem.transport");
|
||||
delete_and_notify_if_changed(temp_map, "totem.cluster_name");
|
||||
delete_and_notify_if_changed(temp_map, "quorum.provider");
|
||||
delete_and_notify_if_changed(temp_map, "qb.ipc_type");
|
||||
delete_and_notify_if_changed(temp_map, "system.move_to_root_cgroup");
|
||||
delete_and_notify_if_changed(temp_map, "system.sched_rr");
|
||||
delete_and_notify_if_changed(temp_map, "system.priority");
|
||||
delete_and_notify_if_changed(temp_map, "system.qb_ipc_type");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -84,7 +84,7 @@ enum main_cp_cb_data_state {
|
||||
MAIN_CP_CB_DATA_STATE_NODELIST,
|
||||
MAIN_CP_CB_DATA_STATE_NODELIST_NODE,
|
||||
MAIN_CP_CB_DATA_STATE_PLOAD,
|
||||
MAIN_CP_CB_DATA_STATE_QB,
|
||||
MAIN_CP_CB_DATA_STATE_SYSTEM,
|
||||
MAIN_CP_CB_DATA_STATE_RESOURCES,
|
||||
MAIN_CP_CB_DATA_STATE_RESOURCES_SYSTEM,
|
||||
MAIN_CP_CB_DATA_STATE_RESOURCES_PROCESS,
|
||||
@ -780,12 +780,28 @@ static int main_config_parser_cb(const char *path,
|
||||
}
|
||||
break;
|
||||
|
||||
case MAIN_CP_CB_DATA_STATE_QB:
|
||||
if (strcmp(path, "qb.ipc_type") == 0) {
|
||||
case MAIN_CP_CB_DATA_STATE_SYSTEM:
|
||||
if (strcmp(path, "system.qb_ipc_type") == 0) {
|
||||
if ((strcmp(value, "native") != 0) &&
|
||||
(strcmp(value, "shm") != 0) &&
|
||||
(strcmp(value, "socket") != 0)) {
|
||||
*error_string = "Invalid qb ipc_type";
|
||||
*error_string = "Invalid system.qb_ipc_type";
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
if (strcmp(path, "system.sched_rr") == 0) {
|
||||
if ((strcmp(value, "yes") != 0) &&
|
||||
(strcmp(value, "no") != 0)) {
|
||||
*error_string = "Invalid system.sched_rr value";
|
||||
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
if (strcmp(path, "system.move_to_root_cgroup") == 0) {
|
||||
if ((strcmp(value, "yes") != 0) &&
|
||||
(strcmp(value, "no") != 0)) {
|
||||
*error_string = "Invalid system.move_to_root_cgroup";
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1085,8 +1101,8 @@ static int main_config_parser_cb(const char *path,
|
||||
if (strcmp(path, "totem") == 0) {
|
||||
*state = MAIN_CP_CB_DATA_STATE_TOTEM;
|
||||
};
|
||||
if (strcmp(path, "qb") == 0) {
|
||||
*state = MAIN_CP_CB_DATA_STATE_QB;
|
||||
if (strcmp(path, "system") == 0) {
|
||||
*state = MAIN_CP_CB_DATA_STATE_SYSTEM;
|
||||
}
|
||||
if (strcmp(path, "logging.logger_subsys") == 0) {
|
||||
*state = MAIN_CP_CB_DATA_STATE_LOGGER_SUBSYS;
|
||||
@ -1390,7 +1406,7 @@ static int main_config_parser_cb(const char *path,
|
||||
case MAIN_CP_CB_DATA_STATE_QDEVICE:
|
||||
case MAIN_CP_CB_DATA_STATE_NODELIST:
|
||||
case MAIN_CP_CB_DATA_STATE_TOTEM:
|
||||
case MAIN_CP_CB_DATA_STATE_QB:
|
||||
case MAIN_CP_CB_DATA_STATE_SYSTEM:
|
||||
break;
|
||||
case MAIN_CP_CB_DATA_STATE_RESOURCES:
|
||||
*state = MAIN_CP_CB_DATA_STATE_NORMAL;
|
||||
|
@ -744,8 +744,8 @@ static enum qb_ipc_type cs_get_ipc_type (void)
|
||||
int found = 0;
|
||||
enum qb_ipc_type ret = QB_IPC_NATIVE;
|
||||
|
||||
if (icmap_get_string("qb.ipc_type", &str) != CS_OK) {
|
||||
log_printf(LOGSYS_LEVEL_DEBUG, "No configured qb.ipc_type. Using native ipc");
|
||||
if (icmap_get_string("system.qb_ipc_type", &str) != CS_OK) {
|
||||
log_printf(LOGSYS_LEVEL_DEBUG, "No configured system.qb_ipc_type. Using native ipc");
|
||||
return QB_IPC_NATIVE;
|
||||
}
|
||||
|
||||
|
79
exec/main.c
79
exec/main.c
@ -1021,6 +1021,7 @@ static void set_icmap_ro_keys_flag (void)
|
||||
icmap_set_ro_access("runtime.config.", CS_TRUE, CS_TRUE);
|
||||
icmap_set_ro_access("runtime.totem.", CS_TRUE, CS_TRUE);
|
||||
icmap_set_ro_access("uidgid.config.", CS_TRUE, CS_TRUE);
|
||||
icmap_set_ro_access("system.", CS_TRUE, CS_TRUE);
|
||||
|
||||
/*
|
||||
* Set RO flag for constrete keys of configuration which can't be changed
|
||||
@ -1038,7 +1039,6 @@ static void set_icmap_ro_keys_flag (void)
|
||||
icmap_set_ro_access("totem.version", CS_FALSE, CS_TRUE);
|
||||
icmap_set_ro_access("totem.nodeid", CS_FALSE, CS_TRUE);
|
||||
icmap_set_ro_access("totem.clear_node_high_bit", CS_FALSE, CS_TRUE);
|
||||
icmap_set_ro_access("qb.ipc_type", CS_FALSE, CS_TRUE);
|
||||
icmap_set_ro_access("config.reload_in_progress", CS_FALSE, CS_TRUE);
|
||||
icmap_set_ro_access("config.totemconfig_reload_in_progress", CS_FALSE, CS_TRUE);
|
||||
}
|
||||
@ -1210,54 +1210,25 @@ int main (int argc, char **argv, char **envp)
|
||||
struct scheduler_pause_timeout_data scheduler_pause_timeout_data;
|
||||
long int tmpli;
|
||||
char *ep;
|
||||
char *tmp_str;
|
||||
|
||||
/* default configuration
|
||||
*/
|
||||
background = 1;
|
||||
sched_rr = 1;
|
||||
prio = 0;
|
||||
testonly = 0;
|
||||
move_to_root_cgroup = 1;
|
||||
|
||||
while ((ch = getopt (argc, argv, "fP:pRrtv")) != EOF) {
|
||||
while ((ch = getopt (argc, argv, "ftv")) != EOF) {
|
||||
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
background = 0;
|
||||
break;
|
||||
case 'p':
|
||||
sched_rr = 0;
|
||||
break;
|
||||
case 'P':
|
||||
if (strcmp(optarg, "max") == 0) {
|
||||
prio = INT_MIN;
|
||||
} else if (strcmp(optarg, "min") == 0) {
|
||||
prio = INT_MAX;
|
||||
} else {
|
||||
errno = 0;
|
||||
|
||||
tmpli = strtol(optarg, &ep, 10);
|
||||
if (errno != 0 || *ep != '\0' || tmpli > INT_MAX || tmpli < INT_MIN) {
|
||||
fprintf(stderr, "Priority value %s is invalid", optarg);
|
||||
logsys_system_fini();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
prio = tmpli;
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
move_to_root_cgroup = 0;
|
||||
break;
|
||||
case 'r':
|
||||
sched_rr = 1;
|
||||
break;
|
||||
case 't':
|
||||
testonly = 1;
|
||||
break;
|
||||
case 'v':
|
||||
printf ("Corosync Cluster Engine, version '%s'\n", VERSION);
|
||||
printf ("Copyright (c) 2006-2009 Red Hat, Inc.\n");
|
||||
printf ("Copyright (c) 2006-2018 Red Hat, Inc.\n");
|
||||
logsys_system_fini();
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@ -1266,11 +1237,6 @@ int main (int argc, char **argv, char **envp)
|
||||
fprintf(stderr, \
|
||||
"usage:\n"\
|
||||
" -f : Start application in foreground.\n"\
|
||||
" -p : Do not set realtime scheduling.\n"\
|
||||
" -r : Set round robin realtime scheduling (default).\n"\
|
||||
" -R : Do not try move corosync to root cpu cgroup (valid for cgroups enabled systems)\n"\
|
||||
" Feature is expected to be removed - see corosync.8 man page\n" \
|
||||
" -P num : Set priority of process (no effect when -r is used)\n"\
|
||||
" -t : Test configuration and exit.\n"\
|
||||
" -v : Display version and SVN revision of Corosync and exit.\n");
|
||||
logsys_system_fini();
|
||||
@ -1396,6 +1362,14 @@ int main (int argc, char **argv, char **envp)
|
||||
}
|
||||
|
||||
|
||||
move_to_root_cgroup = 1;
|
||||
if (icmap_get_string("system.move_to_root_cgroup", &tmp_str) == CS_OK) {
|
||||
if (strcmp(tmp_str, "yes") != 0) {
|
||||
move_to_root_cgroup = 0;
|
||||
}
|
||||
free(tmp_str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to move corosync into root cpu cgroup. Failure is not fatal and
|
||||
* error is deliberately ignored.
|
||||
@ -1404,6 +1378,35 @@ int main (int argc, char **argv, char **envp)
|
||||
(void)corosync_move_to_root_cgroup();
|
||||
}
|
||||
|
||||
sched_rr = 1;
|
||||
if (icmap_get_string("system.sched_rr", &tmp_str) == CS_OK) {
|
||||
if (strcmp(tmp_str, "yes") != 0) {
|
||||
sched_rr = 0;
|
||||
}
|
||||
free(tmp_str);
|
||||
}
|
||||
|
||||
prio = 0;
|
||||
if (icmap_get_string("system.priority", &tmp_str) == CS_OK) {
|
||||
if (strcmp(tmp_str, "max") == 0) {
|
||||
prio = INT_MIN;
|
||||
} else if (strcmp(tmp_str, "min") == 0) {
|
||||
prio = INT_MAX;
|
||||
} else {
|
||||
errno = 0;
|
||||
|
||||
tmpli = strtol(tmp_str, &ep, 10);
|
||||
if (errno != 0 || *ep != '\0' || tmpli > INT_MAX || tmpli < INT_MIN) {
|
||||
log_printf (LOGSYS_LEVEL_ERROR, "Priority value %s is invalid", tmp_str);
|
||||
corosync_exit_error (COROSYNC_DONE_MAINCONFIGREAD);
|
||||
}
|
||||
|
||||
prio = tmpli;
|
||||
}
|
||||
|
||||
free(tmp_str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set round robin realtime scheduling with priority 99
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"/*
|
||||
.\" * Copyright (C) 2010-2017 Red Hat, Inc.
|
||||
.\" * Copyright (C) 2010-2018 Red Hat, Inc.
|
||||
.\" *
|
||||
.\" * All rights reserved.
|
||||
.\" *
|
||||
@ -31,11 +31,11 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH COROSYNC 8 2018-08-14
|
||||
.TH COROSYNC 8 2018-11-12
|
||||
.SH NAME
|
||||
corosync \- The Corosync Cluster Engine.
|
||||
.SH SYNOPSIS
|
||||
.B "corosync [\-f] [\-P num] [\-p] [\-r] [-R] [\-t] [\-v]"
|
||||
.B "corosync [\-f] [\-t] [\-v]"
|
||||
.SH DESCRIPTION
|
||||
.B corosync
|
||||
Corosync provides clustering infrastructure such as membership, messaging and quorum.
|
||||
@ -44,30 +44,6 @@ Corosync provides clustering infrastructure such as membership, messaging and qu
|
||||
.B -f
|
||||
Start application in foreground.
|
||||
.TP
|
||||
.B -p
|
||||
Do not set realtime scheduling.
|
||||
.TP
|
||||
.B -P
|
||||
Set priority of process. Has effect only when
|
||||
.B -r
|
||||
is not used. Can be ether numeric value with similar meaning as
|
||||
.BR nice (1)
|
||||
or
|
||||
.B max
|
||||
/
|
||||
.B min
|
||||
meaning maximal / minimal priority (so minimal / maximal nice value).
|
||||
.TP
|
||||
.B -r
|
||||
Set round robin realtime scheduling with maximal priority (default). When setting
|
||||
of scheduler fails, fallback to set maximal priority.
|
||||
.TP
|
||||
.B -R
|
||||
Do not try to move Corosync to root cpu cgroup. This feature is available only
|
||||
for cgroups with RT sched enabled systems (Linux with
|
||||
CONFIG_RT_GROUP_SCHED kernel option). It's also expected to be removed as soon as
|
||||
systemd gets support for managing RT configuration.
|
||||
.TP
|
||||
.B -t
|
||||
Test configuration and then exit.
|
||||
.TP
|
||||
|
@ -32,7 +32,7 @@
|
||||
.\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" * THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\" */
|
||||
.TH COROSYNC_CONF 5 2018-10-26 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.TH COROSYNC_CONF 5 2018-11-12 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
|
||||
.SH NAME
|
||||
corosync.conf - corosync executive configuration file
|
||||
|
||||
@ -58,8 +58,8 @@ This top level directive contains configuration options for quorum.
|
||||
nodelist { }
|
||||
This top level directive contains configuration options for nodes in cluster.
|
||||
.TP
|
||||
qb { }
|
||||
This top level directive contains configuration options related to libqb.
|
||||
system { }
|
||||
This top level directive contains configuration options related to system.
|
||||
.TP
|
||||
resources { }
|
||||
This top level directive contains configuration options for resources.
|
||||
@ -691,17 +691,40 @@ in this process. Option is not used by Corosync itself.
|
||||
|
||||
.PP
|
||||
Within the
|
||||
.B qb
|
||||
directive it is possible to specify options for libqb.
|
||||
.B system
|
||||
directive it is possible to specify system options.
|
||||
|
||||
Possible option is:
|
||||
Possible options are:
|
||||
.TP
|
||||
ipc_type
|
||||
qb_ipc_type
|
||||
This specifies type of IPC to use. Can be one of native (default), shm and socket.
|
||||
Native means one of shm or socket, depending on what is supported by OS. On systems
|
||||
with support for both, SHM is selected. SHM is generally faster, but need to allocate
|
||||
ring buffer file in /dev/shm.
|
||||
|
||||
.TP
|
||||
sched_rr
|
||||
Should be set to yes (default) if corosync should try to set round robin realtime
|
||||
scheduling with maximal priority to itself. When setting of scheduler fails, fallback to set
|
||||
maximal priority.
|
||||
|
||||
.TP
|
||||
priority
|
||||
Set priority of corosync process. Valid only when sched_rr is set to no.
|
||||
Can be ether numeric value with similar meaning as
|
||||
.BR nice (1)
|
||||
or
|
||||
.B max
|
||||
/
|
||||
.B min
|
||||
meaning maximal / minimal priority (so minimal / maximal nice value).
|
||||
|
||||
.TP
|
||||
move_to_root_cgroup
|
||||
Should be set to yes (default) if corosync should try to move itself to root
|
||||
cgroup. This feature is available only for systems with cgroups with RT
|
||||
sched enabled (Linux with CONFIG_RT_GROUP_SCHED kernel option).
|
||||
|
||||
.PP
|
||||
Within the
|
||||
.B resources
|
||||
|
Loading…
Reference in New Issue
Block a user