Skip to content

Commit

Permalink
test/suites/idmap: test "lxc file push" and raw.idmap config combo
Browse files Browse the repository at this point in the history
Big thanks to Simon Fels (@morphis) for providing us with a reproducer.

Signed-off-by: Alexander Mikhalitsyn <[email protected]>
  • Loading branch information
mihalicyn committed Jan 11, 2024
1 parent 8940ff8 commit fdf9b9e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/suites/idmap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,25 @@ EOF
[ "$(stat -c '%u:%g' "/proc/${PID}/root/d")" = "$((UID_BASE+29)):$((GID_BASE+29))" ]

lxc delete idmap --force

# Respawn LXD with kernel ID shifting support disabled to force manual shifting.
shutdown_lxd "${LXD_DIR}"
lxdIdmappedMountsDisable=${LXD_IDMAPPED_MOUNTS_DISABLE:-}

export LXD_IDMAPPED_MOUNTS_DISABLE=1
respawn_lxd "${LXD_DIR}" true

lxc launch testimage c1 -c raw.idmap="both 1000 1000"
lxc stop c1 --force
TEST_FILE="${TEST_DIR}/raw_idmap_test_file"
touch "${TEST_FILE}"
lxc file push "${TEST_FILE}" c1/root/
rm -f "${TEST_FILE}"
lxc delete c1

# Respawn LXD to restore default kernel shifting support.
shutdown_lxd "${LXD_DIR}"
export LXD_IDMAPPED_MOUNTS_DISABLE="${lxdIdmappedMountsDisable}"

respawn_lxd "${LXD_DIR}" true
}

0 comments on commit fdf9b9e

Please sign in to comment.