Advertisement
mmcze

libvirt-vm-startup-script-3

May 25th, 2022
747
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. win_var=$(virsh list --name | grep windows2)
  4.  
  5. if [ "$win_var" == windows2 ]; then
  6. echo "Windows2 running"
  7. exit 1
  8. fi
  9.  
  10. sysctl vm.stat_interval=180
  11. echo 0 > /proc/sys/kernel/watchdog
  12. echo 1 >/proc/sys/vm/compact_memory
  13.  
  14. ##FOR CPU
  15.  
  16. systemctl set-property --runtime -- user.slice AllowedCPUs=0,8
  17. systemctl set-property --runtime -- system.slice AllowedCPUs=0,8
  18. systemctl set-property --runtime -- init.scope AllowedCPUs=0,8
  19.  
  20.  
  21. cpupower -c all frequency-set -g performance
  22.  
  23. echo 1 > /sys/devices/virtual/workqueue/cpumask
  24. echo 1 > /sys/bus/workqueue/devices/writeback/cpumask
  25. echo 1 > /proc/irq/default_smp_affinity
  26.  
  27. for i in $(ls -1 /proc/irq/*/smp_affinity); do echo 1 > "$i"; done
  28.  
  29. tuna -t rcu* -c 0,8 -m
  30.  
  31. ##FOR GPU
  32.  
  33. echo 1 > /sys/bus/pci/devices/0000\:27\:00.0/remove
  34. echo 1 > /sys/bus/pci/devices/0000\:27\:00.1/remove
  35. echo 1 > /sys/bus/pci/devices/0000\:29\:00.3/remove
  36. echo 1 > /sys/bus/pci/rescan
  37.  
  38. sleep 1
  39.  
  40. virsh start windows2
Advertisement
RAW Paste Data Copied
Advertisement