LotharKAtt
9/17/2017 - 9:46 PM

Libvirt/KVM

Libvirt

Salt-Virt

Correct salt pipeline

salt.master > salt.minion > libvirt > saltutil_sync_all > salt.control

default space for storage images is /srv/salt-images/ is overwriten in salt.minion state on /etc/salt/minion.d/_virt.conf

Virt tips

Conect with virt-viewer

virt-viewer -c qemu+ssh://root@10.31.0.243/system prx02.statens-it.local

Add bridge to exist virsh machine

virsh attach-interface --domain jmp-02.jse1.jiocloud.com --type bridge --source br-private --model virtio --config --live

Attach interface

virsh attach-interface --domain vm1 --type bridge --source br-data --model virtio --mac 52:54:00:4b:73:5f --live

Rename source disk (if applicable)

mv cfg01.qcow2 cfg01.src.qcow2 - Create a new sparsely allocated image qemu-img create -f qcow2 -o preallocation=off cfg01.qcow2 50G -Use virt-resize –expand option to copy, expand partition and filesystem virt-resize --expand /dev/vda1 cfg01.src.qcow2 cfg01.qcow2

Increase/decrease libvirt resources

RAM

virsh setmaxmem <vm name> 16G --config

virsh setmem <vm name> 16G --config