Updated… this now uses volume groups for the disk storage, virtio for both disk and network. Created by Fedora 13.
There seem to be a real lack of decent xml examples for libvirt/kvm/qemu on the internet for people using it in a bit more of an infrastructury way (where you want to be able to access the consoles remotely using VNC) and to run windows virtual machines.
This example is a dump that doesn’t include a uuid or mac address, they will be automatically generated by libvirt.
Use
sudo virsh define dc1.vc.example.com.xml
or similar to install it.
More useful virsh commands:
virsh list --all show all VMs, running or not virsh start start a VM virsh shutdown shutdown a VM virsh edit edit the config for a VM virsh dumpxml dump the xml config for a VM virsh define create a VM without starting it virsh undefine undefine a VM
<domain type='kvm'> <name>dc1.vc.example.com</name> <memory>1572864</memory> <currentMemory>1572864</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='fedora-13'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu> <topology sockets='1' cores='2' threads='2'/> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type='block' device='disk'> <source dev='/dev/vg1/dc1.vc.example.com'/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <source bridge='br0'/> <target dev='vnet0'/> <model type='virtio'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/0'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/0'> <source path='/dev/pts/0'/> <target port='0'/> <alias name='serial0'/> </console> <input type='tablet' bus='usb'> <alias name='input0'/> </input> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5900' autoport='no' listen='0.0.0.0' keymap='en-gb'/> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> </devices> </domain>