mirror of
https://github.com/systemd/systemd
synced 2025-09-29 08:44:45 +02:00
Compare commits
11 Commits
b10619484d
...
ebcb0a07d3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ebcb0a07d3 | ||
![]() |
0c7764f2a7 | ||
![]() |
4abf3694dd | ||
![]() |
d8af104fb0 | ||
![]() |
2985840855 | ||
![]() |
13852e1914 | ||
![]() |
df25e4af16 | ||
![]() |
2ce397125f | ||
![]() |
f36f374447 | ||
![]() |
83cfc45dfb | ||
![]() |
ce631ae3d9 |
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
@ -195,7 +195,7 @@ run:
|
|||||||
- any-glob-to-any-file: ['src/run/*', 'man/systemd-run*']
|
- any-glob-to-any-file: ['src/run/*', 'man/systemd-run*']
|
||||||
sd-boot/sd-stub/bootctl:
|
sd-boot/sd-stub/bootctl:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file: ['src/boot/**/*', 'man/bootctl*', 'man/systemd-boot.xml']
|
- any-glob-to-any-file: ['src/boot/**/*', 'src/bootctl/*', 'man/bootctl*', 'man/systemd-boot.xml']
|
||||||
sd-bus:
|
sd-bus:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file: '**/sd-bus*/**'
|
- any-glob-to-any-file: '**/sd-bus*/**'
|
||||||
|
@ -21,6 +21,7 @@ VolatilePackages=
|
|||||||
systemd-doc
|
systemd-doc
|
||||||
systemd-experimental
|
systemd-experimental
|
||||||
systemd-homed
|
systemd-homed
|
||||||
|
systemd-journal-remote
|
||||||
systemd-lang
|
systemd-lang
|
||||||
systemd-networkd
|
systemd-networkd
|
||||||
systemd-portable
|
systemd-portable
|
||||||
|
@ -69,16 +69,18 @@ static int build_managed_oom_json_array_element(Unit *u, const char *property, s
|
|||||||
SD_JSON_BUILD_PAIR_CONDITION(use_duration, "duration", SD_JSON_BUILD_UNSIGNED(c->moom_mem_pressure_duration_usec)));
|
SD_JSON_BUILD_PAIR_CONDITION(use_duration, "duration", SD_JSON_BUILD_UNSIGNED(c->moom_mem_pressure_duration_usec)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int build_managed_oom_cgroups_json(Manager *m, sd_json_variant **ret) {
|
static int build_managed_oom_cgroups_json(Manager *m, bool allow_empty, sd_json_variant **ret) {
|
||||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL, *arr = NULL;
|
_cleanup_(sd_json_variant_unrefp) sd_json_variant *arr = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
assert(ret);
|
assert(ret);
|
||||||
|
|
||||||
r = sd_json_build(&arr, SD_JSON_BUILD_EMPTY_ARRAY);
|
if (allow_empty) {
|
||||||
if (r < 0)
|
r = sd_json_build(&arr, SD_JSON_BUILD_EMPTY_ARRAY);
|
||||||
return r;
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
for (UnitType t = 0; t < _UNIT_TYPE_MAX; t++) {
|
for (UnitType t = 0; t < _UNIT_TYPE_MAX; t++) {
|
||||||
|
|
||||||
@ -95,6 +97,10 @@ static int build_managed_oom_cgroups_json(Manager *m, sd_json_variant **ret) {
|
|||||||
if (!c)
|
if (!c)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
CGroupRuntime *crt = unit_get_cgroup_runtime(u);
|
||||||
|
if (!crt || !crt->cgroup_path)
|
||||||
|
continue;
|
||||||
|
|
||||||
FOREACH_ELEMENT(i, managed_oom_mode_properties) {
|
FOREACH_ELEMENT(i, managed_oom_mode_properties) {
|
||||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *e = NULL;
|
_cleanup_(sd_json_variant_unrefp) sd_json_variant *e = NULL;
|
||||||
|
|
||||||
@ -115,12 +121,17 @@ static int build_managed_oom_cgroups_json(Manager *m, sd_json_variant **ret) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
r = sd_json_buildo(&v, SD_JSON_BUILD_PAIR("cgroups", SD_JSON_BUILD_VARIANT(arr)));
|
if (!arr) {
|
||||||
|
assert(!allow_empty);
|
||||||
|
*ret = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = sd_json_buildo(ret, SD_JSON_BUILD_PAIR("cgroups", SD_JSON_BUILD_VARIANT(arr)));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
*ret = TAKE_PTR(v);
|
return 1;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int manager_varlink_send_managed_oom_initial(Manager *m) {
|
static int manager_varlink_send_managed_oom_initial(Manager *m) {
|
||||||
@ -137,8 +148,8 @@ static int manager_varlink_send_managed_oom_initial(Manager *m) {
|
|||||||
|
|
||||||
assert(m->managed_oom_varlink);
|
assert(m->managed_oom_varlink);
|
||||||
|
|
||||||
r = build_managed_oom_cgroups_json(m, &v);
|
r = build_managed_oom_cgroups_json(m, /* allow_empty = */ false, &v);
|
||||||
if (r < 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
return sd_varlink_send(m->managed_oom_varlink, "io.systemd.oom.ReportManagedOOMCGroups", v);
|
return sd_varlink_send(m->managed_oom_varlink, "io.systemd.oom.ReportManagedOOMCGroups", v);
|
||||||
@ -247,9 +258,11 @@ int manager_varlink_send_managed_oom_update(Unit *u) {
|
|||||||
if (!c)
|
if (!c)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = sd_json_build(&arr, SD_JSON_BUILD_EMPTY_ARRAY);
|
if (MANAGER_IS_SYSTEM(u->manager)) {
|
||||||
if (r < 0)
|
r = sd_json_build(&arr, SD_JSON_BUILD_EMPTY_ARRAY);
|
||||||
return r;
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
FOREACH_ELEMENT(i, managed_oom_mode_properties) {
|
FOREACH_ELEMENT(i, managed_oom_mode_properties) {
|
||||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *e = NULL;
|
_cleanup_(sd_json_variant_unrefp) sd_json_variant *e = NULL;
|
||||||
@ -263,6 +276,12 @@ int manager_varlink_send_managed_oom_update(Unit *u) {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!arr) {
|
||||||
|
/* There is nothing updated. Skip calling method. */
|
||||||
|
assert(!MANAGER_IS_SYSTEM(u->manager));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_json_buildo(&v, SD_JSON_BUILD_PAIR("cgroups", SD_JSON_BUILD_VARIANT(arr)));
|
r = sd_json_buildo(&v, SD_JSON_BUILD_PAIR("cgroups", SD_JSON_BUILD_VARIANT(arr)));
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
@ -316,7 +335,7 @@ static int vl_method_subscribe_managed_oom_cgroups(
|
|||||||
|
|
||||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
|
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL;
|
||||||
|
|
||||||
r = build_managed_oom_cgroups_json(m, &v);
|
r = build_managed_oom_cgroups_json(m, /* allow_empty = */ true, &v);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ int manager_serialize(Manager *manager) {
|
|||||||
|
|
||||||
if (!v) {
|
if (!v) {
|
||||||
log_debug("There is nothing to serialize.");
|
log_debug("There is nothing to serialize.");
|
||||||
|
(void) notify_remove_fd_warn("manager-serialization");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -687,10 +687,19 @@ static int get_glinksettings(int fd, struct ifreq *ifr, union ethtool_link_usett
|
|||||||
if (ecmd.base.link_mode_masks_nwords <= 0 || ecmd.base.cmd != ETHTOOL_GLINKSETTINGS)
|
if (ecmd.base.link_mode_masks_nwords <= 0 || ecmd.base.cmd != ETHTOOL_GLINKSETTINGS)
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
union ethtool_link_usettings *u = newdup(union ethtool_link_usettings, &ecmd, 1);
|
union ethtool_link_usettings *u = new0(union ethtool_link_usettings, 1);
|
||||||
if (!u)
|
if (!u)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
u->base = ecmd.base;
|
||||||
|
|
||||||
|
uint32_t *p = ecmd.base.link_mode_masks;
|
||||||
|
memcpy(u->link_modes.supported, p, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
p += ecmd.base.link_mode_masks_nwords;
|
||||||
|
memcpy(u->link_modes.advertising, p, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
p += ecmd.base.link_mode_masks_nwords;
|
||||||
|
memcpy(u->link_modes.lp_advertising, p, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
|
||||||
*ret = u;
|
*ret = u;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -742,8 +751,14 @@ static int set_slinksettings(int fd, struct ifreq *ifr, const union ethtool_link
|
|||||||
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)
|
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
union ethtool_link_usettings ecmd = *u;
|
union ethtool_link_usettings ecmd = { .base = u->base };
|
||||||
ecmd.base.cmd = ETHTOOL_SLINKSETTINGS;
|
ecmd.base.cmd = ETHTOOL_SLINKSETTINGS;
|
||||||
|
|
||||||
|
uint32_t *p = ecmd.base.link_mode_masks;
|
||||||
|
p = mempcpy(p, u->link_modes.supported, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
p = mempcpy(p, u->link_modes.advertising, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
memcpy(p, u->link_modes.lp_advertising, sizeof(uint32_t) * ecmd.base.link_mode_masks_nwords);
|
||||||
|
|
||||||
ifr->ifr_data = (void *) &ecmd;
|
ifr->ifr_data = (void *) &ecmd;
|
||||||
|
|
||||||
return RET_NERRNO(ioctl(fd, SIOCETHTOOL, ifr));
|
return RET_NERRNO(ioctl(fd, SIOCETHTOOL, ifr));
|
||||||
|
@ -13,9 +13,27 @@ static SD_VARLINK_DEFINE_ENUM_TYPE(
|
|||||||
SD_VARLINK_FIELD_COMMENT("Automatically generated entries"),
|
SD_VARLINK_FIELD_COMMENT("Automatically generated entries"),
|
||||||
SD_VARLINK_DEFINE_ENUM_VALUE(auto));
|
SD_VARLINK_DEFINE_ENUM_VALUE(auto));
|
||||||
|
|
||||||
|
static SD_VARLINK_DEFINE_ENUM_TYPE(
|
||||||
|
BootEntrySource,
|
||||||
|
SD_VARLINK_FIELD_COMMENT("Boot entry found in EFI system partition (ESP)"),
|
||||||
|
SD_VARLINK_DEFINE_ENUM_VALUE(esp),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("Boot entry found in XBOOTLDR partition"),
|
||||||
|
SD_VARLINK_DEFINE_ENUM_VALUE(xbootldr));
|
||||||
|
|
||||||
|
static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||||
|
BootEntryAddon,
|
||||||
|
SD_VARLINK_FIELD_COMMENT("The location of the global addon."),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(globalAddon, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("The location of the local addon."),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(localAddon, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("The command line options by the addon."),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(options, SD_VARLINK_STRING, 0));
|
||||||
|
|
||||||
static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||||
BootEntry,
|
BootEntry,
|
||||||
SD_VARLINK_DEFINE_FIELD_BY_TYPE(type, BootEntryType, 0),
|
SD_VARLINK_DEFINE_FIELD_BY_TYPE(type, BootEntryType, 0),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("The source of the entry"),
|
||||||
|
SD_VARLINK_DEFINE_FIELD_BY_TYPE(source, BootEntrySource, 0),
|
||||||
SD_VARLINK_FIELD_COMMENT("The string identifier of the entry"),
|
SD_VARLINK_FIELD_COMMENT("The string identifier of the entry"),
|
||||||
SD_VARLINK_DEFINE_FIELD(id, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(id, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_FIELD(path, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(path, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
@ -41,7 +59,11 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
|||||||
SD_VARLINK_FIELD_COMMENT("Indicates whether this entry is the default entry."),
|
SD_VARLINK_FIELD_COMMENT("Indicates whether this entry is the default entry."),
|
||||||
SD_VARLINK_DEFINE_FIELD(isDefault, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_FIELD(isDefault, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_FIELD_COMMENT("Indicates whether this entry has been booted."),
|
SD_VARLINK_FIELD_COMMENT("Indicates whether this entry has been booted."),
|
||||||
SD_VARLINK_DEFINE_FIELD(isSelected, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE));
|
SD_VARLINK_DEFINE_FIELD(isSelected, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("Addon images of the entry."),
|
||||||
|
SD_VARLINK_DEFINE_FIELD_BY_TYPE(addons, BootEntryAddon, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("Command line options of the entry."),
|
||||||
|
SD_VARLINK_DEFINE_FIELD(cmdline, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
|
||||||
|
|
||||||
static SD_VARLINK_DEFINE_METHOD_FULL(
|
static SD_VARLINK_DEFINE_METHOD_FULL(
|
||||||
ListBootEntries,
|
ListBootEntries,
|
||||||
@ -71,6 +93,10 @@ SD_VARLINK_DEFINE_INTERFACE(
|
|||||||
SD_VARLINK_INTERFACE_COMMENT("Boot Loader control APIs"),
|
SD_VARLINK_INTERFACE_COMMENT("Boot Loader control APIs"),
|
||||||
SD_VARLINK_SYMBOL_COMMENT("The type of a boot entry"),
|
SD_VARLINK_SYMBOL_COMMENT("The type of a boot entry"),
|
||||||
&vl_type_BootEntryType,
|
&vl_type_BootEntryType,
|
||||||
|
SD_VARLINK_SYMBOL_COMMENT("The source of a boot entry"),
|
||||||
|
&vl_type_BootEntrySource,
|
||||||
|
SD_VARLINK_SYMBOL_COMMENT("A structure encapsulating an addon of a boot entry"),
|
||||||
|
&vl_type_BootEntryAddon,
|
||||||
SD_VARLINK_SYMBOL_COMMENT("A structure encapsulating a boot entry"),
|
SD_VARLINK_SYMBOL_COMMENT("A structure encapsulating a boot entry"),
|
||||||
&vl_type_BootEntry,
|
&vl_type_BootEntry,
|
||||||
SD_VARLINK_SYMBOL_COMMENT("Enumerates boot entries. Method call must be called with 'more' flag set. Each response returns one entry. If no entries are defined returns the NoSuchBootEntry error."),
|
SD_VARLINK_SYMBOL_COMMENT("Enumerates boot entries. Method call must be called with 'more' flag set. Each response returns one entry. If no entries are defined returns the NoSuchBootEntry error."),
|
||||||
|
@ -13,6 +13,8 @@ static SD_VARLINK_DEFINE_METHOD(
|
|||||||
SD_VARLINK_DEFINE_OUTPUT(HostnameSource, SD_VARLINK_STRING, 0),
|
SD_VARLINK_DEFINE_OUTPUT(HostnameSource, SD_VARLINK_STRING, 0),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(IconName, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(IconName, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(Chassis, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(Chassis, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_FIELD_COMMENT("An unique identifier of the system chassis."),
|
||||||
|
SD_VARLINK_DEFINE_OUTPUT(ChassisAssetTag, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(Deployment, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(Deployment, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(Location, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(Location, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(KernelName, SD_VARLINK_STRING, 0),
|
SD_VARLINK_DEFINE_OUTPUT(KernelName, SD_VARLINK_STRING, 0),
|
||||||
@ -23,6 +25,8 @@ static SD_VARLINK_DEFINE_METHOD(
|
|||||||
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemHomeURL, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemHomeURL, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemSupportEnd, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemSupportEnd, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemReleaseData, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemReleaseData, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||||
|
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemImageID, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||||
|
SD_VARLINK_DEFINE_OUTPUT(OperatingSystemImageVersion, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(MachineInformationData, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
SD_VARLINK_DEFINE_OUTPUT(MachineInformationData, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(HardwareVendor, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(HardwareVendor, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(HardwareModel, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(HardwareModel, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
@ -35,9 +39,7 @@ static SD_VARLINK_DEFINE_METHOD(
|
|||||||
SD_VARLINK_DEFINE_OUTPUT(MachineID, SD_VARLINK_STRING, 0),
|
SD_VARLINK_DEFINE_OUTPUT(MachineID, SD_VARLINK_STRING, 0),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(BootID, SD_VARLINK_STRING, 0),
|
SD_VARLINK_DEFINE_OUTPUT(BootID, SD_VARLINK_STRING, 0),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(ProductUUID, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(ProductUUID, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||||
SD_VARLINK_DEFINE_OUTPUT(VSockCID, SD_VARLINK_INT, SD_VARLINK_NULLABLE),
|
SD_VARLINK_DEFINE_OUTPUT(VSockCID, SD_VARLINK_INT, SD_VARLINK_NULLABLE));
|
||||||
SD_VARLINK_FIELD_COMMENT("An unique identifier of the system chassis."),
|
|
||||||
SD_VARLINK_DEFINE_OUTPUT(ChassisAssetTag, SD_VARLINK_STRING, SD_VARLINK_NULLABLE));
|
|
||||||
|
|
||||||
SD_VARLINK_DEFINE_INTERFACE(
|
SD_VARLINK_DEFINE_INTERFACE(
|
||||||
io_systemd_Hostname,
|
io_systemd_Hostname,
|
||||||
|
@ -8,6 +8,7 @@ After=basic.target network.target @after@
|
|||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=rm -f /failed /testok
|
ExecStartPre=rm -f /failed /testok
|
||||||
ExecStart=@command@
|
ExecStart=@command@
|
||||||
|
ExecStartPost=/usr/lib/systemd/tests/testdata/units/post.sh
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
MemoryAccounting=@memory-accounting@
|
MemoryAccounting=@memory-accounting@
|
||||||
Environment=SYSTEMD_PAGER= @env@
|
Environment=SYSTEMD_PAGER= @env@
|
||||||
|
@ -379,7 +379,7 @@ varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.List
|
|||||||
|
|
||||||
# test io.systemd.Machine.Open
|
# test io.systemd.Machine.Open
|
||||||
|
|
||||||
# Reducing log level here is to work-around check in end.service (end.sh). Read https://github.com/systemd/systemd/pull/34867 for more details
|
# Reducing log level here is to work-around check in post.sh. Read https://github.com/systemd/systemd/pull/34867 for more details
|
||||||
systemctl service-log-level systemd-machined info
|
systemctl service-log-level systemd-machined info
|
||||||
(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host"}')
|
(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host"}')
|
||||||
(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": ""}')
|
(! varlinkctl call /run/systemd/machine/io.systemd.Machine io.systemd.Machine.Open '{"name": ".host", "mode": ""}')
|
||||||
|
@ -14,24 +14,6 @@ if [[ ! -v ASAN_OPTIONS && ! -v UBSAN_OPTIONS && "${TEST_RUN_DFUZZER:-0}" == "0"
|
|||||||
exit 77
|
exit 77
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Save the end.service state before we start fuzzing, as it might get changed
|
|
||||||
# on the fly by one of the fuzzers
|
|
||||||
systemctl list-jobs | grep -F 'end.service' && SHUTDOWN_AT_EXIT=1 || SHUTDOWN_AT_EXIT=0
|
|
||||||
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
at_exit() {
|
|
||||||
set +e
|
|
||||||
# We have to call the end.service/poweroff explicitly even if it's specified on
|
|
||||||
# the kernel cmdline via systemd.wants=end.service, since dfuzzer calls
|
|
||||||
# org.freedesktop.systemd1.Manager.ClearJobs() which drops the service
|
|
||||||
# from the queue
|
|
||||||
if [[ $SHUTDOWN_AT_EXIT -ne 0 ]] && ! systemctl poweroff; then
|
|
||||||
# PID1 is down let's try to save the journal
|
|
||||||
journalctl --sync # journal can be down as well so let's ignore exit codes here
|
|
||||||
systemctl -ff poweroff # sync() and reboot(RB_POWER_OFF)
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
add_suppression() {
|
add_suppression() {
|
||||||
local interface="${1:?}"
|
local interface="${1:?}"
|
||||||
local suppression="${2:?}"
|
local suppression="${2:?}"
|
||||||
@ -39,8 +21,6 @@ add_suppression() {
|
|||||||
sed -i "\%\[$interface\]%a$suppression" /etc/dfuzzer.conf
|
sed -i "\%\[$interface\]%a$suppression" /etc/dfuzzer.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
trap at_exit EXIT
|
|
||||||
|
|
||||||
systemctl log-level info
|
systemctl log-level info
|
||||||
|
|
||||||
# Skip calling start and stop methods on unit objects, as doing that is not only time consuming, but it also
|
# Skip calling start and stop methods on unit objects, as doing that is not only time consuming, but it also
|
||||||
|
@ -167,7 +167,7 @@ done
|
|||||||
(! varlinkctl call "")
|
(! varlinkctl call "")
|
||||||
(! varlinkctl call "" "")
|
(! varlinkctl call "" "")
|
||||||
(! varlinkctl call "" "" "")
|
(! varlinkctl call "" "" "")
|
||||||
(! varlinkctl call /run/systemd/userdb/io.systemd.Multiplexer io.systemd.UserDatabase.GetUserRecord </dev/null)
|
(! varlinkctl call /run/systemd/userdb/io.systemd.Multiplexer io.systemd.UserDatabase.GetUserRecord '{ "service" : "io.systemd.ShouldNotExist" }')
|
||||||
(! varlinkctl validate-idl "")
|
(! varlinkctl validate-idl "")
|
||||||
(! varlinkctl validate-idl </dev/null)
|
(! varlinkctl validate-idl </dev/null)
|
||||||
|
|
||||||
|
@ -6,19 +6,6 @@ set -o pipefail
|
|||||||
# shellcheck source=test/units/util.sh
|
# shellcheck source=test/units/util.sh
|
||||||
. "$(dirname "$0")"/util.sh
|
. "$(dirname "$0")"/util.sh
|
||||||
|
|
||||||
at_exit() {
|
|
||||||
# Since the soft-reboot drops the enqueued end.service, we won't shutdown
|
|
||||||
# the test VM if the test fails and have to wait for the watchdog to kill
|
|
||||||
# us (which may take quite a long time). Let's just forcibly kill the machine
|
|
||||||
# instead to save CI resources.
|
|
||||||
if [[ $? -ne 0 ]]; then
|
|
||||||
echo >&2 "Test failed, shutting down the machine..."
|
|
||||||
systemctl poweroff -ff
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
trap at_exit EXIT
|
|
||||||
|
|
||||||
# Because this test tests soft-reboot, we have to get rid of the symlink we put at
|
# Because this test tests soft-reboot, we have to get rid of the symlink we put at
|
||||||
# /run/nextroot to allow rebooting into the previous snapshot if the test fails for
|
# /run/nextroot to allow rebooting into the previous snapshot if the test fails for
|
||||||
# the duration of the test. However, let's make sure we put the symlink back in place
|
# the duration of the test. However, let's make sure we put the symlink back in place
|
||||||
@ -272,7 +259,7 @@ exec -a @sleep sleep infinity
|
|||||||
EOF
|
EOF
|
||||||
chmod +x "$survive_argv"
|
chmod +x "$survive_argv"
|
||||||
# This sets DefaultDependencies=no so that they remain running until the very end, and
|
# This sets DefaultDependencies=no so that they remain running until the very end, and
|
||||||
# IgnoreOnIsolate=yes so that they aren't stopped via the "testsuite.target" isolation we do on next boot,
|
# IgnoreOnIsolate=yes so that they aren't stopped via isolation on next boot,
|
||||||
# and will be killed by the final sigterm/sigkill spree.
|
# and will be killed by the final sigterm/sigkill spree.
|
||||||
systemd-run --collect --service-type=notify -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=TEST-82-SOFTREBOOT-nosurvive-sigterm.service "$survive_sigterm"
|
systemd-run --collect --service-type=notify -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=TEST-82-SOFTREBOOT-nosurvive-sigterm.service "$survive_sigterm"
|
||||||
systemd-run --collect --service-type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes -p SetCredential=gone:hoge --unit=TEST-82-SOFTREBOOT-nosurvive.service sleep infinity
|
systemd-run --collect --service-type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes -p SetCredential=gone:hoge --unit=TEST-82-SOFTREBOOT-nosurvive.service sleep infinity
|
||||||
|
@ -72,6 +72,8 @@ check_sd() {
|
|||||||
|
|
||||||
# Copy the unit in /run so systemd finds it after the downgrade
|
# Copy the unit in /run so systemd finds it after the downgrade
|
||||||
cp /usr/lib/systemd/tests/testdata/units/TEST-88-UPGRADE.service /run/systemd/system
|
cp /usr/lib/systemd/tests/testdata/units/TEST-88-UPGRADE.service /run/systemd/system
|
||||||
|
# Also backup post.sh
|
||||||
|
cp /usr/lib/systemd/tests/testdata/units/post.sh /tmp/.
|
||||||
|
|
||||||
now=$(date +%s)
|
now=$(date +%s)
|
||||||
after_2h=$((now + 3600 * 2))
|
after_2h=$((now + 3600 * 2))
|
||||||
@ -105,4 +107,8 @@ dnf -y upgrade --disablerepo '*' "$pkgdir"/devel/*.rpm
|
|||||||
# TODO: sanity checks
|
# TODO: sanity checks
|
||||||
check_sd
|
check_sd
|
||||||
|
|
||||||
|
# Restore post.sh
|
||||||
|
mkdir -p /usr/lib/systemd/tests/testdata/units
|
||||||
|
mv /tmp/post.sh /usr/lib/systemd/tests/testdata/units/.
|
||||||
|
|
||||||
touch /testok
|
touch /testok
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
[Unit]
|
|
||||||
Description=End the test
|
|
||||||
After=testsuite.target
|
|
||||||
OnFailure=poweroff.target
|
|
||||||
OnFailureJobMode=replace-irreversibly
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=/usr/lib/systemd/tests/testdata/units/end.sh
|
|
||||||
TimeoutStartSec=5m
|
|
@ -1,6 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
|
||||||
set -eux
|
set -eux
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
@ -12,6 +11,3 @@ set -o pipefail
|
|||||||
# Check if sd-executor doesn't complain about not being able to (de)serialize stuff
|
# Check if sd-executor doesn't complain about not being able to (de)serialize stuff
|
||||||
(! journalctl -q -o short-monotonic --grep "[F]ailed to parse serialized line" >>/failed)
|
(! journalctl -q -o short-monotonic --grep "[F]ailed to parse serialized line" >>/failed)
|
||||||
(! journalctl -q -o short-monotonic --grep "[F]ailed to (de)?serialize \w+" >>/failed)
|
(! journalctl -q -o short-monotonic --grep "[F]ailed to (de)?serialize \w+" >>/failed)
|
||||||
|
|
||||||
systemctl poweroff --no-block
|
|
||||||
exit 0
|
|
@ -1,7 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
||||||
[Unit]
|
|
||||||
Description=Testsuite target
|
|
||||||
Requires=multi-user.target
|
|
||||||
After=multi-user.target
|
|
||||||
Conflicts=rescue.target
|
|
||||||
AllowIsolate=yes
|
|
Loading…
x
Reference in New Issue
Block a user