grep -E --color=always 'vmx|svm| lm ' /proc/cpuinfo | uniq
apt install \
bridge-utils \
cpu-checker \
qemu-kvm \
qemu-system-x86
# qemu-system
# --no-install-recommends
lsmod | grep kvm
#rmmod kvm
#modprobe -a kvm
kvm-ok
ls -lF /dev/kvm
# crw-rw---- 1 root kvm 10, 232 May 10 05:30 /dev/kvm
apt install \
libguestfs-tools \
libosinfo-bin \
libvirt-clients \
libvirt-daemon-system \
virtinst
make virsh commands available to some non-root user
usermod -aG libvirt USER ls -lF /var/run/libvirt/libvirt-sock # root:libvirt
enable the daemon
systemctl status libvirtd systemctl status libvirt-guests
check
ps auxww | grep libvirtd$ virsh list --all virsh nodeinfo virt-host-validate osinfo-query os | less libguestfs-test-tool
to enable nested virtualization e.g. to setup XEN dom0 within KVM
vi /etc/modprobe.d/kvm.conf
options kvm_amd nested=1
# doesn't show up
#options kvm_amd amd_iommu=pt
rmmod kvm_amd
modprobe kvm_amd
modinfo kvm_amd | grep nested
cat /sys/module/kvm_amd/parameters/nested
#cat /sys/module/kvm_amd/parameters/amd_iommu
see host-network
assuming /data/ is an NFS mount point already, enable it as storage for vdisks and configs
virsh pool-list
virsh pool-dumpxml default > pool.xml
virsh pool-destroy default
vi pool.xml
<path>/data/guests</path>
mkdir -p /data/guests/
virsh pool-create pool.xml
virsh pool-list
mkdir -p /data/guests/ ifconfig virbr0
and install some guests
to be able to talk to the other hypervisors and enable the farm, you will have to share a few SSH keys.
to migrate a guest, make sure the machine type is compatible on both ends,
kvm -M ?
and fix it (DO NOT USE the pc alias that is pointing to different latest versions depending on the hypervisors – choose the latest available on all hypervisors e.g. pc-i440fx-2.5) if required,
virsh shutdown GUESTNAME
virsh edit GUESTNAME
<os>
<type arch='x86_64' machine='pc-i440fx-2.5'>hvm</type>
<boot dev='hd'/>
</os>
the available virtual network devices can be displayed as such,
qemu-system-x86_64 -net nic,model=? /dev/null
e.g.,
qemu: Supported NIC models: ne2k_pci,i82551,i82557b,i82559er,rtl8139,e1000,pcnet,virtio
replacing rtl8139 with virtio,
<interface type='bridge'>
<mac address='xx:xx:xx:xx:xx:xx'/>
<source bridge='xenbr0'/>
<model type='virtio'/>
<driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5' rx_queue_size='256' tx_queue_size='256'>
<host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off' mrg_rxbuf='off'/>
<guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
</driver>
</interface>
you may also have to disable caching on the virtual drive,
<driver name='qemu' type='qcow2' cache='none'/>
refs https://access.redhat.com/solutions/158363
you will then be able to live-migrate,
virsh -c qemu+ssh://ANOTHER-KVM-SRV/system list virsh migrate GUESTNAME qemu+ssh://ANOTHER-KVM-SRV/system
https://help.ubuntu.com/lts/serverguide/libvirt.html
https://help.ubuntu.com/community/KVM/Installation
https://wiki.xen.org/wiki/Libvirt
https://www.cyberciti.biz/faq/installing-kvm-on-ubuntu-16-04-lts-server/
https://wiki.debian.org/libvirt
https://computingforgeeks.com/virsh-commands-cheatsheet/
Tuning KVM https://www.linux-kvm.org/page/Tuning_KVM
Tuning Kernel https://www.linux-kvm.org/page/Tuning_Kernel
Memory https://www.linux-kvm.org/page/Memory
Chapter 6. Overcommitting with KVM https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_administration_guide/chap-virtualization-tips_and_tricks-overcommitting_with_kvm
Chapter 7. KSM https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_administration_guide/chap-KSM
How to use the Kernel Samepage Merging feature https://www.kernel.org/doc/Documentation/vm/ksm.txt
KVM host won’t use memory for caching https://serverfault.com/questions/710172/kvm-host-wont-use-memory-for-caching
Virtualization (KVM) and excessive cached RAM https://unix.stackexchange.com/questions/241142/virtualization-kvm-and-excessive-cached-ram
Kernel same-page merging https://en.wikipedia.org/wiki/Kernel_same-page_merging
https://storpool.com/blog/nested-virtualization-with-kvm-and-opennebula
https://wiki.gentoo.org/wiki/QEMU/Linux_guest
https://www.linux-kvm.org/page/Boot_from_virtio_block_device
https://wiki.archlinux.org/title/KVM
https://wiki.debian.org/LXC/LibVirtDefaultNetwork
https://wiki.debian.org/KVM#Libvirt_default_network
https://unix.stackexchange.com/questions/340521/create-virbr0-for-virsh
https://linuxconfig.org/how-to-use-bridged-networking-with-libvirt-and-kvm
http://ask.xmodulo.com/change-default-location-libvirt-vm-images.html
https://mike42.me/blog/libvirt-migrate-a-vm-from-qemusession-to-qemusystem
https://wiki.libvirt.org/page/Failed_to_connect_to_the_hypervisor
http://blog.programster.org/kvm-offline-migration
https://libvirt.org/migration.html
https://libvirt.org/formatdomain.html
https://libvirt.org/formatdomain.html#elementsNICS
https://wiki.ubuntu.com/QemuKVMMigration
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1617214
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1637438
https://www.linux-kvm.org/page/Management_Tools
https://www.linux-kvm.org/page/Networking
https://www.redhat.com/archives/libvirt-users/2015-February/msg00024.html
https://access.redhat.com/errata/RHSA-2016:2577