add new ks files for the nested-hypervisor

This commit is contained in:
lukas 2021-07-02 14:21:13 +02:00
parent d0ab764b21
commit 8fa024f12b
3 changed files with 119 additions and 0 deletions

35
f34/vemdhad.cfg Normal file
View File

@ -0,0 +1,35 @@
# __ ____ ____ _____
# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/
# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \
# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ /
# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/
# /_/ /____/
# WHAT ? This Kickstart file bootstraps a minimal GNOME-based desktop-oriented virtual machine.
# 'v' for virtual machine, 'e' for efi, 'm' for minimal, 'd' for desktop, 'd' for development only.
# USAGE : Press the `tab` or 'e' key during POST and apend that after the 'quiet' string :
# inst.ks=https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdhad.cfg
# A shorter URL can also be used :
# inst.ks=https://url.phyllo.me/vemdhad.cfg
# ATTENTION : this kickstart file will automatically DESTROY the main virtual disk 'vda' and all of its contents.
# Bye bye!
%include https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdhd.cfg # Includes vemdhd.cfg, a minimal desktop-oriented nested-host ks file
%post # Beginning of %post section
# Load kernel modules in grub. Add `intel_iommu=on intel_iommu=pt` for Intel processors,
sed -i 's/\(quiet\)/\1 amd_iommu=on/i' /etc/default/grub
sed -i 's/\(amd_iommu=on\)/\1 amd_iommu=pt/i' /etc/default/grub
# Load specific kernel modules kvmgt and vfio-mdev, for Intel GVT-g and Nvidia
echo "kvmgt" > /etc/modules-load.d/kvmgt.conf
echo "vfio-mdev" > /etc/modules-load.d/vfio-mdev.conf
dracut --force # Regenerate initramfs
grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub
%end # End of the %post section

48
f34/vemdhd.cfg Normal file
View File

@ -0,0 +1,48 @@
# __ ____ ____ _____
# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/
# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \
# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ /
# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/
# /_/ /____/
# WHAT ? This Kickstart file bootstraps a minimal desktop-oriented nested-host.
# 'v' for virtual machine, 'e' for efi, 'm' for minimal, 'd' for desktop, 'h' for hypervisor, 'd' for development only.
# USAGE : Press the `tab` or 'e' key during POST and apend that after the 'quiet' string :
# inst.ks=https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdhd.cfg
# A shorter URL can also be used :
# inst.ks=https://url.phyllo.me/vemdhd
# ATTENTION : this kickstart file will automatically DESTROY the main virtual disk 'vda' and all of its contents.
# Bye bye!
%include https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemsd.cfg # Includes vemsd.cfg, the minimal server-oriented virtual machine ks file.
%include https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdd.cfg # Includes vemdd.cfg, the minimal GNOME-based desktop-oriented virtual machine ks file.
%post # Beginning of %post section
dnf install -y qemu-kvm libvirt libvirt-daemon-config-network libvirt-daemon-kvm # Install minimal tools dedicated to virtualization.
dnf install -y virt-install virt-manager virt-viewer virt-top libguestfs-tools python3-libguestfs guestfs-tools # Complementary tools useful for interacting with virtual machines.
usermod -a -G libvirt test ## make user "test" part of the existing libvirt group to allow it to interact with the nested-hypervisor.
# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd, kvmgt, vfio-mdev
echo "vfio" > /etc/modules-load.d/vfio.conf
echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf
echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf
echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf
# Create a directory to store iso images and make the user "test" its owner
mkdir /var/lib/libvirt/iso
chown test:test /var/lib/libvirt/iso
# Create a directory to store rom files and make the user "test" its owner
mkdir /var/lib/libvirt/rom
chown test:test /var/lib/libvirt/rom
# Create a network bridge
nmcli con add ifname br0 type bridge con-name br0
nmcli con add type bridge-slave ifname en0 master br0
nmcli con up br0
%end # End of the %post section

36
f34/vemdhid.cfg Normal file
View File

@ -0,0 +1,36 @@
# __ ____ ____ _____
# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/
# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \
# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ /
# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/
# /_/ /____/
# WHAT ? This Kickstart file bootstraps a minimal GNOME-based desktop-oriented virtual machine.
# 'v' for virtual machine, 'e' for efi, 'm' for minimal, 'd' for desktop, 'h' for hypervisor, 'i' for intel', 'd' for development only.
# USAGE : Press the `tab` or 'e' key during POST and apend that after the 'quiet' string :
# inst.ks=https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdhid.cfg
# A shorter URL can also be used :
# inst.ks=https://url.phyllo.me/vemdhid
# ATTENTION : this kickstart file will automatically DESTROY the main virtual disk 'vda' and all of its contents.
# Bye bye!
%include https://git.phyllo.me/home/kickstart/raw/branch/master/f34/vemdhd.cfg # Includes vemdhd.cfg, a minimal desktop-oriented nested-host ks file
%post # Beginning of %post section
# Load kernel modules in grub. Add `intel_iommu=on intel_iommu=pt` for Intel processors,
sed -i 's/\(quiet\)/\1 intel_iommu=on/i' /etc/default/grub
sed -i 's/\(intel_iommu=on\)/\1 intel_iommu=pt/i' /etc/default/grub
sed -i 's/\(intel_iommu=pt\)/\1 i915.enable_gvt=1/i' /etc/default/grub
# Load specific kernel modules kvmgt and vfio-mdev, for Intel GVT-g and Nvidia
echo "kvmgt" > /etc/modules-load.d/kvmgt.conf
echo "vfio-mdev" > /etc/modules-load.d/vfio-mdev.conf
dracut --force # Regenerate initramfs
grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub
%end # End of the %post section