chiark / gitweb /
manager: introduce IgnoreOnIsolate flag so that we can keep systemd-logger around...
authorLennart Poettering <lennart@poettering.net>
Thu, 14 Apr 2011 01:55:03 +0000 (03:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 16 Apr 2011 00:03:34 +0000 (02:03 +0200)
man/systemd.unit.xml
src/automount.c
src/dbus-unit.h
src/device.c
src/load-fragment.c
src/manager.c
src/mount.c
src/swap.c
src/unit.c
src/unit.h
units/systemd-logger.socket

index 0fc2fbe..65a76be 100644 (file)
                         </varlistentry>
 
                         <varlistentry>
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>IgnoreOnIsolate=</varname></term>
+
+                                <listitem><para>Takes a boolean
+                                argument. If <option>true</option>
+                                this unit will not be stopped when
+                                isolating another unit. Defaults to
+                                <option>false</option>.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>StopWhenUnneeded=</varname></term>
 
                                 <listitem><para>Takes a boolean
                                 <term><varname>StopWhenUnneeded=</varname></term>
 
                                 <listitem><para>Takes a boolean
index f6f83d4..33c962e 100644 (file)
@@ -58,6 +58,8 @@ static void automount_init(Unit *u) {
         a->pipe_watch.type = WATCH_INVALID;
 
         a->directory_mode = 0755;
         a->pipe_watch.type = WATCH_INVALID;
 
         a->directory_mode = 0755;
+
+        a->meta.ignore_on_isolate = true;
 }
 
 static void repeat_unmout(const char *path) {
 }
 
 static void repeat_unmout(const char *path) {
index b9f0895..b578ff9 100644 (file)
         "  <property name=\"ActiveExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"InactiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"InactiveEnterTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"ActiveExitTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"InactiveEnterTimestamp\" type=\"t\" access=\"read\"/>\n" \
         "  <property name=\"InactiveEnterTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
-        "  <property name=\"CanReload\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"CanStart\" type=\"b\" access=\"read\"/>\n"  \
         "  <property name=\"CanStop\" type=\"b\" access=\"read\"/>\n"   \
         "  <property name=\"CanStart\" type=\"b\" access=\"read\"/>\n"  \
         "  <property name=\"CanStop\" type=\"b\" access=\"read\"/>\n"   \
+        "  <property name=\"CanReload\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"CanIsolate\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"Job\" type=\"(uo)\" access=\"read\"/>\n"    \
         "  <property name=\"StopWhenUnneeded\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RefuseManualStart\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RefuseManualStop\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"CanIsolate\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"Job\" type=\"(uo)\" access=\"read\"/>\n"    \
         "  <property name=\"StopWhenUnneeded\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RefuseManualStart\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"RefuseManualStop\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"AllowIsolate\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"DefaultDependencies\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"DefaultDependencies\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"OnFailureIsolate\" type=\"b\" access=\"read\"/>\n" \
+        "  <property name=\"IgnoreOnIsolate\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"ControlGroup\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"NeedDaemonReload\" type=\"b\" access=\"read\"/>\n" \
         "  <property name=\"DefaultControlGroup\" type=\"s\" access=\"read\"/>\n" \
         "  <property name=\"ControlGroup\" type=\"as\" access=\"read\"/>\n" \
         "  <property name=\"NeedDaemonReload\" type=\"b\" access=\"read\"/>\n" \
         { "org.freedesktop.systemd1.Unit", "AllowIsolate",         bus_property_append_bool,       "b",    &u->meta.allow_isolate            }, \
         { "org.freedesktop.systemd1.Unit", "DefaultDependencies",  bus_property_append_bool,       "b",    &u->meta.default_dependencies     }, \
         { "org.freedesktop.systemd1.Unit", "OnFailureIsolate",     bus_property_append_bool,       "b",    &u->meta.on_failure_isolate       }, \
         { "org.freedesktop.systemd1.Unit", "AllowIsolate",         bus_property_append_bool,       "b",    &u->meta.allow_isolate            }, \
         { "org.freedesktop.systemd1.Unit", "DefaultDependencies",  bus_property_append_bool,       "b",    &u->meta.default_dependencies     }, \
         { "org.freedesktop.systemd1.Unit", "OnFailureIsolate",     bus_property_append_bool,       "b",    &u->meta.on_failure_isolate       }, \
+        { "org.freedesktop.systemd1.Unit", "IgnoreOnIsolate",      bus_property_append_bool,       "b",    &u->meta.ignore_on_isolate        }, \
         { "org.freedesktop.systemd1.Unit", "DefaultControlGroup",  bus_unit_append_default_cgroup, "s",    u                                 }, \
         { "org.freedesktop.systemd1.Unit", "ControlGroup",         bus_unit_append_cgroups,        "as",   u                                 }, \
         { "org.freedesktop.systemd1.Unit", "NeedDaemonReload",     bus_unit_append_need_daemon_reload, "b", u                                }, \
         { "org.freedesktop.systemd1.Unit", "DefaultControlGroup",  bus_unit_append_default_cgroup, "s",    u                                 }, \
         { "org.freedesktop.systemd1.Unit", "ControlGroup",         bus_unit_append_cgroups,        "as",   u                                 }, \
         { "org.freedesktop.systemd1.Unit", "NeedDaemonReload",     bus_unit_append_need_daemon_reload, "b", u                                }, \
index 41c96ce..d507b70 100644 (file)
@@ -70,6 +70,8 @@ static void device_init(Unit *u) {
          * happen for the other units since their operations time out
          * anyway. */
         d->meta.job_timeout = DEFAULT_TIMEOUT_USEC;
          * happen for the other units since their operations time out
          * anyway. */
         d->meta.job_timeout = DEFAULT_TIMEOUT_USEC;
+
+        d->meta.ignore_on_isolate = true;
 }
 
 static void device_done(Unit *u) {
 }
 
 static void device_done(Unit *u) {
@@ -583,7 +585,6 @@ const UnitVTable device_vtable = {
 
         .no_instances = true,
         .no_snapshots = true,
 
         .no_instances = true,
         .no_snapshots = true,
-        .no_isolate = true,
 
         .init = device_init,
 
 
         .init = device_init,
 
index 3440d91..a7e16ca 100644 (file)
@@ -1861,6 +1861,7 @@ static int load_from_path(Unit *u, const char *path) {
                 { "AllowIsolate",           config_parse_bool,            0, &u->meta.allow_isolate,                          "Unit"    },
                 { "DefaultDependencies",    config_parse_bool,            0, &u->meta.default_dependencies,                   "Unit"    },
                 { "OnFailureIsolate",       config_parse_bool,            0, &u->meta.on_failure_isolate,                     "Unit"    },
                 { "AllowIsolate",           config_parse_bool,            0, &u->meta.allow_isolate,                          "Unit"    },
                 { "DefaultDependencies",    config_parse_bool,            0, &u->meta.default_dependencies,                   "Unit"    },
                 { "OnFailureIsolate",       config_parse_bool,            0, &u->meta.on_failure_isolate,                     "Unit"    },
+                { "IgnoreOnIsolate",        config_parse_bool,            0, &u->meta.ignore_on_isolate,                      "Unit"    },
                 { "JobTimeoutSec",          config_parse_usec,            0, &u->meta.job_timeout,                            "Unit"    },
                 { "ConditionPathExists",        config_parse_condition_path, CONDITION_PATH_EXISTS, u,                        "Unit"    },
                 { "ConditionPathIsDirectory",   config_parse_condition_path, CONDITION_PATH_IS_DIRECTORY, u,                  "Unit"    },
                 { "JobTimeoutSec",          config_parse_usec,            0, &u->meta.job_timeout,                            "Unit"    },
                 { "ConditionPathExists",        config_parse_condition_path, CONDITION_PATH_EXISTS, u,                        "Unit"    },
                 { "ConditionPathIsDirectory",   config_parse_condition_path, CONDITION_PATH_IS_DIRECTORY, u,                  "Unit"    },
index e723a1e..dfd33b0 100644 (file)
@@ -1619,7 +1619,7 @@ static int transaction_add_isolate_jobs(Manager *m) {
                 if (u->meta.id != k)
                         continue;
 
                 if (u->meta.id != k)
                         continue;
 
-                if (UNIT_VTABLE(u)->no_isolate)
+                if (u->meta.ignore_on_isolate)
                         continue;
 
                 /* No need to stop inactive jobs */
                         continue;
 
                 /* No need to stop inactive jobs */
index d7a300e..2b19f49 100644 (file)
@@ -80,6 +80,8 @@ static void mount_init(Unit *u) {
         m->timer_watch.type = WATCH_INVALID;
 
         m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
         m->timer_watch.type = WATCH_INVALID;
 
         m->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
+
+        m->meta.ignore_on_isolate = true;
 }
 
 static void mount_unwatch_control_pid(Mount *m) {
 }
 
 static void mount_unwatch_control_pid(Mount *m) {
@@ -1763,7 +1765,6 @@ const UnitVTable mount_vtable = {
 
         .no_alias = true,
         .no_instances = true,
 
         .no_alias = true,
         .no_instances = true,
-        .no_isolate = true,
         .show_status = true,
 
         .init = mount_init,
         .show_status = true,
 
         .init = mount_init,
index c32f608..ef001a9 100644 (file)
@@ -90,6 +90,8 @@ static void swap_unset_proc_swaps(Swap *s) {
         s->timer_watch.type = WATCH_INVALID;
 
         s->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
         s->timer_watch.type = WATCH_INVALID;
 
         s->control_command_id = _MOUNT_EXEC_COMMAND_INVALID;
+
+        s->meta.ignore_on_isolate = true;
 }
 
 static void swap_unwatch_control_pid(Swap *s) {
 }
 
 static void swap_unwatch_control_pid(Swap *s) {
@@ -1339,7 +1341,6 @@ const UnitVTable swap_vtable = {
 
         .no_alias = true,
         .no_instances = true,
 
         .no_alias = true,
         .no_instances = true,
-        .no_isolate = true,
         .show_status = true,
 
         .init = swap_init,
         .show_status = true,
 
         .init = swap_init,
index f50477f..d7405b9 100644 (file)
@@ -664,12 +664,14 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
                         "%s\tRefuseManualStart: %s\n"
                         "%s\tRefuseManualStop: %s\n"
                         "%s\tDefaultDependencies: %s\n"
                         "%s\tRefuseManualStart: %s\n"
                         "%s\tRefuseManualStop: %s\n"
                         "%s\tDefaultDependencies: %s\n"
-                        "%s\tOnFailureIsolate: %s\n",
+                        "%s\tOnFailureIsolate: %s\n"
+                        "%s\tIgnoreOnIsolate: %s\n",
                         prefix, yes_no(u->meta.stop_when_unneeded),
                         prefix, yes_no(u->meta.refuse_manual_start),
                         prefix, yes_no(u->meta.refuse_manual_stop),
                         prefix, yes_no(u->meta.default_dependencies),
                         prefix, yes_no(u->meta.stop_when_unneeded),
                         prefix, yes_no(u->meta.refuse_manual_start),
                         prefix, yes_no(u->meta.refuse_manual_stop),
                         prefix, yes_no(u->meta.default_dependencies),
-                        prefix, yes_no(u->meta.on_failure_isolate));
+                        prefix, yes_no(u->meta.on_failure_isolate),
+                        prefix, yes_no(u->meta.ignore_on_isolate));
 
                 LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings)
                         fprintf(f, "%s\tControlGroup: %s:%s\n",
 
                 LIST_FOREACH(by_unit, b, u->meta.cgroup_bondings)
                         fprintf(f, "%s\tControlGroup: %s:%s\n",
index 2c5cacd..43bbe67 100644 (file)
@@ -210,6 +210,9 @@ struct Meta {
         /* Isolate OnFailure unit */
         bool on_failure_isolate;
 
         /* Isolate OnFailure unit */
         bool on_failure_isolate;
 
+        /* Ignore this unit when isolating */
+        bool ignore_on_isolate;
+
         /* Did the last condition check suceed? */
         bool condition_result;
 
         /* Did the last condition check suceed? */
         bool condition_result;
 
@@ -367,9 +370,6 @@ struct UnitVTable {
         /* Exclude from automatic gc */
         bool no_gc:1;
 
         /* Exclude from automatic gc */
         bool no_gc:1;
 
-        /* Exclude from stopping on isolation requests */
-        bool no_isolate:1;
-
         /* Show status updates on the console */
         bool show_status:1;
 };
         /* Show status updates on the console */
         bool show_status:1;
 };
index 8debd09..7178cc8 100644 (file)
@@ -12,5 +12,10 @@ Description=Stdio Syslog Bridge Socket
 DefaultDependencies=no
 Before=sockets.target
 
 DefaultDependencies=no
 Before=sockets.target
 
+# Mount and swap units need this. If this socket unit is removed by an
+# isolate request the mount and and swap units would be removed too,
+# hence let's exclude this from isolate requests.
+IgnoreOnIsolate=yes
+
 [Socket]
 ListenStream=/run/systemd/logger
 [Socket]
 ListenStream=/run/systemd/logger