[systemd-commits] 4 commits - man/systemctl.xml man/systemd.unit.xml src/core src/systemctl units/initrd-cleanup.service.in units/initrd-fs.target units/initrd-parse-etc.service.in units/initrd-root-fs.target units/initrd-switch-root.service.in units/initrd.target units/local-fs.target
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Nov 25 17:32:03 PST 2013
man/systemctl.xml | 112 +++++++++++++++++++++-------------
man/systemd.unit.xml | 32 ++++++---
src/core/dbus-unit.c | 3
src/core/job.c | 3
src/core/job.h | 4 -
src/core/load-fragment-gperf.gperf.m4 | 3
src/core/load-fragment.c | 31 +++++++++
src/core/load-fragment.h | 2
src/core/transaction.c | 2
src/core/unit.c | 11 +--
src/core/unit.h | 4 -
src/systemctl/systemctl.c | 24 +++----
units/initrd-cleanup.service.in | 1
units/initrd-fs.target | 2
units/initrd-parse-etc.service.in | 1
units/initrd-root-fs.target | 2
units/initrd-switch-root.service.in | 1
units/initrd.target | 2
units/local-fs.target | 2
19 files changed, 161 insertions(+), 81 deletions(-)
New commits:
commit a7c0e5d714512dc3f9fe30c136778257246f3279
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Nov 26 02:25:34 2013 +0100
man: explain the precise syntax and feature set of unit names at the end of the man page, given that it is detail information
diff --git a/man/systemctl.xml b/man/systemctl.xml
index 58b2c2a..567f398 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -63,19 +63,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
introspect and control the state of the
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
system and service manager.</para>
-
- <para>For unit commands, the <replaceable>NAME</replaceable> represents full name of the unit.
- <programlisting>
-systemctl start foo.service
- </programlisting>
- For unit file commands, the <replaceable>NAME</replaceable> represents the full name of the unit file, or the absolute path to the unit file.
- <programlisting>
-systemctl start /path/to/foo.service
- </programlisting>
- While working with services/service files, <command>systemctl</command> implicitly appends the ".service" suffix when it is missing.
- <programlisting>
-systemctl start foo
- </programlisting></para>
</refsect1>
<refsect1>
@@ -1307,6 +1294,28 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
</variablelist>
</refsect2>
+ <refsect2>
+ <title>Parameter Syntax</title>
+
+ <para>For unit commands the specified
+ <replaceable>NAME</replaceable> should be the full name of the
+ unit, or an abbreviated name which is automatically extended with
+ the <literal>.service</literal> suffix.
+ <programlisting># systemctl start foo.service</programlisting> is equivalent to:
+ <programlisting># systemctl start foo</programlisting>
+ Note that (absolute) paths to device nodes are automatically converted to device unit names, and other (absolute) paths to mount unit names.
+ <programlisting># systemctl status /dev/sda
+# systemctl status /home</programlisting> is equivalent to:
+ <programlisting># systemctl status dev-sda.device
+# systemctl status home.mount</programlisting></para>
+
+ <para>For unit file commands the
+ specified <replaceable>NAME</replaceable> should be the full name
+ of the unit file, or the absolute path to the unit file.
+ <programlisting># systemctl link /path/to/foo.service</programlisting>
+ </para>
+ </refsect2>
+
</refsect1>
<refsect1>
commit 4dc5b821ae737914499119e29811fc3346e3d97c
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Nov 26 02:14:27 2013 +0100
systemctl: replace the three job mode options by a single --job-mode= option
Also, expose the new "flush" job mode this way.
diff --git a/man/systemctl.xml b/man/systemctl.xml
index 33a2935..58b2c2a 100644
--- a/man/systemctl.xml
+++ b/man/systemctl.xml
@@ -195,18 +195,6 @@ systemctl start foo
</varlistentry>
<varlistentry>
- <term><option>--fail</option></term>
-
- <listitem>
- <para>If the requested operation conflicts with a pending
- unfinished job, fail the command. If this is not specified,
- the requested operation will replace the pending job, if
- necessary. Do not confuse with
- <option>--failed</option>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>--show-types</option></term>
<listitem>
@@ -215,27 +203,58 @@ systemctl start foo
</varlistentry>
<varlistentry>
- <term><option>--irreversible</option></term>
+ <term><option>--job-mode=</option></term>
<listitem>
- <para>Mark this transaction's jobs as irreversible. This prevents
- future conflicting transactions from replacing these jobs.
- The jobs can still be cancelled using the <command>cancel</command>
- command.</para>
+ <para>When queuing a new job, control how to deal with already
+ queued jobs. Takes one of <literal>fail</literal>,
+ <literal>replace</literal>,
+ <literal>replace-irreversibly</literal>,
+ <literal>isolate</literal>,
+ <literal>ignore-dependencies</literal>,
+ <literal>ignore-requirements</literal> or
+ <literal>flush</literal>. Defaults to
+ <literal>replace</literal>, except when the
+ <command>isolate</command> command is used which implies the
+ <literal>isolate</literal> job mode.</para>
+
+ <para>If <literal>fail</literal> is specified and a requested
+ operation conflicts with a pending job (more specifically:
+ causes an already pending start job to be reversed into a stop
+ job or vice versa), cause the operation to fail.</para>
+
+ <para>If <literal>replace</literal> (the default) is
+ specified, any conflicting pending job will be replaced, as
+ necessary.</para>
+
+ <para>If <literal>replace-irreversibly</literal> is specified,
+ operate like <literal>replace</literal>, but also mark the new
+ jobs as irreversible. This prevents future conflicting
+ transactions from replacing these jobs. The jobs can still be
+ cancelled using the <command>cancel</command> command.</para>
+
+ <para><literal>isolate</literal> is only valid for start
+ operations and causes all other units to be stopped when the
+ specified unit is started. This mode is always used when the
+ <command>isolate</command> command is used.</para>
+
+ <para><literal>flush</literal> will cause all queued jobs to
+ be canceled when the new job is enqueued.</para>
+
+ <para>If <literal>ignore-dependencies</literal> is specified,
+ then all unit dependencies are ignored for this new job and
+ the operation is executed immediately. If passed, no required
+ units of the unit passed will be pulled in, and no ordering
+ dependencies will be honored. This is mostly a debugging and
+ rescue tool for the administrator and should not be used by
+ applications.</para>
+
+ <para><literal>ignore-requirements</literal> is similar to
+ <literal>ignore-dependencies</literal> but only causes the
+ requirement dependencies to be ignored, the ordering
+ dependencies will still be honoured.</para>
</listitem>
- </varlistentry>
-
- <varlistentry>
- <term><option>--ignore-dependencies</option></term>
- <listitem>
- <para>When enqueuing a new job, ignore all its dependencies
- and execute it immediately. If passed, no required units of
- the unit passed will be pulled in, and no ordering
- dependencies will be honored. This is mostly a debugging and
- rescue tool for the administrator and should not be used by
- applications.</para>
- </listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index b43fa13..2c8bfbe 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -674,28 +674,20 @@
<listitem><para>Takes a value of
<literal>fail</literal>,
<literal>replace</literal>,
- <literal>replace-irreversibly</literal>
+ <literal>replace-irreversibly</literal>,
+ <literal>isolate</literal>,
+ <literal>flush</literal>,
+ <literal>ignore-dependencies</literal>
or
- <literal>isolate</literal>. Defaults
+ <literal>ignore-requirements</literal>. Defaults
to
<literal>replace</literal>. Specifies
how the units listed in
<varname>OnFailure=</varname> will be
- enqueued. If set to
- <literal>fail</literal> and
- contradicting jobs are already queued,
- cause the activation to fail. If set
- to <literal>replace</literal> and
- contradicting jobs area already
- queued, replace
- those. <literal>replace-irreversibly</literal>
- is similar to
- <literal>replace</literal>, however,
- creates jobs that cannot be reversed
- unless they finished or are explicitly
- canceled. <literal>isolate</literal>
- may be used to terminate all other
- units but the specified one. If
+ enqueued. See
+ <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>'s
+ <option>--job-mode=</option> option
+ for details on the possible values. If
this is set to
<literal>isolate</literal>, only a
single unit may be listed in
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 3fcc066..23399c1 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4671,14 +4671,10 @@ static int systemctl_help(void) {
" -a --all Show all loaded units/properties, including dead/empty\n"
" ones. To list all units installed on the system, use\n"
" the 'list-unit-files' command instead.\n"
- " --reverse Show reverse dependencies with 'list-dependencies'\n"
" -l --full Don't ellipsize unit names on output\n"
- " --fail When queueing a new job, fail if conflicting jobs are\n"
- " pending\n"
- " --irreversible When queueing a new job, make sure it cannot be implicitly\n"
- " cancelled\n"
- " --ignore-dependencies\n"
- " When queueing a new job, ignore all its dependencies\n"
+ " --reverse Show reverse dependencies with 'list-dependencies'\n"
+ " --job-mode=MODE Specify how to deal with already queued jobs, when\n"
+ " queueing a new job\n"
" --show-types When showing sockets, explicitly show their type\n"
" -i --ignore-inhibitors\n"
" When shutting down or sleeping, ignore inhibitors\n"
@@ -4880,7 +4876,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
ARG_RUNTIME,
ARG_FORCE,
ARG_PLAIN,
- ARG_STATE
+ ARG_STATE,
+ ARG_JOB_MODE
};
static const struct option options[] = {
@@ -4895,9 +4892,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
{ "show-types", no_argument, NULL, ARG_SHOW_TYPES },
{ "failed", no_argument, NULL, ARG_FAILED }, /* compatibility only */
{ "full", no_argument, NULL, 'l' },
- { "fail", no_argument, NULL, ARG_FAIL },
- { "irreversible", no_argument, NULL, ARG_IRREVERSIBLE },
- { "ignore-dependencies", no_argument, NULL, ARG_IGNORE_DEPENDENCIES },
+ { "job-mode", required_argument, NULL, ARG_JOB_MODE },
+ { "fail", no_argument, NULL, ARG_FAIL }, /* compatibility only */
+ { "irreversible", no_argument, NULL, ARG_IRREVERSIBLE }, /* compatibility only */
+ { "ignore-dependencies", no_argument, NULL, ARG_IGNORE_DEPENDENCIES }, /* compatibility only */
{ "ignore-inhibitors", no_argument, NULL, 'i' },
{ "user", no_argument, NULL, ARG_USER },
{ "system", no_argument, NULL, ARG_SYSTEM },
@@ -5035,6 +5033,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_show_types = true;
break;
+ case ARG_JOB_MODE:
+ arg_job_mode = optarg;
+ break;
+
case ARG_FAIL:
arg_job_mode = "fail";
break;
commit 255baef68a8d9d74cb3b846f93c290225ad162aa
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Nov 26 02:13:41 2013 +0100
core: add new "flush" job mode to cancel all other jobs when queuing a new job
diff --git a/src/core/job.c b/src/core/job.c
index 9cd6ce2..557917a 100644
--- a/src/core/job.c
+++ b/src/core/job.c
@@ -1107,7 +1107,8 @@ static const char* const job_mode_table[_JOB_MODE_MAX] = {
[JOB_REPLACE_IRREVERSIBLY] = "replace-irreversibly",
[JOB_ISOLATE] = "isolate",
[JOB_IGNORE_DEPENDENCIES] = "ignore-dependencies",
- [JOB_IGNORE_REQUIREMENTS] = "ignore-requirements"
+ [JOB_IGNORE_REQUIREMENTS] = "ignore-requirements",
+ [JOB_FLUSH] = "flush",
};
DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);
diff --git a/src/core/job.h b/src/core/job.h
index 3f6357a..c23a380 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -84,6 +84,7 @@ enum JobMode {
JOB_REPLACE, /* Replace an existing conflicting job */
JOB_REPLACE_IRREVERSIBLY,/* Like JOB_REPLACE + produce irreversible jobs */
JOB_ISOLATE, /* Start a unit, and stop all others */
+ JOB_FLUSH, /* Flush out all other queued jobs when queing this one */
JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
_JOB_MODE_MAX,
diff --git a/src/core/transaction.c b/src/core/transaction.c
index e2ff0bd..36e31c4 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -578,7 +578,7 @@ static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
/* Moves the transaction jobs to the set of active jobs */
- if (mode == JOB_ISOLATE) {
+ if (mode == JOB_ISOLATE || mode == JOB_FLUSH) {
/* When isolating first kill all installed jobs which
* aren't part of the new transaction */
commit d420282b28f50720e233ccb1c02547c562195653
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Nov 26 01:39:53 2013 +0100
core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index baf44ad..b43fa13 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -669,19 +669,37 @@
</varlistentry>
<varlistentry>
- <term><varname>OnFailureIsolate=</varname></term>
-
- <listitem><para>Takes a boolean
- argument. If <option>true</option>, the
- unit listed in
+ <term><varname>OnFailureJobMode=</varname></term>
+
+ <listitem><para>Takes a value of
+ <literal>fail</literal>,
+ <literal>replace</literal>,
+ <literal>replace-irreversibly</literal>
+ or
+ <literal>isolate</literal>. Defaults
+ to
+ <literal>replace</literal>. Specifies
+ how the units listed in
<varname>OnFailure=</varname> will be
- enqueued in isolation mode, i.e. all
- units that are not its dependency will
- be stopped. If this is set, only a
+ enqueued. If set to
+ <literal>fail</literal> and
+ contradicting jobs are already queued,
+ cause the activation to fail. If set
+ to <literal>replace</literal> and
+ contradicting jobs area already
+ queued, replace
+ those. <literal>replace-irreversibly</literal>
+ is similar to
+ <literal>replace</literal>, however,
+ creates jobs that cannot be reversed
+ unless they finished or are explicitly
+ canceled. <literal>isolate</literal>
+ may be used to terminate all other
+ units but the specified one. If
+ this is set to
+ <literal>isolate</literal>, only a
single unit may be listed in
- <varname>OnFailure=</varname>. Defaults
- to
- <option>false</option>.</para></listitem>
+ <varname>OnFailure=</varname>..</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 666c97c..f33e8db 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -32,6 +32,7 @@
#include "dbus-client-track.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState);
+static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode);
static int property_get_names(
sd_bus *bus,
@@ -545,7 +546,7 @@ const sd_bus_vtable bus_unit_vtable[] = {
SD_BUS_PROPERTY("RefuseManualStop", "b", bus_property_get_bool, offsetof(Unit, refuse_manual_stop), 0),
SD_BUS_PROPERTY("AllowIsolate", "b", bus_property_get_bool, offsetof(Unit, allow_isolate), 0),
SD_BUS_PROPERTY("DefaultDependencies", "b", bus_property_get_bool, offsetof(Unit, default_dependencies), 0),
- SD_BUS_PROPERTY("OnFailureIsolate", "b", bus_property_get_bool, offsetof(Unit, on_failure_isolate), 0),
+ SD_BUS_PROPERTY("OnFailureJobMode", "s", property_get_job_mode, offsetof(Unit, on_failure_job_mode), 0),
SD_BUS_PROPERTY("IgnoreOnIsolate", "b", bus_property_get_bool, offsetof(Unit, ignore_on_isolate), 0),
SD_BUS_PROPERTY("IgnoreOnSnapshot", "b", bus_property_get_bool, offsetof(Unit, ignore_on_snapshot), 0),
SD_BUS_PROPERTY("NeedDaemonReload", "b", property_get_need_daemon_reload, 0, 0),
diff --git a/src/core/job.h b/src/core/job.h
index 60bb87d..3f6357a 100644
--- a/src/core/job.h
+++ b/src/core/job.h
@@ -82,7 +82,7 @@ enum JobState {
enum JobMode {
JOB_FAIL, /* Fail if a conflicting job is already queued */
JOB_REPLACE, /* Replace an existing conflicting job */
- JOB_REPLACE_IRREVERSIBLY, /* Like JOB_REPLACE + produce irreversible jobs */
+ JOB_REPLACE_IRREVERSIBLY,/* Like JOB_REPLACE + produce irreversible jobs */
JOB_ISOLATE, /* Start a unit, and stop all others */
JOB_IGNORE_DEPENDENCIES, /* Ignore both requirement and ordering dependencies */
JOB_IGNORE_REQUIREMENTS, /* Ignore requirement dependencies */
@@ -155,7 +155,6 @@ struct Job {
bool in_dbus_queue:1;
bool sent_dbus_new_signal:1;
bool ignore_order:1;
- bool forgot_bus_clients:1;
bool irreversible:1;
};
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index fbf8381..c062550 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -122,7 +122,8 @@ Unit.RefuseManualStart, config_parse_bool, 0,
Unit.RefuseManualStop, config_parse_bool, 0, offsetof(Unit, refuse_manual_stop)
Unit.AllowIsolate, config_parse_bool, 0, offsetof(Unit, allow_isolate)
Unit.DefaultDependencies, config_parse_bool, 0, offsetof(Unit, default_dependencies)
-Unit.OnFailureIsolate, config_parse_bool, 0, offsetof(Unit, on_failure_isolate)
+Unit.OnFailureJobMode, config_parse_job_mode, 0, offsetof(Unit, on_failure_job_mode)
+Unit.OnFailureIsolate, config_parse_job_mode_isolate, 0, offsetof(Unit, on_failure_job_mode)
Unit.IgnoreOnIsolate, config_parse_bool, 0, offsetof(Unit, ignore_on_isolate)
Unit.IgnoreOnSnapshot, config_parse_bool, 0, offsetof(Unit, ignore_on_snapshot)
Unit.JobTimeoutSec, config_parse_sec, 0, offsetof(Unit, job_timeout)
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index e9bfbd3..d9dd6fa 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2326,6 +2326,37 @@ int config_parse_blockio_bandwidth(
return 0;
}
+DEFINE_CONFIG_PARSE_ENUM(config_parse_job_mode, job_mode, JobMode, "Failed to parse job mode");
+
+int config_parse_job_mode_isolate(
+ const char *unit,
+ const char *filename,
+ unsigned line,
+ const char *section,
+ unsigned section_line,
+ const char *lvalue,
+ int ltype,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ JobMode *m = data;
+ int r;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+
+ r = parse_boolean(rvalue);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse boolean, ignoring: %s", rvalue);
+ return 0;
+ }
+
+ *m = r ? JOB_ISOLATE : JOB_REPLACE;
+ return 0;
+}
+
#define FOLLOW_MAX 8
static int open_follow(char **filename, FILE **_f, Set *names, char **_final) {
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 99b8e03..31e30e3 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -82,6 +82,8 @@ int config_parse_device_allow(const char *unit, const char *filename, unsigned l
int config_parse_blockio_weight(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_blockio_device_weight(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_blockio_bandwidth(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_job_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_job_mode_isolate(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
/* gperf prototypes */
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length);
diff --git a/src/core/unit.c b/src/core/unit.c
index 57f0a86..f4d60bc 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -86,6 +86,7 @@ Unit *unit_new(Manager *m, size_t size) {
u->deserialized_job = _JOB_TYPE_INVALID;
u->default_dependencies = true;
u->unit_file_state = _UNIT_FILE_STATE_INVALID;
+ u->on_failure_job_mode = JOB_REPLACE;
return u;
}
@@ -826,14 +827,14 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
"%s\tRefuseManualStart: %s\n"
"%s\tRefuseManualStop: %s\n"
"%s\tDefaultDependencies: %s\n"
- "%s\tOnFailureIsolate: %s\n"
+ "%s\tOnFailureJobMode: %s\n"
"%s\tIgnoreOnIsolate: %s\n"
"%s\tIgnoreOnSnapshot: %s\n",
prefix, yes_no(u->stop_when_unneeded),
prefix, yes_no(u->refuse_manual_start),
prefix, yes_no(u->refuse_manual_stop),
prefix, yes_no(u->default_dependencies),
- prefix, yes_no(u->on_failure_isolate),
+ prefix, job_mode_to_string(u->on_failure_job_mode),
prefix, yes_no(u->ignore_on_isolate),
prefix, yes_no(u->ignore_on_snapshot));
@@ -1044,11 +1045,11 @@ int unit_load(Unit *u) {
if (r < 0)
goto fail;
- if (u->on_failure_isolate &&
+ if (u->on_failure_job_mode == JOB_ISOLATE &&
set_size(u->dependencies[UNIT_ON_FAILURE]) > 1) {
log_error_unit(u->id,
- "More than one OnFailure= dependencies specified for %s but OnFailureIsolate= enabled. Refusing.", u->id);
+ "More than one OnFailure= dependencies specified for %s but OnFailureJobMode=isolate set. Refusing.", u->id);
r = -EINVAL;
goto fail;
@@ -1454,7 +1455,7 @@ void unit_start_on_failure(Unit *u) {
SET_FOREACH(other, u->dependencies[UNIT_ON_FAILURE], i) {
int r;
- r = manager_add_job(u->manager, JOB_START, other, u->on_failure_isolate ? JOB_ISOLATE : JOB_REPLACE, true, NULL, NULL);
+ r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, true, NULL, NULL);
if (r < 0)
log_error_unit(u->id, "Failed to enqueue OnFailure= job: %s", strerror(-r));
}
diff --git a/src/core/unit.h b/src/core/unit.h
index fe49b57..a6dbe8d 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -230,8 +230,8 @@ struct Unit {
/* Allow isolation requests */
bool allow_isolate;
- /* Isolate OnFailure unit */
- bool on_failure_isolate;
+ /* How to start OnFailure units */
+ JobMode on_failure_job_mode;
/* Ignore this unit when isolating */
bool ignore_on_isolate;
diff --git a/units/initrd-cleanup.service.in b/units/initrd-cleanup.service.in
index 218ec80..b1dda16 100644
--- a/units/initrd-cleanup.service.in
+++ b/units/initrd-cleanup.service.in
@@ -10,6 +10,7 @@ Description=Cleaning Up and Shutting Down Daemons
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
After=initrd-root-fs.target initrd-fs.target initrd.target
[Service]
diff --git a/units/initrd-fs.target b/units/initrd-fs.target
index 866f0d0..7ec838a 100644
--- a/units/initrd-fs.target
+++ b/units/initrd-fs.target
@@ -9,7 +9,7 @@
Description=Initrd File Systems
Documentation=man:systemd.special(7)
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
After=initrd-parse-etc.service
DefaultDependencies=no
diff --git a/units/initrd-parse-etc.service.in b/units/initrd-parse-etc.service.in
index 07728e2..c0b2543 100644
--- a/units/initrd-parse-etc.service.in
+++ b/units/initrd-parse-etc.service.in
@@ -11,6 +11,7 @@ DefaultDependencies=no
Requires=initrd-root-fs.target
After=initrd-root-fs.target
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
[Service]
diff --git a/units/initrd-root-fs.target b/units/initrd-root-fs.target
index d0b9863..64f0a92 100644
--- a/units/initrd-root-fs.target
+++ b/units/initrd-root-fs.target
@@ -10,6 +10,6 @@ Description=Initrd Root File System
Documentation=man:systemd.special(7)
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
DefaultDependencies=no
Conflicts=shutdown.target
diff --git a/units/initrd-switch-root.service.in b/units/initrd-switch-root.service.in
index 6740264..82893da 100644
--- a/units/initrd-switch-root.service.in
+++ b/units/initrd-switch-root.service.in
@@ -10,6 +10,7 @@ Description=Switch Root
DefaultDependencies=no
ConditionPathExists=/etc/initrd-release
OnFailure=emergency.target
+OnFailureJobMode=replace-irreversibly
AllowIsolate=yes
[Service]
diff --git a/units/initrd.target b/units/initrd.target
index bb9054f..eae7c70 100644
--- a/units/initrd.target
+++ b/units/initrd.target
@@ -9,7 +9,7 @@
Description=Initrd Default Target
Documentation=man:systemd.special(7)
OnFailure=emergency.target
-OnFailureIsolate=yes
+OnFailureJobMode=replace-irreversibly
ConditionPathExists=/etc/initrd-release
Requires=basic.target
Wants=initrd-root-fs.target initrd-fs.target initrd-parse-etc.service
diff --git a/units/local-fs.target b/units/local-fs.target
index 8f06ed6..ae3cedc 100644
--- a/units/local-fs.target
+++ b/units/local-fs.target
@@ -12,4 +12,4 @@ After=local-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
OnFailure=emergency.target
-OnFailureIsolate=no
+OnFailureJobMode=replace-irreversibly
More information about the systemd-commits
mailing list