Table of Contents
Virtualization
tbd
If you want to change the default storage pool location, I don't know of other ways than manually editing /etc/libvirtd/storage/defauls.xml (shutdown libvirtd first and start it after) or linking the images directory to
Libvirtd Image Location
Managing qemu VMs
Using virt-manager
1. Using virsh
Image Location:
ls /var/lib/libvirt/ boot/ dnsmasq/ filesystems/ images/ libxl/ lxc/ network/ qemu/ uml/ xen/
Restart libvirtd after manually delete image etc.
service libvirtd stop
[dang@dai142 devstack-nodes]$ virsh -c qemu:///system list
Id Name State
----------------------------------------------------
21 devstack-nodes_devstack-control running
[dang@dai142 devstack-nodes]$ virsh -c qemu:///system
Welcome to virsh, the virtualization interactive terminal.
Type: 'help' for help with commands
'quit' to quit
virsh # list
Id Name State
----------------------------------------------------
21 devstack-nodes_devstack-control running
virsh # exit
Save state of nested VMs
Save a running VM Guest with the command virsh save and specify the file to where it is saved.
Save the guest named opensuse11
virsh save opensuse11 /virtual/saves/opensuse11.vmsav
Save the guest with the ID 37
virsh save 37 /virtual/saves/opensuse11.vmsave
To restore it, use virsh restore:
virsh restore /virtual/saves/opensuse11.vmsave
Troubleshooting vms
virsh list virsh net-list virsh net-list --all brctl show sysctl net.bridge.bridge-nf-call-iptables iptables -L -v -n ps -ef | grep dnsmasq ifconfig -a cat /proc/sys/net/ipv4/ip_forward service libvirtd reload
Nested Virtualization with kvm intel
Let us first ensure kvm_intel kernel module has nesting enabled. By default, it’s disabled for Intel arch[ but enabled for AMD – SVM (secure virtual machine) extensions arch.]
modinfo kvm_intel | grep -i nested parm: nested:bool #
Enable nested virtualization
echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf
OR add boot option
cat /etc/default/grub | grep CMDLINE
GRUBCMDLINELINUX=“rd.lvm.lv=vol0/swapVol rd.md=0 rd.dm=0 KEYTABLE=us quiet rd.lvm.lv=vol0/rootVol rhgb rd.luks=0 SYSFONT=latarcyrheb-sun16 LANG=en_US.UTF-8 kvm-intel.nested=1”
Verify
cat /sys/module/kvm_intel/parameters/nested Y systool -m kvm_intel -v | grep -i nested nested = "Y" #
Enable Nested Virtualization Guest
The o/p of the above cmd has a variety of options. Since we need only vmx extensions, I tried the simple way by adding to the regular-guest’s libvirt xml(virsh edit ..) and started it.
<cpu match='exact'> <model>core2duo</model> <feature policy='require' name='vmx'/> </cpu>
Start Guest with qemu-kvm
ps -ef | grep -i qemu-kvm | egrep -i 'regular-guest-f18|vmx' qemu 15768 1 19 13:33 ? 01:01:52 /usr/bin/qemu-kvm -name regular-guest-f18 -S -M pc-1.3 -cpu core2duo,+vmx -enable-kvm -m 4096 -smp 4,sockets=4,cores=1,threads=1 -uuid 9a7fd95b-7b4c-743b-90de-fa186bb5c85f -nographic -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/regular-guest-f18.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/export/vmimgs/regular-guest-f18.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:a6:ff:96,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5