test: don't register short-living containers with machined, again
Otherwise we might try to register the same scope again before the previous instance gets a chance to be cleaned up: [ 54.378392] systemd-nspawn[2554]: ░ Spawning container TEST-13-NSPAWN.defaultinaccessiblepaths.nxs on /var/lib/machines/TEST-13-NSPAWN.default_inaccessible_paths.nxs. [ 54.382202] systemd-nspawn[2554]: Failed to allocate scope: Unit TEST-13-NSPAWN.defaultinaccessiblepaths.nxs.scope was already loaded or has a fragment file. [ 54.411211] systemd[1]: TEST-13-NSPAWN.service: Main process exited, code=exited, status=1/FAILURE [ 54.411413] systemd[1]: TEST-13-NSPAWN.service: Failed with result 'exit-code'. [ 54.411885] systemd[1]: Failed to start TEST-13-NSPAWN.service - TEST-13-NSPAWN. This is basically the same change as in6a05abb9b4but for the newly added tests. Follow-up for83b8daa032. Resolves: #40945
This commit is contained in:
committed by
Luca Boccassi
parent
899992bc1e
commit
acf00ba7b5
@@ -414,7 +414,7 @@ testcase_check_default_inaccessible_paths() {
|
||||
|
||||
# Each inaccessible path should have zeroed permissions, which stat's %a reports as a single 0
|
||||
for path in "${inaccessible_paths[@]}"; do
|
||||
systemd-nspawn --directory="$root" \
|
||||
systemd-nspawn --register=no --directory="$root" \
|
||||
bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq 0 ]]"
|
||||
done
|
||||
|
||||
@@ -422,14 +422,14 @@ testcase_check_default_inaccessible_paths() {
|
||||
# as writable, and it also skips the path masking (by dropping the MOUNT_APPLY_APIVFS_RO flag)
|
||||
for path in "${inaccessible_paths[@]}"; do
|
||||
exp="$(stat --format=%a "$path")"
|
||||
SYSTEMD_NSPAWN_API_VFS_WRITABLE=yes systemd-nspawn --directory="$root" \
|
||||
SYSTEMD_NSPAWN_API_VFS_WRITABLE=yes systemd-nspawn --register=no --directory="$root" \
|
||||
bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq $exp ]]"
|
||||
done
|
||||
|
||||
# SYSTEMD_NSPAWN_API_VFS_WRITABLE=network mounts only /proc/sys/net/ as writable but doesn't
|
||||
# drop the MOUNT_APPLY_APIVFS_RO flag, so the masking should still apply
|
||||
for path in "${inaccessible_paths[@]}"; do
|
||||
SYSTEMD_NSPAWN_API_VFS_WRITABLE=network systemd-nspawn --directory="$root" \
|
||||
SYSTEMD_NSPAWN_API_VFS_WRITABLE=network systemd-nspawn --register=no --directory="$root" \
|
||||
bash -xec "ls -l $path; [[ \$(stat --format=%a $path) -eq 0 ]]"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user