core: add method to enqueue multiple jobs in a single call (#42182)

Currently only a single job for a single unit can be enqueued
atomically,
so there is no guarantee that, e.g., starting a unit and its socket
at the same time will happen in the same transaction. That forces
callers to 'know' the right order in which to start new units being
installed, or failures will occur. It also means some ordering
constraints are ignored, in case the separate calls are done
in the wrong manual order.

Add a new EnqueueUnitJobMany() D-Bus method that takes a list of units
to start.
This commit is contained in:
Luca Boccassi
2026-06-22 21:35:17 +01:00
committed by GitHub
12 changed files with 1042 additions and 60 deletions
+7
View File
@@ -418,6 +418,13 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<listitem>
<para>Start (activate) one or more units specified on the command line.</para>
<para>When more than one unit is specified, the units are enqueued in a single job transaction.
This ensures that ordering dependencies (<varname>After=</varname>/<varname>Before=</varname>)
configured between the listed units are honored, regardless of the order in which they are given
on the command line. The same applies to <command>stop</command>, <command>restart</command> and
the reload/restart variants below. If a single transaction cannot be put together, separate
transactions will be submitted separately instead as a fallback.</para>
<para>Note that unit glob patterns expand to names of units currently in memory. Units which are
not active and are not in a failed state usually are not in memory, and will not be matched by
any pattern. In addition, in case of instantiated units, systemd is often unaware of the instance