[systemd-commits] 2 commits - src/nspawn units/systemd-journal-flush.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Oct 31 08:23:47 PDT 2014
src/nspawn/nspawn.c | 53 +++++++++++++--------------------
units/systemd-journal-flush.service.in | 3 +
2 files changed, 23 insertions(+), 33 deletions(-)
New commits:
commit 919699ec301ea507edce4a619141ed22e789ac0d
Author: Lennart Poettering <lennart at poettering.net>
Date: Fri Oct 31 16:22:36 2014 +0100
units: don't order journal flushing afte remote-fs.target
Instead, only depend on the actual file systems we need.
This should solve dep loops on setups where remote-fs.target is moved
into late boot.
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 7e96efd..f332ade 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2911,8 +2911,8 @@ static int change_uid_gid(char **_home) {
* container argument.
* > 0 : The program executed in the container terminated with an
* error. The exit code of the program executed in the
- * container is returned. No change is made to the container
- * argument.
+ * container is returned. The container argument has been set
+ * to CONTAINER_TERMINATED.
* 0 : The container is being rebooted, has been shut down or exited
* successfully. The container argument has been set to either
* CONTAINER_TERMINATED or CONTAINER_REBOOTED.
@@ -2921,8 +2921,8 @@ static int change_uid_gid(char **_home) {
* error is indicated by a non-zero value.
*/
static int wait_for_container(pid_t pid, ContainerStatus *container) {
- int r;
siginfo_t status;
+ int r;
r = wait_for_terminate(pid, &status);
if (r < 0) {
@@ -2933,44 +2933,38 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
switch (status.si_code) {
case CLD_EXITED:
- r = status.si_status;
- if (r == 0) {
- if (!arg_quiet)
- log_debug("Container %s exited successfully.", arg_machine);
+ if (status.si_status == 0) {
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s exited successfully.", arg_machine);
- *container = CONTAINER_TERMINATED;
} else
- log_error("Container %s failed with error code %i.", arg_machine, status.si_status);
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s failed with error code %i.", arg_machine, status.si_status);
- break;
+ *container = CONTAINER_TERMINATED;
+ return status.si_status;
case CLD_KILLED:
if (status.si_status == SIGINT) {
- if (!arg_quiet)
- log_info("Container %s has been shut down.", arg_machine);
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s has been shut down.", arg_machine);
*container = CONTAINER_TERMINATED;
- r = 0;
- break;
+ return 0;
+
} else if (status.si_status == SIGHUP) {
- if (!arg_quiet)
- log_info("Container %s is being rebooted.", arg_machine);
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO, "Container %s is being rebooted.", arg_machine);
*container = CONTAINER_REBOOTED;
- r = 0;
- break;
+ return 0;
}
+
/* CLD_KILLED fallthrough */
case CLD_DUMPED:
log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
- r = -EIO;
- break;
+ return -EIO;
default:
log_error("Container %s failed due to unknown reason.", arg_machine);
- r = -EIO;
- break;
+ return -EIO;
}
return r;
diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in
index 699670b..2612220 100644
--- a/units/systemd-journal-flush.service.in
+++ b/units/systemd-journal-flush.service.in
@@ -10,8 +10,9 @@ Description=Trigger Flushing of Journal to Persistent Storage
Documentation=man:systemd-journald.service(8) man:journald.conf(5)
DefaultDependencies=no
Requires=systemd-journald.service
-After=systemd-journald.service local-fs.target remote-fs.target
+After=systemd-journald.service
Before=systemd-user-sessions.service systemd-tmpfiles-setup.service
+RequiresMountsFor=/var/log/journal
[Service]
ExecStart=@rootbindir@/journalctl --flush
commit fddbb89c46ea5d39e52e361b390ea34a06cbb67c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Oct 30 20:53:23 2014 +0100
nspawn: don't make up -1 as error code
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index d88987a..7e96efd 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2931,33 +2931,30 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
}
switch (status.si_code) {
+
case CLD_EXITED:
r = status.si_status;
if (r == 0) {
if (!arg_quiet)
- log_debug("Container %s exited successfully.",
- arg_machine);
+ log_debug("Container %s exited successfully.", arg_machine);
*container = CONTAINER_TERMINATED;
- } else {
- log_error("Container %s failed with error code %i.",
- arg_machine, status.si_status);
- }
+ } else
+ log_error("Container %s failed with error code %i.", arg_machine, status.si_status);
+
break;
case CLD_KILLED:
if (status.si_status == SIGINT) {
if (!arg_quiet)
- log_info("Container %s has been shut down.",
- arg_machine);
+ log_info("Container %s has been shut down.", arg_machine);
*container = CONTAINER_TERMINATED;
r = 0;
break;
} else if (status.si_status == SIGHUP) {
if (!arg_quiet)
- log_info("Container %s is being rebooted.",
- arg_machine);
+ log_info("Container %s is being rebooted.", arg_machine);
*container = CONTAINER_REBOOTED;
r = 0;
@@ -2966,15 +2963,13 @@ static int wait_for_container(pid_t pid, ContainerStatus *container) {
/* CLD_KILLED fallthrough */
case CLD_DUMPED:
- log_error("Container %s terminated by signal %s.",
- arg_machine, signal_to_string(status.si_status));
- r = -1;
+ log_error("Container %s terminated by signal %s.", arg_machine, signal_to_string(status.si_status));
+ r = -EIO;
break;
default:
- log_error("Container %s failed due to unknown reason.",
- arg_machine);
- r = -1;
+ log_error("Container %s failed due to unknown reason.", arg_machine);
+ r = -EIO;
break;
}
More information about the systemd-commits
mailing list