Skip to content

Commit

Permalink
Merge pull request #22831 from Luap99/system-tmpfs
Browse files Browse the repository at this point in the history
CI: mount tmpfs for container storage
  • Loading branch information
openshift-merge-bot[bot] authored Jul 4, 2024
2 parents 189d862 + fad1f75 commit d1a258b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ setup_rootless() {
showrun groupadd -g $rootless_gid $ROOTLESS_USER
showrun useradd -g $rootless_gid -u $rootless_uid --no-user-group --create-home $ROOTLESS_USER

# use tmpfs to speed up IO
mount -t tmpfs -o size=75%,mode=0700,uid=$rootless_uid,gid=$rootless_gid none /home/$ROOTLESS_USER

echo "$ROOTLESS_USER ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/ci-rootless

mkdir -p "$HOME/.ssh" "/home/$ROOTLESS_USER/.ssh"
Expand Down
8 changes: 4 additions & 4 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"
EOF

# Since we've potentially changed important config settings, reset.
# This prevents `database graph driver "" does not match "overlay"`
# on Debian.
rm -rf /var/lib/containers/storage

# mount a tmpfs for the container storage to speed up the IO
# side effect is we clear all potentially pre existing data so we know we always start "clean"
mount -t tmpfs -o size=75%,mode=0700 none /var/lib/containers

# shellcheck disable=SC2154
showrun echo "Setting CI_DESIRED_STORAGE [=$CI_DESIRED_STORAGE] for *e2e* tests"
Expand Down
11 changes: 9 additions & 2 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,15 @@ EOF
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs"

CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image stat -f -c %T /data
assert "$output" != "tmpfs" "Should match hosts $fs"
# get the hostfs first so we can match it below
run_podman info --format {{.Store.GraphRoot}}
hostfs=$(stat -f -c %T $output)

# stat -f -c %T seems to just return unknown for our normal bind mount for some reason.
# Therfore manually parse /proc/mounts to get the real fs for the bind mount.
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image \
sh -c "grep ' /data ' /proc/mounts | cut -f3 -d' '"
assert "$output" == "$hostfs" "Should match hosts graphroot fs"

CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume tmpfs --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs"
Expand Down

0 comments on commit d1a258b

Please sign in to comment.