SHA256
1
0
forked from pool/systemd
systemd/systemd-228-nspawn-make-journal-linking-non-fatal-in-try-and-auto.diff
Dominique Leuenberger 62682e6e22 Accepting request 384339 from Base:System
- Fix patch patch handle-numlock-value-in-etc-sysconfig-keyboard.patch
  that is do not close a file descriptor twice (boo#973907) 

- Add two patches which address logind/networkd disappearing from
  dbus (and busctl) even while the units and processes continue
  running.
  0001-core-fix-bus-name-synchronization-after-daemon-reloa.patch
  0001-core-re-sync-bus-name-list-after-deserializing-durin.patch

- drop all compiler/linker option customizations:
  - -pipe option is used by default since day 0
  - get rid of cflags() function which is not needed
  - --hash-size has no impact specially in runtime
  IOW, use the default options for the compiler and the linker,
  there's no point in making systemd different from other package in
  this regards.

- use %make_build instead of 'make %{?_smp_mflags}'

- be more strict on own lib version requirements

- systemd should require udev with the exact same version

- Modify patch handle-numlock-value-in-etc-sysconfig-keyboard.patch
  to allow that open, seek, and read of /dev/mem may fail e.g.
  on XEN based virtual guests (bsc#961120) 

- require curl and bzip2 to build importd
- curl also causes building of journal-upload. That one has rather
  unusal certificate usage, set it's ca root to /etc/pki/systemd

OBS-URL: https://build.opensuse.org/request/show/384339
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=232
2016-04-08 07:35:10 +00:00

117 lines
4.4 KiB
Diff

From 84d816c48b57b43e833e2917bbd278c116816fcf Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 28 Jan 2016 20:15:49 +0100
Subject: [PATCH] nspawn: make journal linking non-fatal in try and auto modes
Fixes #2091
---
src/nspawn/nspawn.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index f6a2c03..97ea51a 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1338,6 +1338,7 @@ static int setup_journal(const char *directory) {
sd_id128_t machine_id, this_id;
_cleanup_free_ char *b = NULL, *d = NULL;
const char *etc_machine_id, *p, *q;
+ bool try;
char *id;
int r;
@@ -1345,16 +1346,21 @@ static int setup_journal(const char *directory) {
if (arg_ephemeral)
return 0;
+ if (arg_link_journal == LINK_NO)
+ return 0;
+
+ try = arg_link_journal_try || arg_link_journal == LINK_AUTO;
+
etc_machine_id = prefix_roota(directory, "/etc/machine-id");
r = read_one_line_file(etc_machine_id, &b);
- if (r == -ENOENT && arg_link_journal == LINK_AUTO)
+ if (r == -ENOENT && try)
return 0;
else if (r < 0)
return log_error_errno(r, "Failed to read machine ID from %s: %m", etc_machine_id);
id = strstrip(b);
- if (isempty(id) && arg_link_journal == LINK_AUTO)
+ if (isempty(id) && try)
return 0;
/* Verify validity */
@@ -1367,16 +1373,13 @@ static int setup_journal(const char *directory) {
return log_error_errno(r, "Failed to retrieve machine ID: %m");
if (sd_id128_equal(machine_id, this_id)) {
- log_full(arg_link_journal == LINK_AUTO ? LOG_WARNING : LOG_ERR,
+ log_full(try ? LOG_WARNING : LOG_ERR,
"Host and machine ids are equal (%s): refusing to link journals", id);
- if (arg_link_journal == LINK_AUTO)
+ if (try)
return 0;
return -EEXIST;
}
- if (arg_link_journal == LINK_NO)
- return 0;
-
r = userns_mkdir(directory, "/var", 0755, 0, 0);
if (r < 0)
return log_error_errno(r, "Failed to create /var: %m");
@@ -1393,21 +1396,19 @@ static int setup_journal(const char *directory) {
q = prefix_roota(directory, p);
if (path_is_mount_point(p, 0) > 0) {
- if (arg_link_journal != LINK_AUTO) {
- log_error("%s: already a mount point, refusing to use for journal", p);
- return -EEXIST;
- }
+ if (try)
+ return 0;
- return 0;
+ log_error("%s: already a mount point, refusing to use for journal", p);
+ return -EEXIST;
}
if (path_is_mount_point(q, 0) > 0) {
- if (arg_link_journal != LINK_AUTO) {
- log_error("%s: already a mount point, refusing to use for journal", q);
- return -EEXIST;
- }
+ if (try)
+ return 0;
- return 0;
+ log_error("%s: already a mount point, refusing to use for journal", q);
+ return -EEXIST;
}
r = readlink_and_make_absolute(p, &d);
@@ -1441,7 +1442,7 @@ static int setup_journal(const char *directory) {
if (arg_link_journal == LINK_GUEST) {
if (symlink(q, p) < 0) {
- if (arg_link_journal_try) {
+ if (try) {
log_debug_errno(errno, "Failed to symlink %s to %s, skipping journal setup: %m", q, p);
return 0;
} else
@@ -1459,7 +1460,7 @@ static int setup_journal(const char *directory) {
* permanent journal set up, don't force it here */
r = mkdir(p, 0755);
if (r < 0) {
- if (arg_link_journal_try) {
+ if (try) {
log_debug_errno(errno, "Failed to create %s, skipping journal setup: %m", p);
return 0;
} else
--
2.7.0