KVM virtualization

Installation REQUIRED for KVM: Intel VT or AMD-V extensions (vmx or svm in /proc/cpuinfo)

yum groupinstall kvm

Kickstarting When kickstarting a KVM, you may have occasion to start over if you've made a typo or forgot to setup the VLAN network or something. Simply perform a “virsh destroy {guest_name}” followed by a “virsh undefine {guestname}”. Voila, clean slate to try and kickstart again.

Notes

How-To: Hot-Add Disk Device to Running KVM Virtual Guest:
modprobe acpiphp
virsh attach-disk domainname /path/to/source/disk/or/vg vd?
virsh dumpxml domainname > /tmp/domainname.tmp.xml
sdiff /etc/libvirt/qemu/domainname.xml /tmp/domainname.tmp.xml
How-To: Boot Rescue Mode

Edit the machine configuration file: /etc/libvirt/qemu/{server}.xml

<disk type='file' device='cdrom'>
   <source file='/net/kickstart/kickstart/iso/rhel-server-5.5-x86_64-dvd.iso'/>
   <target dev='hdc' bus='ide'/>
   <readonly/>
</disk>
How-To: Live Migrate KVM Virtual Machine to Different Chassis
virsh migrate --live {guest} qemu+ssh://{remote_host}/system
Editing the Attributes of a Virtual Machine

libvirt stores it's configuration as xml in '/etc/libvirt/qemu'. The xml is easy to understand, and is similar to VMware *.vmx files. While it is possible to edit these files in place and restart libvirt-bin for the changes to take affect, the recommended method for modifying the attributes of a virtual machine is via virsh (or virt-manager, if it supports changing the hardware you want to change). The concept is simple:

  1. export (aka 'dump') the xml of the virtual machine you want to edit
  2. edit the xml
  3. import (aka 'define') the xml

For example, to edit the machine named 'foo' (you can get a list of your machines with 'virsh list –all'), do:

$ virsh dumpxml foo > /tmp/foo.xml
(edit /tmp/foo.xml as needed)
$ virsh define /tmp/foo.xml