1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
summary: Ensure that the microstack-support device delegation works.
details: |
The microstack-support interface delegates device cgroup handling to the
snap.
environment:
SNAP_NAME: test-snapd-sh
prepare: |
"$TESTSTOOLS"/snaps-state install-local test-snapd-sh
restore: |
snap remove --purge test-snapd-sh
if os.query is-xenial || os.query is-bionic; then
# old system is not doing cleanups
find /sys/fs/cgroup/ -type d -name "snap.*" -prune | while read -r svc; do
rmdir "$svc" || true
done
fi
execute: |
echo "When the interface is connected"
snap connect "$SNAP_NAME":microstack-support
snap restart "$SNAP_NAME"
retry -n 50 --wait 0.1 sh -c "test -f /var/snap/$SNAP_NAME/common/proc_self_cgroup"
CGROUP=$(grep ':devices:' "/var/snap/$SNAP_NAME/common/proc_self_cgroup" | cut -d':' -f3)
if [ -n "$CGROUP" ]; then
# cgroup v1
echo "Service cgroup v1 is $CGROUP"
MATCH 'a \*:\* rwm' < "/sys/fs/cgroup/devices/$CGROUP/devices.list"
else
# cgroup v2
CGROUP=$(grep '^0:' "/var/snap/$SNAP_NAME/common/proc_self_cgroup" | cut -d':' -f3)
echo "Service cgroup v2 is $CGROUP"
NOMATCH 'device' < "/sys/fs/cgroup/$CGROUP/cgroup.controllers"
fi
|