Skip to content

Commit

Permalink
Adding some debug option to trace mount points and its permissions
Browse files Browse the repository at this point in the history
Adding unit attribute to support nestes podman exec inside qm

Signed-off-by: Yariv Rachmani <[email protected]>
  • Loading branch information
Yarboa committed Nov 27, 2023
1 parent 37b8ecf commit 5e0273b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
4 changes: 3 additions & 1 deletion plans/e2e/ffi.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ adjust:

- name: Set QM env
how: shell
# FIXME: On new QM release remove
# qm-setup-from-gh-url, branch-qm option
script: |
cd tests/e2e
./set-ffi-env-e2e --branch-qm=fix-qm-tmp-dir --qm-setup-from-gh-url=https://raw.githubusercontent.com/Yarboa
./set-ffi-env-e2e --branch-qm=main --qm-setup-from-gh-url=https://raw.githubusercontent.com/containers --set-qm-disk-part=Y
when: scenario == ffi and distro == centos-stream-9, fedora

execute:
Expand Down
4 changes: 4 additions & 0 deletions qm.container
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Exec=/sbin/init
Network=host
PodmanArgs=--pids-limit=-1 --security-opt label=nested --security-opt unmask=all
ReadOnly=true
# FIXME: QM is failing to start podman command
# Add back once this ReadOnlyTmpfs added to quadlet
# Ref: https://github.com/containers/podman/issues/20439
VolatileTmp=true
Rootfs=${ROOTFS}

# FIXME: QM is failing to start if SecurityLabelNested is enabled.
Expand Down
14 changes: 13 additions & 1 deletion tests/e2e/set-ffi-env-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export ARCH=""
export BUILD_BLUECHI_FROM_GH_URL=""
export QM_GH_URL=""
export BRANCH_QM=""
export SET_QM_PART=""

RED='\033[91m'
GRN='\033[92m'
Expand All @@ -54,6 +55,7 @@ CLR='\033[0m'
ARGUMENT_LIST=(
"qm-setup-from-gh-url"
"branch-qm"
"set-qm-disk-part"
)

usage() {
Expand All @@ -69,6 +71,8 @@ Usage: ./set-ffi-env-e2e [OPTIONS]
--branch-qm
Specify which branch the GitHub repo will be set. Requires --qm-setup-from-gh-url
--set-qm-disk-part
Specify if disk partition neede for /var/qm needed
Examples:
Expand All @@ -79,6 +83,7 @@ Examples:
./set-ffi-env-e2e \\
--branch-qm=superfeature \\
--qm-setup-from-gh-url=https://raw.githubusercontent.com/MYUSER/ \\
--set-qm-disk-part=Y \\
EOF
exit 0
Expand Down Expand Up @@ -109,6 +114,11 @@ while [ $# -gt 0 ]; do
shift 2
;;

--set-qm-disk-part)
SET_QM_PART="${2}"
shift 2
;;

--help)
usage
;;
Expand Down Expand Up @@ -202,7 +212,9 @@ info_message "Preparing QM environment"
info_message "=============================="

# Creates the QM env on VM
create_qm_disks
if [ -n "${SET_QM_PART}" ]; then
create_qm_disks
fi
install_qm_rpms
setup_qm_services

Expand Down
10 changes: 8 additions & 2 deletions tests/ffi/common/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ prepare_test() {
if_error_exit "cannot create temp dir under /tmp/"
exec_cmd "cp ${qm_service_file} ${qm_service_backup}"
# Remove 'DropCapability=sys_resource' enable nested container in QM
exec_cmd "sed -i 's/DropCapability=sys_resource/#DropCapability=sys_resource/' \
/etc/containers/systemd/qm.container"
exec_cmd "sed -i 's|DropCapability=sys_resource|#DropCapability=sys_resource|' \
${qm_service_file}"
# FIXME: QM is failing to start podman command
# Add back once this ReadOnlyTmpfs added to quadlet
# Ref: https://github.com/containers/podman/issues/20439
if ! grep "Volatile" "${qm_service_file}" ; then
exec_cmd "sed -i 's|ReadOnly=true|&\nVolatileTmp=true|' ${qm_service_file}"
fi
}

disk_cleanup() {
Expand Down
11 changes: 6 additions & 5 deletions tests/ffi/disk/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ disk_cleanup
prepare_test
reload_config

podman exec -it qm /bin/bash -c \
"podman run -d --replace --name ffi-qm quay.io/centos-sig-automotive/ffi-tools:latest \
tail -f /dev/null"
exec_cmd "podman exec -it qm /bin/bash -c \
'podman run -d --replace --name ffi-qm \
quay.io/centos-sig-automotive/ffi-tools:latest \
tail -f /dev/null'"

podman exec -it qm /bin/bash -c \
"podman exec -it ffi-qm ./QM/file-allocate > /dev/null"
exec_cmd "podman exec -it qm /bin/bash -c \
'podman exec -it ffi-qm ./QM/file-allocate > /dev/null'"

if ! eval "fallocate -l 2G /root/file.lock" ; then
echo "No space left on device"
Expand Down

0 comments on commit 5e0273b

Please sign in to comment.