Use QEMU install a Fedora VM and build up virtual RDMA NIC

Goal: I need to add live migration support for the PVRDMA device under QEMU. So I need to install a QEMU from source code and make the migration is supported via RDMA.

First step, install QEMU from source code. Please notice you only require to compile the module under x86_64 arch. To support install with visual interfaces, you should enable sdl with apt install libsdl2-dev

1
2
3
4
git clone git@github.com:qemu/qemu.git
sudo ../configure --target-list=x86_64-linux-user,x86_64-softmmu --enable-sdl
make -j
make install

Second step, build a Fedora VM from image. In this step, we should carefully choose the candidate image. A recommended method is to use a workstation version of OS image. After that, mount the image to execute a standard install processing.

1
2
3
sudo proxychains wget https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/27/Workstation/x86_64/iso/Fedora-Workstation-Live-x86_64-27-1.6.iso
sudo qemu-img create ubuntu.img 10G
sudo qemu-system-x86_64 --enable-kvm -m 4096 -smp 4 ubuntu.img -drive file=Fedora-Workstation-Live-x86_64-27-1.6.iso,media=cdrom,index=1 -drive file=ks.iso,mle=ttyS0 ks=cdrom:/ks.cfg" -kernel tmp/isolinux/vmlinuz -initrd tmp/isolinux/initrd.img

TODO