Skip to content

VM Setup

husainnk edited this page Apr 5, 2024 · 14 revisions

This page explains the procedure to setup virtual machines for scaled-out execution across two x86-VMs

 QEMU VM #1                  QEMU VM #2
┌───────────┐               ┌───────────┐
│           │ TAP interface │           │
│DSM-Server ├<─────────────>┤ DSM-Client│
│           │               │           │
└───────────┘               └───────────┘
 10.0.1.100                  10.2.1.100

[Step 1] Download VMs

Download the images from Googe Drive. Unzip and note the path of the images folder

[Step 2] Setup Tap Network

Replace wlx6c5ab0385cfb with your WLAN interface

sudo ip tuntap add mode tap tap0
sudo ip addr add 10.2.0.1/24 dev tap0
sudo ip link set tap0 up

sudo ip tuntap add mode tap tap1
sudo ip addr add 10.2.1.1/24 dev tap1
sudo ip link set tap1 up

sudo iptables -t nat -A POSTROUTING -o wlx6c5ab0385cfb -j MASQUERADE
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

[Step 3] Launch VMs

DSM Server VM

IMAGE_PATH=<Image Directory Path>

KERNEL=${IMAGE_PATH}/bzImage
IMAGE_1=${IMAGE_PATH}/buster.img

# Launch first VM (username: root)
qemu-system-x86_64 -smp 4 -M q35 -device qemu-xhci,id=xhci -m 4G -enable-kvm  -kernel $KERNEL -append "root=/dev/sda ro console=ttyS0" -hda ${IMAGE_1} -no-reboot -nographic   -net nic,macaddr=00:da:bc:de:00:13 -net tap,ifname=tap0

# Open another terminal, Launch second VM (username: root)

qemu-system-x86_64 -smp 4 -M q35 -device qemu-xhci,id=xhci -m 4G -enable-kvm  -kernel $KERNEL -append "root=/dev/sda ro console=ttyS0" -hda ${IMAGE_2} -no-reboot -nographic   -net nic,macaddr=00:da:bc:de:02:11 -net tap,ifname=tap1

DSM Client VM

IMAGE_PATH=<Image Directory Path>

KERNEL=${IMAGE_PATH}/bzImage
IMAGE_2=${IMAGE_PATH}/buster_2.img

qemu-system-x86_64 -smp 4 -M q35 -device qemu-xhci,id=xhci -m 4G -enable-kvm  -kernel $KERNEL -append "root=/dev/sda ro console=ttyS0" -hda ${IMAGE_2} -no-reboot -nographic   -net nic,macaddr=00:da:bc:de:02:11 -net tap,ifname=tap1

[Step 4] Login into VMs using SSH and test the connection

Update your host with .ssh/config file by adding these configurations.

Host dsm_server
	HostName 10.2.0.100
	Port 22
	user root
	IdentityFile <Image Directory>/buster.id_rsa 

Host dsm_client
	HostName 10.2.1.100
	Port 22
	user root
	IdentityFile <Image Directory>/buster.id_rsa 

After saving the ssh config file, test your ssh connection

# to DSM Server
ssh dsm_server

# to DSM client
ssh dsm_client  

Once the ssh connection is tested, installed CRIU-RTX source code and compile in BOTH dsm_server and dsm_client VMs

git clone https://github.com/husainnk/criu-dsm.git  ; make -C criu-dsm/ -j4
cp -r  ~/criu-dsm/test/dsm_write/ . ; cp dsm_write/bin/dsm_write_x86-64 ~/dsm_write/dsm_write

[Step 5] Test the sample application

Three terminal sessions are required to test the scaled-out execution across two x86-64 VMs.

Terminal #1 - dsm_client.


 ~/criu-dsm/scripts/restorer.sh 1

Terminal #2 - dsm_server

Launch the sample app. It is an application with two threads writing on the same page.

cd ~/dsm_write;
sudo ./dsm_write 2

Terminal #3 - dsm_server

Initiate the scaled-out execution. After this command, you can then see the thread 2 resuming its execution in Terminal #1.

DUMP=1 ; ~/criu-dsm/scripts/dsm_dump_transform.sh  dsm_write dsm_client