fix: spurious errors/warnings from a pc13v HA deploy (bug-1872..1877)
- bug-1872 (worker): "Failed to find any disk statistics in /proc/diskstats" ERROR every 15 s on an NVMe-only host. The whole-disk filter guessed from the name and skipped anything ending in a digit or containing 'p' -- every nvmeXnY, mmcblkN, even sdp -- so io was never reported. diskstats.h now counts a device only when /sys/block/<name>/device exists (real disks; not partitions, loop, dm, md, zram), and a host with no disk warns once. - bug-1873 (worker): "Failed to get worker pid" WARN on job start. MainPID reads 0 until systemd has forked the new transient unit; xcecd.c already retries, so the miss is DEBUG and the final failure names the unit. - bug-1874 (scheduler): deprecation WARN for the legacy xce_sched_fcfs on every start, though builtin_fcfs is the picker. Registration still wraps a job_elect_fn plugin but no longer warns; selecting one warns once. - bug-1875 (apiserver): "Not running as root -- PAM authentication will not work" with the default provider config_file; now only for provider pam. - bug-1876 (controller): standbys logged "cluster_init_phase2 ... failed (rc=-22)" WARN every 3 s while waiting for the primary's config push, a state the function itself calls normal. It returns -EAGAIN for that wait; callers log it at INFO, other failures still WARN. - bug-1877 (controller): "WAL/snapshot stored unencrypted" warned without looking. persist_path_encrypted() checks fscrypt (statx) and dm-crypt (sysfs dm/uuid CRYPT-, through LVM slaves); the warning stays when the storage is not shown to be encrypted (e.g. a plain /tmp). Tests: worker diskstats_test (2 of 4 RED on the old filter with pc13v's /proc/diskstats), controller test_phase2_cold_boot and test_persist_encryption, scheduler picker tests, apiserver TestRootWarning. Full ASAN build: all 113 suites pass (controller 319/0, harness 141/0). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8cadeeb2d0
commit
44173f74ae
23 changed files with 619 additions and 63 deletions
|
|
@ -99,6 +99,12 @@ typedef struct {
|
|||
* matching) reads `core`, never `sched`, so it works identically
|
||||
* whichever registration path registered it. */
|
||||
xce_sched_core_t* core;
|
||||
/* bug-1874: set by plugin_register() when it adapted a job_elect_fn-only
|
||||
* plugin via the legacy wrapper; the deprecation is reported (once,
|
||||
* legacy_picker_warned) when such a plugin is SELECTED as the picker,
|
||||
* not merely registered. */
|
||||
int legacy_picker;
|
||||
int legacy_picker_warned;
|
||||
} xce_sched_plugin_t;
|
||||
|
||||
extern int plugin_register(void*, void*);
|
||||
|
|
|
|||
|
|
@ -146,11 +146,11 @@ int plugin_register(void* arg1, void* arg2)
|
|||
* registration time (Req 5 "Migration from old job_elect_fn"). A
|
||||
* plugin that already provides picker_iface is left untouched. */
|
||||
if ((plugin->picker_iface == NULL) && (plugin->job_elect_fn != NULL)) {
|
||||
plugin->picker_iface = &legacy_picker_wrapper_iface;
|
||||
WARN("plugin '%s' selects jobs via the deprecated job_elect_fn "
|
||||
"hook; migrate to xce_job_picker_iface_t (scheduler-core spec, "
|
||||
"Req 5 'Migration from old job_elect_fn')",
|
||||
plugin->name);
|
||||
plugin->picker_iface = &legacy_picker_wrapper_iface;
|
||||
plugin->legacy_picker = 1;
|
||||
/* bug-1874: no warning here -- the legacy "xce_sched_fcfs" is
|
||||
* registered on every start but is not the normal-mode picker;
|
||||
* sched_resolve_job_picker() warns when one is actually selected. */
|
||||
}
|
||||
|
||||
if (plugin->init_fn != NULL) {
|
||||
|
|
|
|||
|
|
@ -440,6 +440,14 @@ int sched_resolve_job_picker(xce_sched_core_t* core, xce_sched_plugin_t** out)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (plugin->legacy_picker && !plugin->legacy_picker_warned) {
|
||||
plugin->legacy_picker_warned = 1;
|
||||
WARN("job picker '%s' selects jobs via the deprecated job_elect_fn "
|
||||
"hook; migrate to xce_job_picker_iface_t (scheduler-core spec, "
|
||||
"Req 5 'Migration from old job_elect_fn')",
|
||||
plugin->name);
|
||||
}
|
||||
|
||||
*out = plugin;
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -375,6 +375,33 @@ static void test_registered_but_not_a_picker_fails_with_einval_not_enoent(void)
|
|||
TEST_ASSERT_NULL(resolved);
|
||||
}
|
||||
|
||||
/* bug-1874: plugin_register() warned about the deprecated job_elect_fn hook
|
||||
* for every legacy plugin it wrapped -- so the legacy "xce_sched_fcfs",
|
||||
* registered on every scheduler start but never the normal-mode picker
|
||||
* (builtin_fcfs is), logged a deprecation WARN on every start. The warning
|
||||
* belongs to selecting such a plugin as the picker, and only once. */
|
||||
static void
|
||||
test_legacy_picker_deprecation_flagged_on_selection_not_registration(void)
|
||||
{
|
||||
xce_scheduler_t sched;
|
||||
xce_sched_plugin_t* legacy = NULL;
|
||||
xce_sched_plugin_t* resolved = NULL;
|
||||
|
||||
fixture_init(&sched);
|
||||
legacy = make_legacy_plugin("legacy_picker_1874");
|
||||
TEST_ASSERT_GREATER_OR_EQUAL(0, plugin_register(&sched, legacy));
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(legacy->picker_iface,
|
||||
"still adapted to the picker interface");
|
||||
TEST_ASSERT_FALSE_MESSAGE(legacy->legacy_picker_warned,
|
||||
"registration alone must not warn");
|
||||
|
||||
sched.core.job_pick_plugin = "legacy_picker_1874";
|
||||
TEST_ASSERT_EQUAL_INT(0, sched_resolve_job_picker(&sched.core, &resolved));
|
||||
TEST_ASSERT_EQUAL_PTR(legacy, resolved);
|
||||
TEST_ASSERT_TRUE_MESSAGE(legacy->legacy_picker_warned,
|
||||
"selecting it as the picker warns");
|
||||
}
|
||||
|
||||
/* Unset job_pick_plugin, and the caller never called
|
||||
* sched_set_default_job_pick_plugin() either -- -EINVAL (scheduler.h's
|
||||
* documented contract), distinct from both cases above. */
|
||||
|
|
@ -504,5 +531,7 @@ int main(void)
|
|||
RUN_TEST(
|
||||
test_resolved_builtin_fcfs_has_job_elect_fn_null_selecting_native_branch);
|
||||
RUN_TEST(test_legacy_and_native_pickers_coexist_and_resolve_independently);
|
||||
RUN_TEST(
|
||||
test_legacy_picker_deprecation_flagged_on_selection_not_registration);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,10 +139,13 @@ static void legacy_plugin_init(xce_sched_plugin_t* plugin, char* name)
|
|||
}
|
||||
|
||||
/* Req 5 "Migration from old job_elect_fn": an old-style, job_elect_fn-only
|
||||
* plugin registers successfully via the compatibility wrapper and logs a
|
||||
* deprecation warning exactly once, at registration time. */
|
||||
* plugin registers successfully via the compatibility wrapper. bug-1874:
|
||||
* registration itself no longer warns -- the legacy "xce_sched_fcfs" is
|
||||
* registered on every start without being the picker; the deprecation is
|
||||
* reported when such a plugin is selected (sched_resolve_job_picker(), see
|
||||
* test_picker_wiring.c). */
|
||||
static void
|
||||
test_register_legacy_job_elect_fn_only_plugin_uses_wrapper_and_warns(void)
|
||||
test_register_legacy_job_elect_fn_only_plugin_uses_wrapper_without_warning(void)
|
||||
{
|
||||
xce_scheduler_t sched;
|
||||
xce_sched_plugin_t plugin;
|
||||
|
|
@ -156,7 +159,9 @@ test_register_legacy_job_elect_fn_only_plugin_uses_wrapper_and_warns(void)
|
|||
stop_log_capture();
|
||||
|
||||
TEST_ASSERT_GREATER_OR_EQUAL(0, rc);
|
||||
TEST_ASSERT_EQUAL_INT(1, g_warn_count);
|
||||
TEST_ASSERT_EQUAL_INT(0, g_warn_count);
|
||||
TEST_ASSERT_TRUE(plugin.legacy_picker);
|
||||
TEST_ASSERT_FALSE(plugin.legacy_picker_warned);
|
||||
TEST_ASSERT_NOT_NULL(plugin.picker_iface);
|
||||
TEST_ASSERT_EQUAL_PTR(&legacy_picker_wrapper_iface, plugin.picker_iface);
|
||||
}
|
||||
|
|
@ -243,7 +248,7 @@ int main(void)
|
|||
{
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(
|
||||
test_register_legacy_job_elect_fn_only_plugin_uses_wrapper_and_warns);
|
||||
test_register_legacy_job_elect_fn_only_plugin_uses_wrapper_without_warning);
|
||||
RUN_TEST(test_legacy_wrapper_next_job_calls_job_elect_fn);
|
||||
RUN_TEST(
|
||||
test_register_new_style_picker_plugin_skips_wrapper_and_does_not_warn);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue