nspawn: hook var-lib-machines.mount to machines.target and remote-fs.target

/var can be on a remote filesystem, thus hooking it to local-fs.target is not correct.

Also, only install the mount unit when machined is enabled, because
machined is the one managing the underlying device, and thus makes no
sense without machined.

Fixes #1175
This commit is contained in:
Felipe Sateler 2017-06-21 16:04:38 -04:00
parent be5bd2ec62
commit 78d1039d6b
2 changed files with 18 additions and 4 deletions

View File

@ -269,8 +269,10 @@ INSTALL_DIRS =
SHUTDOWN_TARGET_WANTS =
LOCAL_FS_TARGET_WANTS =
REMOTE_FS_TARGET_WANTS =
MULTI_USER_TARGET_WANTS =
GRAPHICAL_TARGET_WANTS =
MACHINES_TARGET_WANTS =
RESCUE_TARGET_WANTS =
SYSINIT_TARGET_WANTS =
SOCKETS_TARGET_WANTS =
@ -287,6 +289,8 @@ GENERAL_ALIASES =
install-target-wants-hook:
what="$(SHUTDOWN_TARGET_WANTS)" && wants=shutdown.target && dir=$(systemunitdir) && $(add-wants)
what="$(LOCAL_FS_TARGET_WANTS)" && wants=local-fs.target && dir=$(systemunitdir) && $(add-wants)
what="$(REMOTE_FS_TARGET_WANTS)" && wants=remote-fs.target && dir=$(systemunitdir) && $(add-wants)
what="$(MACHINES_TARGET_WANTS)" && wants=machines.target && dir=$(systemunitdir) && $(add-wants)
what="$(MULTI_USER_TARGET_WANTS)" && wants=multi-user.target && dir=$(systemunitdir) && $(add-wants)
what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
what="$(RESCUE_TARGET_WANTS)" && wants=rescue.target && dir=$(systemunitdir) && $(add-wants)
@ -539,7 +543,6 @@ dist_systemunit_DATA = \
units/sys-kernel-debug.mount \
units/sys-fs-fuse-connections.mount \
units/tmp.mount \
units/var-lib-machines.mount \
units/printer.target \
units/sound.target \
units/bluetooth.target \
@ -5322,6 +5325,10 @@ endif
# ------------------------------------------------------------------------------
if ENABLE_MACHINED
dist_systemunit_DATA += \
units/var-lib-machines.mount
systemd_machined_SOURCES = \
src/machine/machined.c \
src/machine/machined.h
@ -6568,7 +6575,9 @@ SYSINIT_TARGET_WANTS += \
LOCAL_FS_TARGET_WANTS += \
systemd-remount-fs.service \
tmp.mount \
tmp.mount
REMOTE_FS_TARGET_WANTS += \
var-lib-machines.mount
MULTI_USER_TARGET_WANTS += \
@ -6584,6 +6593,11 @@ SYSINIT_TARGET_WANTS += \
systemd-sysctl.service \
systemd-ask-password-console.path
if ENABLE_MACHINED
MACHINES_TARGET_WANTS += \
var-lib-machines.mount
endif
if HAVE_SYSV_COMPAT
SYSTEM_UNIT_ALIASES += \
poweroff.target runlevel0.target \

View File

@ -101,8 +101,8 @@ units = [
['timers.target', ''],
['umount.target', ''],
['user.slice', ''],
['var-lib-machines.mount', '',
'local-fs.target.wants/'],
['var-lib-machines.mount', 'ENABLE_MACHINED',
'remote-fs.target.wants/ machines.target.wants/'],
]
in_units = [