]> err.no Git - systemd/commitdiff
unit: introduce IgnoreDependencyFailure=
authorLennart Poettering <lennart@poettering.net>
Mon, 12 Jul 2010 00:56:17 +0000 (02:56 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 12 Jul 2010 01:07:02 +0000 (03:07 +0200)
fixme
man/systemd.special.xml.in
man/systemd.unit.xml
src/job.c
src/load-fragment.c
src/unit.c
src/unit.h
units/shutdown.target
units/umount.target

diff --git a/fixme b/fixme
index 7f34510e22f9faa9ce3c824fb9a22779bda25de5..2c61cff2ee35ee1355ee1c65683dcc59ea3c0c1f 100644 (file)
--- a/fixme
+++ b/fixme
 
 * 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
 
+* replace remaining libcgroup use
+
 External:
 
 * patch /etc/init.d/functions with:
index ac9f0f5a6ab1598cd7d07fba9dd5eec67668dbfa..64e37d1149e76f1991fab9c452015712520b22b0 100644 (file)
@@ -84,7 +84,8 @@
                 <filename>systemd-initctl.service</filename>,
                 <filename>systemd-initctl.socket</filename>,
                 <filename>systemd-logger.service</filename>,
-                <filename>systemd-logger.socket</filename></para>
+                <filename>systemd-logger.socket</filename>,
+                <filename>umount.target</filename></para>
         </refsynopsisdiv>
 
         <refsect1>
                                         terminated on system shutdown
                                         shall add Conflicts
                                         dependencies to this unit for
-                                        their service unit during
-                                        installation.</para>
+                                        their service unit, which is
+                                        implicitly done when
+                                        <varname>DefaultDependencies=yes</varname>
+                                        is set (the default).</para>
 
                                         <para>systemd automatically
                                         adds dependencies of type
                                         kernel log buffer.</para>
                                 </listitem>
                         </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>
         </refsect1>
 
index 554130448fe6071217849969fdc3c6386ee60476..a03df65dcb50b24432a3e4606ebec0b3f26fbf00 100644 (file)
                                 ones.</para></listitem>
                         </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>
 
                 <para>Unit file may include a [Install] section, which
index 7cbde80b38036689b3deffb8fac4b0bcad3f5a56..8cc9d742ede5dcba0bcee7da0c6b1e801c76b5ee 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -495,14 +495,16 @@ int job_finish_and_invalidate(Job *j, bool success) {
                     t == JOB_RELOAD_OR_START) {
 
                         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_VERIFY_ACTIVE ||
                                      other->meta.job->type == JOB_RELOAD_OR_START))
                                         job_finish_and_invalidate(other->meta.job, false);
 
                         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->type == JOB_START ||
                                      other->meta.job->type == JOB_VERIFY_ACTIVE ||
@@ -512,7 +514,8 @@ int job_finish_and_invalidate(Job *j, bool success) {
                 } else if (t == JOB_STOP) {
 
                         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_VERIFY_ACTIVE ||
                                      other->meta.job->type == JOB_RELOAD_OR_START))
index 1d40b69c98ad538d07128ac9391a88bf03cc1a05..8e4ec74b0735b98e55ee2bcd1ee665298fa2a673 100644 (file)
@@ -1562,6 +1562,7 @@ static int load_from_path(Unit *u, const char *path) {
                 { "StopWhenUnneeded",       config_parse_bool,            &u->meta.stop_when_unneeded,                     "Unit"    },
                 { "OnlyByDependency",       config_parse_bool,            &u->meta.only_by_dependency,                     "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" },
                 { "ExecStartPre",           config_parse_exec,            u->service.exec_command+SERVICE_EXEC_START_PRE,  "Service" },
index b362fd3b41957385e7e106f2a10bc98e45bc7bce..66372f2a92a8e4b98f5302aa1ec5bb2a6f371882 100644 (file)
@@ -626,11 +626,13 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                         "%s\tRecursive Stop: %s\n"
                         "%s\tStopWhenUnneeded: %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.stop_when_unneeded),
                         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)
                         fprintf(f, "%s\tControlGroup: %s:%s\n",
index c9fd4a538cb2fe7e11c96b7a3097880124cfa4e2..3f4bbd9ed7d51f0db73a7f3c1057c149cac98c87 100644 (file)
@@ -184,6 +184,9 @@ struct Meta {
         /* Create default depedencies */
         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
          * unit here, if there was a job scheduled */
         int deserialized_job; /* This is actually of type JobType */
index c05b8b93e3c020a222a50216ff59c381df10b46e..586ca4a7583209ce0fb7d1fcb445cd4f857f1e63 100644 (file)
@@ -10,3 +10,4 @@
 [Unit]
 Description=Shutdown
 OnlyByDependency=yes
+IgnoreDependencyFailure=yes
index a5f31e04cb2aafb0af9e4b4538b3abbb22a98ace..6a00c3132821697e0c51abfbca22b941bd081eeb 100644 (file)
@@ -10,3 +10,4 @@
 [Unit]
 Description=Unmount All Filesystems
 OnlyByDependency=yes
+IgnoreDependencyFailure=yes