Commit 3b6fdb5b authored by Lennart Poettering's avatar Lennart Poettering

unit: introduce IgnoreDependencyFailure=

parent f6023656
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
* systemctl status $PID, systemctl stop $PID! * systemctl status $PID, systemctl stop $PID!
* make shutdown go on even if conflicting units fail to shut down.
* sulogin in den single user mode, mit plymouth --hide davor * sulogin in den single user mode, mit plymouth --hide davor
* replace remaining libcgroup use
External: External:
* patch /etc/init.d/functions with: * patch /etc/init.d/functions with:
......
...@@ -84,7 +84,8 @@ ...@@ -84,7 +84,8 @@
<filename>systemd-initctl.service</filename>, <filename>systemd-initctl.service</filename>,
<filename>systemd-initctl.socket</filename>, <filename>systemd-initctl.socket</filename>,
<filename>systemd-logger.service</filename>, <filename>systemd-logger.service</filename>,
<filename>systemd-logger.socket</filename></para> <filename>systemd-logger.socket</filename>,
<filename>umount.target</filename></para>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1> <refsect1>
...@@ -499,8 +500,10 @@ ...@@ -499,8 +500,10 @@
terminated on system shutdown terminated on system shutdown
shall add Conflicts shall add Conflicts
dependencies to this unit for dependencies to this unit for
their service unit during their service unit, which is
installation.</para> implicitly done when
<varname>DefaultDependencies=yes</varname>
is set (the default).</para>
<para>systemd automatically <para>systemd automatically
adds dependencies of type adds dependencies of type
...@@ -653,6 +656,24 @@ ...@@ -653,6 +656,24 @@
kernel log buffer.</para> kernel log buffer.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><filename>umount.target</filename></term>
<listitem>
<para>A special target unit
that umounts all mount and
automount points on system
shutdown.</para>
<para>Mounts that shall be
unmounted on system shutdown
shall add Conflicts
dependencies to this unit for
their mount unit, which is
implicitly done when
<varname>DefaultDependencies=yes</varname>
is set (the default).</para>
</listitem>
</varlistentry>
</variablelist> </variablelist>
</refsect1> </refsect1>
......
...@@ -482,6 +482,19 @@ ...@@ -482,6 +482,19 @@
ones.</para></listitem> ones.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>IgnoreDependencyFailure=</varname></term>
<listitem><para>Takes a boolean
argument. If <option>true</option> and
a requirement dependency of this unit
fails to start up this unit will be
started nonetheless, ignoring that
failure. If <option>false</option>
(the default) and a dependency unit
fails the unit will immediately fail
too and the job is removed.</para></listitem>
</varlistentry>
</variablelist> </variablelist>
<para>Unit file may include a [Install] section, which <para>Unit file may include a [Install] section, which
......
...@@ -495,14 +495,16 @@ int job_finish_and_invalidate(Job *j, bool success) { ...@@ -495,14 +495,16 @@ int job_finish_and_invalidate(Job *j, bool success) {
t == JOB_RELOAD_OR_START) { t == JOB_RELOAD_OR_START) {
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i) SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY], i)
if (other->meta.job && if (!other->meta.ignore_dependency_failure &&
other->meta.job &&
(other->meta.job->type == JOB_START || (other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_VERIFY_ACTIVE ||
other->meta.job->type == JOB_RELOAD_OR_START)) other->meta.job->type == JOB_RELOAD_OR_START))
job_finish_and_invalidate(other->meta.job, false); job_finish_and_invalidate(other->meta.job, false);
SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i) SET_FOREACH(other, u->meta.dependencies[UNIT_REQUIRED_BY_OVERRIDABLE], i)
if (other->meta.job && if (!other->meta.ignore_dependency_failure &&
other->meta.job &&
!other->meta.job->override && !other->meta.job->override &&
(other->meta.job->type == JOB_START || (other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_VERIFY_ACTIVE ||
...@@ -512,7 +514,8 @@ int job_finish_and_invalidate(Job *j, bool success) { ...@@ -512,7 +514,8 @@ int job_finish_and_invalidate(Job *j, bool success) {
} else if (t == JOB_STOP) { } else if (t == JOB_STOP) {
SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTS], i) SET_FOREACH(other, u->meta.dependencies[UNIT_CONFLICTS], i)
if (other->meta.job && if (!other->meta.ignore_dependency_failure &&
other->meta.job &&
(other->meta.job->type == JOB_START || (other->meta.job->type == JOB_START ||
other->meta.job->type == JOB_VERIFY_ACTIVE || other->meta.job->type == JOB_VERIFY_ACTIVE ||
other->meta.job->type == JOB_RELOAD_OR_START)) other->meta.job->type == JOB_RELOAD_OR_START))
......
...@@ -1562,6 +1562,7 @@ static int load_from_path(Unit *u, const char *path) { ...@@ -1562,6 +1562,7 @@ static int load_from_path(Unit *u, const char *path) {
{ "StopWhenUnneeded", config_parse_bool, &u->meta.stop_when_unneeded, "Unit" }, { "StopWhenUnneeded", config_parse_bool, &u->meta.stop_when_unneeded, "Unit" },
{ "OnlyByDependency", config_parse_bool, &u->meta.only_by_dependency, "Unit" }, { "OnlyByDependency", config_parse_bool, &u->meta.only_by_dependency, "Unit" },
{ "DefaultDependencies", config_parse_bool, &u->meta.default_dependencies, "Unit" }, { "DefaultDependencies", config_parse_bool, &u->meta.default_dependencies, "Unit" },
{ "IgnoreDependencyFailure",config_parse_bool, &u->meta.ignore_dependency_failure, "Unit" },
{ "PIDFile", config_parse_path, &u->service.pid_file, "Service" }, { "PIDFile", config_parse_path, &u->service.pid_file, "Service" },
{ "ExecStartPre", config_parse_exec, u->service.exec_command+SERVICE_EXEC_START_PRE, "Service" }, { "ExecStartPre", config_parse_exec, u->service.exec_command+SERVICE_EXEC_START_PRE, "Service" },
......
...@@ -626,11 +626,13 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) { ...@@ -626,11 +626,13 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
"%s\tRecursive Stop: %s\n" "%s\tRecursive Stop: %s\n"
"%s\tStopWhenUnneeded: %s\n" "%s\tStopWhenUnneeded: %s\n"
"%s\tOnlyByDependency: %s\n" "%s\tOnlyByDependency: %s\n"
"%s\tDefaultDependencies: %s\n", "%s\tDefaultDependencies: %s\n"
"%s\tIgnoreDependencyFailure: %s\n",
prefix, yes_no(u->meta.recursive_stop), prefix, yes_no(u->meta.recursive_stop),
prefix, yes_no(u->meta.stop_when_unneeded), prefix, yes_no(u->meta.stop_when_unneeded),
prefix, yes_no(u->meta.only_by_dependency), prefix, yes_no(u->meta.only_by_dependency),
prefix, yes_no(u->meta.default_dependencies)); prefix, yes_no(u->meta.default_dependencies),
prefix, yes_no(u->meta.ignore_dependency_failure));
LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings) LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings)
fprintf(f, "%s\tControlGroup: %s:%s\n", fprintf(f, "%s\tControlGroup: %s:%s\n",
......
...@@ -184,6 +184,9 @@ struct Meta { ...@@ -184,6 +184,9 @@ struct Meta {
/* Create default depedencies */ /* Create default depedencies */
bool default_dependencies; bool default_dependencies;
/* Bring up this unit even if a dependency fails to start */
bool ignore_dependency_failure;
/* When deserializing, temporarily store the job type for this /* When deserializing, temporarily store the job type for this
* unit here, if there was a job scheduled */ * unit here, if there was a job scheduled */
int deserialized_job; /* This is actually of type JobType */ int deserialized_job; /* This is actually of type JobType */
......
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
[Unit] [Unit]
Description=Shutdown Description=Shutdown
OnlyByDependency=yes OnlyByDependency=yes
IgnoreDependencyFailure=yes
...@@ -10,3 +10,4 @@ ...@@ -10,3 +10,4 @@
[Unit] [Unit]
Description=Unmount All Filesystems Description=Unmount All Filesystems
OnlyByDependency=yes OnlyByDependency=yes
IgnoreDependencyFailure=yes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment