feat(controller): wire real limits.yaml config through cluster_config

xcesched_push_configs() sent two hardcoded limit1/limits2 test
literals to the scheduler (behind a #if 0/FIXME "we use builtin limit
currently"), ignoring whatever was actually loaded from cluster_config.
Migrate those literals into limits.yaml as real entries and wire
conf4sched->nlimits/limits from c->myconf->cluster_config directly.

cluster_init_phase2 also downgrades its "cluster_config not loaded"
ERROR to INFO — a standby legitimately reaching phase2 before the
primary's config-push has delivered bytes yet is normal cold-boot
behavior, not a failure; it already matches load_primary_config's
INFO-level framing for the same condition.
This commit is contained in:
Rongsong Shen 2026-07-23 04:24:01 +00:00
parent 0649e17f62
commit 18e7a0e9e1
3 changed files with 45 additions and 49 deletions

View file

@ -47,3 +47,33 @@ limits:
- normal
resname: slots
value: 8
# migrated from src/controller/sched.c xcesched_push_configs()'s
# hardcoded limit1_config literal (all users except rshen, shared
# 3-slot cap)
- name: limit1
users:
members:
- all
exclude_members:
- rshen
resname: slots
value: 3.0
# migrated from src/controller/sched.c xcesched_push_configs()'s
# hardcoded limit2_config literal (rshen on the xce queue, per-user/
# per-queue/per-project/per-host 20% mem cap)
- name: limits2
per_user: true
per_queue: true
per_project: true
per_host: true
users:
members:
- rshen
queues:
members:
- xce
resname: mem
value: 0.2
percent: true

View file

@ -1303,7 +1303,14 @@ int cluster_init_phase2(cluster_t* c)
return -EINVAL;
if (c->myconf->cluster_config == NULL) {
ERROR("cluster_init_phase2: cluster_config not loaded");
/* Normal during cold boot: a standby reaches phase2 (post-election)
* before the primary's config-push has delivered bytes yet. Not a
* divergence or a hard failure — matches load_primary_config's own
* "will fetch from primary after election" INFO-level framing for
* the same underlying condition. The caller retries. */
INFO("cluster_init_phase2: cluster_config not loaded yet — normal "
"during cold boot while awaiting the primary's config-push; "
"will retry once it arrives");
return -EINVAL;
}

View file

@ -138,47 +138,11 @@ static int xcesched_push_workerlist(cluster_t* c, xlist_t* l)
static int xcesched_push_configs(cluster_t* c)
{
xce_configdata_t configdata;
int rc = 0;
xce_limit_config_t limit1_config = {
.name = "limit1",
.per_user = 0,
.per_queue = 0,
.per_project = 0,
.per_host = 0,
.users
= &(xce_group_config_t) { .members
= { .count = 1, .data = (char*[]) { "all" } },
.ex_members
= { .count = 1,
.data = (char*[]) { "rshen" } } },
.queues = NULL,
.projects = NULL,
.hosts = NULL,
.val
= &(xce_limit_val_t) { .resname = "slots", .percent = 0, .val = 3.0 }
};
xce_limit_config_t limit2_config = {
.name = "limits2",
.per_user = 1,
.per_queue = 1,
.per_project = 1,
.per_host = 1,
.users = &(xce_group_config_t) { .members
= { .count = 1,
.data = (char*[]) { "rshen" } } },
.queues
= &(xce_group_config_t) { .members = { .count = 1,
.data = (char*[]) { "xce" } } },
.projects = NULL,
.hosts = NULL,
.val = &(xce_limit_val_t) { .resname = "mem", .percent = 1, .val = 0.2 }
};
xce_limit_config_t* limits[] = { &limit1_config, &limit2_config };
int nlimits = 2;
xlist_t clist;
xlist_t qlist;
xlist_t rlist;
xlist_t xreslist;
int rc = 0;
xlist_t clist;
xlist_t qlist;
xlist_t rlist;
xlist_t xreslist;
memset(&configdata, 0x0, sizeof(configdata));
@ -209,13 +173,8 @@ static int xcesched_push_configs(cluster_t* c)
configdata.data.conf4sched->ugroups = c->myconf->cluster_config->ugroups;
configdata.data.conf4sched->n_hgroups = c->myconf->cluster_config->nhgroups;
configdata.data.conf4sched->hgroups = c->myconf->cluster_config->hgroups;
#if 0 /* FIXME: we use builtin limit currently */
configdata.data.conf4sched->nlimits = c->myconf->cluster_config->nlimits;
configdata.data.conf4sched->limits = c->myconf->cluster_config->limits;
#else
configdata.data.conf4sched->nlimits = nlimits;
configdata.data.conf4sched->limits = &(limits[0]);
#endif
configdata.data.conf4sched->nlimits = c->myconf->cluster_config->nlimits;
configdata.data.conf4sched->limits = c->myconf->cluster_config->limits;
configdata.data.conf4sched->nhproviders
= c->myconf->cluster_config->nhproviders;
configdata.data.conf4sched->hproviders