Skip to content

Commit

Permalink
create unique devmapper per container
Browse files Browse the repository at this point in the history
Signed-off-by: Shyam Jesalpura s.jesalpura@gmail.com
  • Loading branch information
shyamjesal committed Jan 23, 2021
1 parent 419f3a9 commit 6b09be2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
15 changes: 12 additions & 3 deletions scripts/clean_fcctr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,18 @@ for d in `find /var/lib/cni/ -mindepth 1 -maxdepth 1 -type d | grep -v networks
sudo rm -rf $d
done

echo Removing devmapper devices
for de in `sudo dmsetup ls| cut -f1|grep snap`; do sudo dmsetup remove $de && echo Removed $de; done
sudo dmsetup remove fc-dev-thinpool
CONTAINERID=$(basename $(cat /proc/1/cpuset))

if [ 64 -eq ${#CONTAINERID} ]; then
echo Removing devmapper devices
for de in `sudo dmsetup ls| cut -f1|grep $CONTAINERID |grep snap`; do sudo dmsetup remove $de && echo Removed $de; done
sudo dmsetup remove "${CONTAINERID}_thinpool"
else
echo Removing devmapper devices
for de in `sudo dmsetup ls| cut -f1|grep snap`; do sudo dmsetup remove $de && echo Removed $de; done
sudo dmsetup remove fc-dev-thinpool
fi


echo Cleaning /var/lib/firecracker-containerd/*
for d in containerd shim-base snapshotter; do sudo rm -rf /var/lib/firecracker-containerd/$d; done
Expand Down
6 changes: 6 additions & 0 deletions scripts/create_devmapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ pushd /var/lib/firecracker-containerd/snapshotter/devmapper > /dev/null
DIR=/var/lib/firecracker-containerd/snapshotter/devmapper
POOL=fc-dev-thinpool

CONTAINERID=$(basename $(cat /proc/1/cpuset))

if [ 64 -eq ${#CONTAINERID} ]; then
POOL="${CONTAINERID}_thinpool"
fi

if [[ ! -f "${DIR}/data" ]]; then
sudo touch "${DIR}/data"
sudo truncate -s 100G "${DIR}/data"
Expand Down
7 changes: 7 additions & 0 deletions scripts/setup_containerd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ sudo cp $BINS/default-rootfs.img /var/lib/firecracker-containerd/runtime/
sudo curl -fsSL -o /var/lib/firecracker-containerd/runtime/hello-vmlinux.bin https://s3.amazonaws.com/spec.ccfc.min/img/hello/kernel/hello-vmlinux.bin

sudo cp $CONFIGS/config.toml /etc/firecracker-containerd/

CONTAINERID=$(basename $(cat /proc/1/cpuset))

if [ 64 -eq ${#CONTAINERID} ]; then
sudo sed -i "s/search_string/${CONTAINERID}_thinpool/" /etc/firecracker-containerd/config.toml
fi

sudo cp $CONFIGS/firecracker-runtime.json /etc/containerd/
4 changes: 2 additions & 2 deletions scripts/test_runner/setup_runner_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ sudo add-apt-repository \
stable"

sudo apt-get update
sudo apt-get install --yes docker-ce docker-ce-cli containerd.io
sudo apt-get install --yes docker-ce docker-ce-cli containerd.io >> /dev/null

sudo usermod -aG docker $USER
newgrp docker
newgrp docker

0 comments on commit 6b09be2

Please sign in to comment.