Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman pull, inside qm, fails on OStree image: no space left on device #584

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions docs/qm containers.conf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Title: How to change the variables in qm containers.conf

## Description

The `container.conf` file needs to be modified to allow pulling images larger than 1G from the repository on OStree images.

Input:

## Update container image_copy_tmp_dir if the image is an OStree

1. Create /var/qm/tmp.dir or differently named directory on host.
2. Create /etc/qm/containers/containers.conf.d or differently named directory on host.
3. Create and edit /etc/qm/containers/containers.conf.d/qm_image_tmp_dir.conf or differently named *.conf file and add the following lines:
[engine]
image_copy_tmp_dir="/var/tmp.dir"

## Sample code should look like this

<https://github.com/nsednev/qm/blob/3bbe302791ea5d0f271a1cc96ed6bce4d4b99de2/tests/ffi/common/prepare.sh#L76-L79>

By default image_copy_tmp_dir="/var/tmp".
Changing its default value to /var/tmp.dir will allow the container to pull images larger than 1G.

This is a work around and it should not be used constantly.

## Expected result

Containers on host will be able to pull images larger than 1G.
41 changes: 41 additions & 0 deletions tests/ffi/common/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,30 @@
. ../../e2e/lib/utils

DROP_IN_DIR="/etc/containers/systemd/qm.container.d/"
OSTREE_PATH="/run/ostree"
export QM_HOST_REGISTRY_DIR="/var/qm/lib/containers/registry"
export QM_REGISTRY_DIR="/var/lib/containers/registry"
export QM_TMP_DIR="/var/tmp.dir"
export CONTAINERS_CONF_DIR="/etc/qm/containers/containers.conf.d"
export QM_IMAGE_TMP_DIR_CONF="qm_image_tmp_dir.conf"

# Checks if the system is running under OSTree.
# This function determines if the system is using OSTree by checking for the
# existence of the directory specified by the OSTREE_PATH environment variable.
# Returns:
# 0 (success) if the OSTREE_PATH directory exists, indicating the system is
# running under OSTree.
# 1 (failure) if the OSTREE_PATH directory does not exist, indicating the
# system is not running under OSTree.
is_ostree() {
if [ -d "${OSTREE_PATH}" ]; then
echo "The system is running under OSTree."
return 0
else
echo "The system is not running under OSTree."
return 1
fi
}

prepare_test() {
# Search variables for update file in qm.container
Expand Down Expand Up @@ -37,6 +59,25 @@ reload_config() {
}

prepare_images() {
# Update container image_copy_tmp_dir if the image is an OStree.
# Default location for storing temporary container image content. Can be overridden with the TMPDIR environment
# variable. If you specify "storage", then the location of the
# container/storage tmp directory will be used.
# By default image_copy_tmp_dir="/var/tmp"
# This is a work around and it should not be used constantly
# This script checks if the directory /run/ostree exists.
# If it does, it executes the following commands:
# 1. Creates the directory /var/qm/tmp.dir if it does not already exist.
# 2. Creates the directory /etc/qm/containers/containers.conf.d if it does not already exist.
# 3. Writes a configuration file qm_image_tmp_dir.conf in /etc/qm/containers/containers.conf.d
# with the content specifying the temporary directory for image copying as /var/tmp.dir.

if is_ostree; then
exec_cmd "mkdir -p /var/qm/tmp.dir"
Yarboa marked this conversation as resolved.
Show resolved Hide resolved
exec_cmd "mkdir -p ${CONTAINERS_CONF_DIR}"
exec_cmd "echo -e '[engine]\nimage_copy_tmp_dir=\"${QM_TMP_DIR}\"' > ${CONTAINERS_CONF_DIR}/${QM_IMAGE_TMP_DIR_CONF}"
fi

exec_cmd "podman pull quay.io/centos-sig-automotive/ffi-tools:latest"
# Copy container image registry to /var/qm/lib/containers
image_id=$(podman images | grep quay.io/centos-sig-automotive/ffi-tools | awk -F " " '{print $3}')
Expand Down
Loading