|
|
47313b1 |
From db2241b5259671c2a7435235f5fc560ba4e97077 Mon Sep 17 00:00:00 2001
|
|
|
b397f2a |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
b397f2a |
Date: Sun, 2 Nov 2014 12:19:38 -0500
|
|
|
b397f2a |
Subject: [PATCH] manager: do not print timing when running in test mode
|
|
|
b397f2a |
|
|
|
b397f2a |
(cherry picked from commit 56dacdbc1ca95cef8bf8c97c0d7af761a71eaab3)
|
|
|
b397f2a |
---
|
|
|
b397f2a |
src/core/manager.c | 84 ++++++++++++++++++++++++++++++------------------------
|
|
|
b397f2a |
1 file changed, 46 insertions(+), 38 deletions(-)
|
|
|
b397f2a |
|
|
|
b397f2a |
diff --git a/src/core/manager.c b/src/core/manager.c
|
|
|
b397f2a |
index d427d88d4e..ff29ae1d9d 100644
|
|
|
b397f2a |
--- a/src/core/manager.c
|
|
|
b397f2a |
+++ b/src/core/manager.c
|
|
|
b397f2a |
@@ -2584,45 +2584,13 @@ bool manager_unit_inactive_or_pending(Manager *m, const char *name) {
|
|
|
b397f2a |
return unit_inactive_or_pending(u);
|
|
|
b397f2a |
}
|
|
|
b397f2a |
|
|
|
b397f2a |
-void manager_check_finished(Manager *m) {
|
|
|
b397f2a |
+static void manager_notify_finished(Manager *m) {
|
|
|
b397f2a |
char userspace[FORMAT_TIMESPAN_MAX], initrd[FORMAT_TIMESPAN_MAX], kernel[FORMAT_TIMESPAN_MAX], sum[FORMAT_TIMESPAN_MAX];
|
|
|
b397f2a |
usec_t firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec;
|
|
|
b397f2a |
- Unit *u = NULL;
|
|
|
b397f2a |
- Iterator i;
|
|
|
b397f2a |
|
|
|
b397f2a |
- assert(m);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- if (m->n_running_jobs == 0)
|
|
|
b397f2a |
- m->jobs_in_progress_event_source = sd_event_source_unref(m->jobs_in_progress_event_source);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- if (hashmap_size(m->jobs) > 0) {
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- if (m->jobs_in_progress_event_source)
|
|
|
b397f2a |
- sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- return;
|
|
|
b397f2a |
- }
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- manager_flip_auto_status(m, false);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- /* Notify Type=idle units that we are done now */
|
|
|
b397f2a |
- m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
|
|
|
b397f2a |
- manager_close_idle_pipe(m);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- /* Turn off confirm spawn now */
|
|
|
b397f2a |
- m->confirm_spawn = false;
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- /* No need to update ask password status when we're going non-interactive */
|
|
|
b397f2a |
- manager_close_ask_password(m);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- /* This is no longer the first boot */
|
|
|
b397f2a |
- manager_set_first_boot(m, false);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
- if (dual_timestamp_is_set(&m->finish_timestamp))
|
|
|
b397f2a |
+ if (m->test_run)
|
|
|
b397f2a |
return;
|
|
|
b397f2a |
|
|
|
b397f2a |
- dual_timestamp_get(&m->finish_timestamp);
|
|
|
b397f2a |
-
|
|
|
b397f2a |
if (m->running_as == SYSTEMD_SYSTEM && detect_container(NULL) <= 0) {
|
|
|
b397f2a |
|
|
|
b397f2a |
/* Note that m->kernel_usec.monotonic is always at 0,
|
|
|
b397f2a |
@@ -2677,10 +2645,6 @@ void manager_check_finished(Manager *m) {
|
|
|
b397f2a |
NULL);
|
|
|
b397f2a |
}
|
|
|
b397f2a |
|
|
|
b397f2a |
- SET_FOREACH(u, m->startup_units, i)
|
|
|
b397f2a |
- if (u->cgroup_path)
|
|
|
b397f2a |
- cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
|
|
|
b397f2a |
-
|
|
|
b397f2a |
bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec);
|
|
|
b397f2a |
|
|
|
b397f2a |
sd_notifyf(false,
|
|
|
b397f2a |
@@ -2689,6 +2653,50 @@ void manager_check_finished(Manager *m) {
|
|
|
b397f2a |
format_timespan(sum, sizeof(sum), total_usec, USEC_PER_MSEC));
|
|
|
b397f2a |
}
|
|
|
b397f2a |
|
|
|
b397f2a |
+void manager_check_finished(Manager *m) {
|
|
|
b397f2a |
+ Unit *u = NULL;
|
|
|
b397f2a |
+ Iterator i;
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ assert(m);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ if (m->n_running_jobs == 0)
|
|
|
b397f2a |
+ m->jobs_in_progress_event_source = sd_event_source_unref(m->jobs_in_progress_event_source);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ if (hashmap_size(m->jobs) > 0) {
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ if (m->jobs_in_progress_event_source)
|
|
|
b397f2a |
+ sd_event_source_set_time(m->jobs_in_progress_event_source, now(CLOCK_MONOTONIC) + JOBS_IN_PROGRESS_WAIT_USEC);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ return;
|
|
|
b397f2a |
+ }
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ manager_flip_auto_status(m, false);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ /* Notify Type=idle units that we are done now */
|
|
|
b397f2a |
+ m->idle_pipe_event_source = sd_event_source_unref(m->idle_pipe_event_source);
|
|
|
b397f2a |
+ manager_close_idle_pipe(m);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ /* Turn off confirm spawn now */
|
|
|
b397f2a |
+ m->confirm_spawn = false;
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ /* No need to update ask password status when we're going non-interactive */
|
|
|
b397f2a |
+ manager_close_ask_password(m);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ /* This is no longer the first boot */
|
|
|
b397f2a |
+ manager_set_first_boot(m, false);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ if (dual_timestamp_is_set(&m->finish_timestamp))
|
|
|
b397f2a |
+ return;
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ dual_timestamp_get(&m->finish_timestamp);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ manager_notify_finished(m);
|
|
|
b397f2a |
+
|
|
|
b397f2a |
+ SET_FOREACH(u, m->startup_units, i)
|
|
|
b397f2a |
+ if (u->cgroup_path)
|
|
|
b397f2a |
+ cgroup_context_apply(unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path, manager_state(m));
|
|
|
b397f2a |
+}
|
|
|
b397f2a |
+
|
|
|
b397f2a |
static int create_generator_dir(Manager *m, char **generator, const char *name) {
|
|
|
b397f2a |
char *p;
|
|
|
b397f2a |
int r;
|