Last active
May 4, 2024 21:23
-
-
Save relvinhas/a60845913f8bcfdd8592c57e34374459 to your computer and use it in GitHub Desktop.
DANOS VM Setup - Passthrough and CPU pinning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
virsh destroy edge-router | |
virsh undefine --nvram edge-router | |
virsh vol-delete edge-router --pool fast-storage | |
virt-install \ | |
--name edge-router \ | |
--cpu host-passthrough \ | |
--vcpus=4,sockets=1,cores=4,threads=1 \ | |
--ram 2048 \ | |
--os-variant debian10 \ | |
--boot cdrom \ | |
--disk path=/var/lib/libvirt/boot/danos-2005-base-amd64.iso,device=cdrom,bus=sata \ | |
--disk path=/dev/fast-storage/edge-router,bus=virtio,size=16 \ | |
--noautoconsole \ | |
--autostart \ | |
--graphics none \ | |
--network type=direct,source=eno1,source_mode=passthrough,model=virtio \ | |
--network type=direct,source=eno2,source_mode=passthrough,model=virtio \ | |
--host-device=pci_0000_06_00_2 \ | |
--host-device=pci_0000_06_00_3 \ | |
--print-xml > edge-router.xml | |
read -r -d '' CPU_CONFIG << 'EOF' | |
<vcpu>4</vcpu> | |
<vcpu placement="static">4</vcpu> | |
<iothreads>4</iothreads> | |
<cputune> | |
<vcpupin vcpu="0" cpuset="2"/> | |
<vcpupin vcpu="1" cpuset="3"/> | |
<vcpupin vcpu="2" cpuset="4"/> | |
<vcpupin vcpu="3" cpuset="5"/> | |
<iothreadpin iothread="1" cpuset="2"/> | |
<iothreadpin iothread="2" cpuset="3"/> | |
<iothreadpin iothread="3" cpuset="4"/> | |
<iothreadpin iothread="4" cpuset="5"/> | |
<iothreadsched iothreads="4" scheduler="fifo" priority="99"/> | |
</cputune> | |
EOF | |
sed -i "s%<vcpu>4</vcpu>%${CPU_CONFIG//$'\n'}%g" edge-router.xml | |
virsh define edge-router.xml | |
virsh start edge-router --console | |
################################################################################ | |
tmpuser/tmppwd | |
install image | |
poweroff | |
################################################################################ | |
echo $(tr -d '\n' < edge-router.xml) > edge-router.xml | |
sed -i 's%<boot dev="cdrom"/>%%g' edge-router.xml | |
sed -i 's%<disk type="file" device="cdrom">.*<disk%<disk%g' edge-router.xml | |
# If you testing this multiple times... Be lazy. | |
# virsh vol-clone edge-router edge-router_snapshot --pool=fast-storage | |
virsh define edge-router.xml | |
virsh start edge-router --console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference host network interfaces:
Broadcom interfaces are not detected in DANOS 2005, so virtio interfaces are used instead (eno1, eno2).