Set up Hugepages with pagesize 2 MB.
Ex. For 4 VMs deployment with each VM's RAM configured to 12 GB.
Total Hugepage size required: 12 GB * 4 = 48 GB = 49152 MB.
Since pagesize is 2 MB, hugepage to set here: 49152 / 2 = 24576 MB.
sudo vi /etc/systemd/system/hugepages.serviceAdd
[Unit]
Description=Configure Hugepages
Before=k3s.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo $(( 24576 )) | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages'
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable hugepages.service
sudo systemctl start hugepages.service
sudo cat /proc/meminfo | grep -i hugepages
HugePages_Total: 24576
HugePages_Free: 24576
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
To use USB peripherals connected to Host machine with Virtual machines
grep qemu /etc/passwd
qemu:x:107:107:qemu user:/:/sbin/nologin
If not, add the user qemu
sudo useradd -s /usr/sbin/nologin qemu
sudo vi /etc/udev/rules.d/99-usb-qemu.rules
Add
ACTION=="add", SUBSYSTEM=="usb", MODE="0664", GROUP="qemu", OWNER="qemu"
Apply changes
sudo udevadm control --reload-rules
sudo udevadm trigger
Unplug and re-plug the USB devices you plan to attach to VMs, then check the permissions are set correctly:
ls -alR /dev/bus/usb/003/
...
crw-rw-r--. 1 qemu qemu 189, 8 May 15 22:14 009
...
This has been taken care by IDV Service
-
DPMS Disable
sudo vi /usr/share/X11/xorg.conf.d/10-extensions.conf
Add
Section "Extensions" Option "DPMS" "false" EndSection -
Disable Screen Blanking and Timeouts
sudo vi /usr/share/X11/xorg.conf.d/10-serverflags.conf
Add
Section "ServerFlags" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" Option "BlankTime" "0" EndSection
sudo vi /etc/systemd/system/x.serviceAdd
[Unit]
Description=Launch X server at startup
After=network.target
Before=k3s.service
[Service]
Type=simple
ExecStart=/usr/bin/X
[Install]
WantedBy=graphical.target
Enable and start the service. You should now see a black screen on the monitors.
NOTE: When you reboot the machine, you will end up with a black screen, because X is running. To access the console, try control+alt+f3. To return to X, switch back with control-alt-f2. If X is not currently the active display, the VMs will not boot, and will error with "SyncVMI failed".
sudo systemctl daemon-reload
sudo systemctl enable x.service
sudo systemctl start x.service
Note
This is needed if VM doesn't scale to full-screen after launching. Perform this step before starting VM.
- To start Openbox Window Manager
Now you can see a cursor (usually on Primary Display: HDMI-1)
DISPLAY=:0 openbox &
- Convert from QCOW2 to RAW Image
qemu-img convert -f qcow2 -O raw input.qcow2 output.img
- Convert from RAW Image to QCOW2
qemu-img convert -f raw -O qcow2 input.img output.qcow2
USB Bus-PortID which is mentioned in sidecar script is passthroughd to VM. QEMU Commandline parameters in the Sidecar script are used to patch the libvirt XML inside Virt-Launcher pod, when QEMU command launches inside Virt-Launcher pod gets these USB peripherals passthrough.
To enable USB passthrough, Intel Device Plugin mounts USB bus to each instance of Virt-Launcher and is considered as static resource, so the USB peripheral (Keyboard, mouse, headset..) needs to passthrough to the VM should be the connected respective USB ports of Host system before starting VM. Hence hot-plugging, disconnect/connect requires pod to be restarted which will restart VM.