diff --git a/NEWS b/NEWS index 02c2d818c5..16ea1ec491 100644 --- a/NEWS +++ b/NEWS @@ -215,7 +215,7 @@ CHANGES WITH 262 in spe: Orchestrator sessions and pass them through the file descriptor store interface. - * PID 1 now exposes a new D-Bus property KExecsCount that indicates the + * PID 1 now exposes a new D-Bus property KExecCount that indicates the number of kexec reboots the system has undergone since the last real boot. It also exposes shutdown timestamps of the previous kexec cycle. (Only if LUO is available). 'systemd-analyze time' uses them diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index ab08aec354..20ed6f31bc 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -602,7 +602,7 @@ node /org/freedesktop/systemd1 { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly u SoftRebootsCount = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") - readonly u KExecsCount = ...; + readonly u KExecCount = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t ReloadCount = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") @@ -1348,7 +1348,7 @@ node /org/freedesktop/systemd1 { - + @@ -1995,7 +1995,7 @@ node /org/freedesktop/systemd1 { SoftRebootsCount encodes how many soft-reboots were successfully completed since the last full boot. Starts at 0. - KExecsCount encodes how many kexec-based live updates were successfully + KExecCount encodes how many kexec-based live updates were successfully completed since the last full boot. Starts at 0. The counter is preserved across the kexec through the Live Update Orchestrator (LUO), and is hence 0 when the kernel does not provide LUO support. @@ -12902,7 +12902,7 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \ ReloadCount, EventLoopRateLimitIntervalUSec, and EventLoopRateLimitBurst were added in version 261. - KExecsCount, + KExecCount, EnqueueUnitJobMany(), ShutdownFinishTimestamp, ShutdownFinishTimestampMonotonic, diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 24f0897da9..a91b5098dd 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -3113,7 +3113,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_PROPERTY("DefaultRestrictSUIDSGID", "b", bus_property_get_bool, offsetof(Manager, defaults.restrict_suid_sgid), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("CtrlAltDelBurstAction", "s", bus_property_get_emergency_action, offsetof(Manager, cad_burst_action), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SoftRebootsCount", "u", bus_property_get_unsigned, offsetof(Manager, soft_reboots_count), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("KExecsCount", "u", bus_property_get_unsigned, offsetof(Manager, kexecs_count), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("KExecCount", "u", bus_property_get_unsigned, offsetof(Manager, kexec_count), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("ReloadCount", "t", NULL, offsetof(Manager, reload_count), 0), SD_BUS_PROPERTY("DefaultMemoryZSwapWriteback", "b", bus_property_get_bool, offsetof(Manager, defaults.memory_zswap_writeback), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/luo.c b/src/core/luo.c index 24107256ae..ccacf8b749 100644 --- a/src/core/luo.c +++ b/src/core/luo.c @@ -106,13 +106,13 @@ int manager_luo_restore_fd_stores(Manager *m) { } struct { - unsigned kexecs_count; + unsigned kexec_count; dual_timestamp previous_shutdown_start, previous_shutdown_finish, previous_shutdown_late_start, previous_shutdown_late_finish; } state_data = {}; static const sd_json_dispatch_field state_dispatch_table[] = { - { "KExecsCount", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uint, voffsetof(state_data, kexecs_count), 0 }, + { "KExecCount", SD_JSON_VARIANT_UNSIGNED, sd_json_dispatch_uint, voffsetof(state_data, kexec_count), 0 }, { "ShutdownStartTimestamp", SD_JSON_VARIANT_OBJECT, json_dispatch_dual_timestamp, voffsetof(state_data, previous_shutdown_start), 0 }, { "ShutdownFinishTimestamp", SD_JSON_VARIANT_OBJECT, json_dispatch_dual_timestamp, voffsetof(state_data, previous_shutdown_finish), 0 }, { "ShutdownLateStartTimestamp", SD_JSON_VARIANT_OBJECT, json_dispatch_dual_timestamp, voffsetof(state_data, previous_shutdown_late_start), 0 }, @@ -122,7 +122,7 @@ int manager_luo_restore_fd_stores(Manager *m) { r = sd_json_dispatch(q.state, state_dispatch_table, SD_JSON_ALLOW_EXTENSIONS|SD_JSON_LOG, &state_data); if (r >= 0) { - m->kexecs_count = state_data.kexecs_count; + m->kexec_count = state_data.kexec_count; m->timestamps[MANAGER_TIMESTAMP_PREVIOUS_SHUTDOWN_START] = state_data.previous_shutdown_start; m->timestamps[MANAGER_TIMESTAMP_PREVIOUS_SHUTDOWN_FINISH] = state_data.previous_shutdown_finish; m->timestamps[MANAGER_TIMESTAMP_PREVIOUS_SHUTDOWN_LATE_START] = state_data.previous_shutdown_late_start; @@ -130,7 +130,7 @@ int manager_luo_restore_fd_stores(Manager *m) { } /* If we found a LUO session then by definition we have just successfully kexec rebooted */ - (void) INC_SAFE(&m->kexecs_count, 1); + (void) INC_SAFE(&m->kexec_count, 1); /* Retrieve all fds from the session and dispatch each to the named unit, eagerly loading the * unit if necessary. */ @@ -318,7 +318,7 @@ int manager_luo_serialize_fd_stores(Manager *m, FILE **ret_f, FDSet **ret_fds) { SD_JSON_BUILD_PAIR_UNSIGNED("version", LUO_PROTOCOL_VERSION), SD_JSON_BUILD_PAIR("state", SD_JSON_BUILD_OBJECT( - SD_JSON_BUILD_PAIR_UNSIGNED("KExecsCount", m->kexecs_count), + SD_JSON_BUILD_PAIR_UNSIGNED("KExecCount", m->kexec_count), JSON_BUILD_PAIR_DUAL_TIMESTAMP_NON_NULL("ShutdownStartTimestamp", &m->timestamps[MANAGER_TIMESTAMP_SHUTDOWN_START]), JSON_BUILD_PAIR_DUAL_TIMESTAMP_NON_NULL("ShutdownFinishTimestamp", &m->timestamps[MANAGER_TIMESTAMP_SHUTDOWN_FINISH]))), SD_JSON_BUILD_PAIR_CONDITION(!!units, "units", SD_JSON_BUILD_VARIANT(units))); diff --git a/src/core/manager-serialize.c b/src/core/manager-serialize.c index 7a3d879bc3..9fe7008f38 100644 --- a/src/core/manager-serialize.c +++ b/src/core/manager-serialize.c @@ -157,7 +157,7 @@ int manager_serialize( (void) serialize_item(f, "previous-objective", manager_objective_to_string(m->objective)); (void) serialize_item_format(f, "soft-reboots-count", "%u", m->soft_reboots_count); - (void) serialize_item_format(f, "kexecs-count", "%u", m->kexecs_count); + (void) serialize_item_format(f, "kexec-count", "%u", m->kexec_count); (void) serialize_item_format(f, "fd-store-upstream-next-index", "%" PRIu64, m->fd_store_upstream_next_index); for (ManagerTimestamp q = 0; q < _MANAGER_TIMESTAMP_MAX; q++) { @@ -805,13 +805,13 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) { log_notice("Failed to parse soft reboots counter '%s', ignoring.", val); else m->soft_reboots_count = n; - } else if ((val = startswith(l, "kexecs-count="))) { + } else if ((val = STARTSWITH_SET(l, "kexec-count=", "kexecs-count="))) { unsigned n; if (safe_atou(val, &n) < 0) - log_notice("Failed to parse kexecs counter '%s', ignoring.", val); + log_notice("Failed to parse kexec counter '%s', ignoring.", val); else - m->kexecs_count = n; + m->kexec_count = n; } else if ((val = startswith(l, "fd-store-upstream-next-index="))) { if (safe_atou64(val, &m->fd_store_upstream_next_index) < 0) log_notice("Failed to parse fd-store-upstream-next-index '%s', ignoring.", val); diff --git a/src/core/manager.h b/src/core/manager.h index f3db614b02..6ccbd90c7d 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -537,7 +537,7 @@ typedef struct Manager { unsigned soft_reboots_count; /* When LUO is enabled we can count consecutive kexec reboots. */ - unsigned kexecs_count; + unsigned kexec_count; /* The number of successfully completed configuration reloads. */ uint64_t reload_count; diff --git a/src/core/varlink-manager.c b/src/core/varlink-manager.c index 6855ee7553..c38433fcb0 100644 --- a/src/core/varlink-manager.c +++ b/src/core/varlink-manager.c @@ -199,7 +199,7 @@ static int manager_runtime_build_json(sd_json_variant **ret, const char *name, v SD_JSON_BUILD_PAIR_STRING("SystemState", manager_state_to_string(manager_state(m))), SD_JSON_BUILD_PAIR_UNSIGNED("ExitCode", m->return_value), SD_JSON_BUILD_PAIR_UNSIGNED("SoftRebootsCount", m->soft_reboots_count), - SD_JSON_BUILD_PAIR_UNSIGNED("KExecsCount", m->kexecs_count), + SD_JSON_BUILD_PAIR_UNSIGNED("KExecCount", m->kexec_count), SD_JSON_BUILD_PAIR_UNSIGNED("ReloadCount", m->reload_count)); } diff --git a/src/shared/varlink-io.systemd.Manager.c b/src/shared/varlink-io.systemd.Manager.c index 7b0224323f..8c7b8c8d7e 100644 --- a/src/shared/varlink-io.systemd.Manager.c +++ b/src/shared/varlink-io.systemd.Manager.c @@ -202,7 +202,7 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE( SD_VARLINK_FIELD_COMMENT("Encodes how many soft-reboots were successfully completed"), SD_VARLINK_DEFINE_FIELD(SoftRebootsCount, SD_VARLINK_INT, 0), SD_VARLINK_FIELD_COMMENT("Encodes how many consecutive kexec reboots were successfully completed since the last full boot. Zero if the Live Update Orchestrator is not available."), - SD_VARLINK_DEFINE_FIELD(KExecsCount, SD_VARLINK_INT, 0), + SD_VARLINK_DEFINE_FIELD(KExecCount, SD_VARLINK_INT, 0), SD_VARLINK_FIELD_COMMENT("Number of successfully completed configuration reloads"), SD_VARLINK_DEFINE_FIELD(ReloadCount, SD_VARLINK_INT, 0)); diff --git a/test/units/TEST-91-LIVEUPDATE.sh b/test/units/TEST-91-LIVEUPDATE.sh index 0fafb84fa5..910018b52a 100755 --- a/test/units/TEST-91-LIVEUPDATE.sh +++ b/test/units/TEST-91-LIVEUPDATE.sh @@ -78,7 +78,7 @@ if grep -qw luo_nboot=1 /proc/cmdline; then # Verify that the fd store of the main test service survived the kexec. /usr/lib/systemd/tests/unit-tests/manual/test-luo check - assert_eq "$(busctl -j get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager KExecsCount | jq -r '.data')" "1" + assert_eq "$(busctl -j get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager KExecCount | jq -r '.data')" "1" # The previous boot's shutdown timestamps were preserved across the kexec via LUO and are now exposed # as the PreviousShutdown* properties (the live Shutdown* ones describe this boot, which is not shutting