Linux/KVM: Difference between revisions
< Linux
Line 127: | Line 127: | ||
* /etc/libvirt/qemu/ubuntu.xml | |||
<blockquote> | |||
<pre> | |||
<domain type='kvm'> | |||
<name>vm-dev</name> | |||
<uuid>??????</uuid> | |||
<memory>1048576</memory> | |||
<currentMemory>1048576</currentMemory> | |||
<vcpu>4</vcpu> | |||
<os> | |||
<type arch='x86_64' machine='pc-1.0'>hvm</type> | |||
<boot dev='hd'/> | |||
</os> | |||
<features> | |||
<acpi/> | |||
<apic/> | |||
<pae/> | |||
</features> | |||
<cpu match='exact'> | |||
<model>Westmere</model> | |||
<vendor>Intel</vendor> | |||
<feature policy='require' name='tm2'/> | |||
<feature policy='require' name='est'/> | |||
<feature policy='require' name='monitor'/> | |||
<feature policy='require' name='ss'/> | |||
<feature policy='require' name='vme'/> | |||
<feature policy='require' name='rdtscp'/> | |||
<feature policy='require' name='ht'/> | |||
<feature policy='require' name='ds'/> | |||
<feature policy='require' name='pbe'/> | |||
<feature policy='require' name='tm'/> | |||
<feature policy='require' name='vmx'/> | |||
<feature policy='require' name='ds_cpl'/> | |||
<feature policy='require' name='xtpr'/> | |||
<feature policy='require' name='acpi'/> | |||
</cpu> | |||
<clock offset='utc'/> | |||
<on_poweroff>destroy</on_poweroff> | |||
<on_reboot>restart</on_reboot> | |||
<on_crash>restart</on_crash> | |||
<devices> | |||
<emulator>/usr/bin/kvm</emulator> | |||
<disk type='file' device='disk'> | |||
<driver name='qemu' type='raw' cache='none'/> | |||
<source file='/srv/kvm/ubuntu/ubuntu.img'/> | |||
<target dev='vda' bus='virtio'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> | |||
</disk> | |||
<interface type='bridge'> | |||
<mac address='xx:xx:xx:xx:xx:xx'/> | |||
<source bridge='br0'/> | |||
<model type='e1000'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> | |||
</interface> | |||
<serial type='pty'> | |||
<target port='0'/> | |||
</serial> | |||
<console type='pty'> | |||
<target type='serial' port='0'/> | |||
</console> | |||
<input type='mouse' bus='ps2'/> | |||
<graphics type='vnc' port='-1' autoport='yes'/> | |||
<video> | |||
<model type='cirrus' vram='9216' heads='1'/> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> | |||
</video> | |||
<memballoon model='virtio'> | |||
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> | |||
</memballoon> | |||
</devices> | |||
</domain> | |||
</pre> | |||
</blockquote> | |||
Revision as of 18:20, 10 November 2012
Ubuntu 12.04 KVM Host
Installation
kvm-ok (cpu ok?) apt-get install ubuntu-virt-server qemu-kvm kvm-ipxe apt-get install virtinst libvirt-bin virt-top (cli) apt-get install virt-manager (gui)
network bridge
- installation:
apt-get install bridge-utils
- /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.111.10 netmask 255.255.255.0 gateway 192.168.111.1 dns-nameservers 192.168.111.1 bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
vm guest setup
- control
virsh --connect qemu:///system : help : list --all : define /etc/libvirt/qemu/vm-???.xml : start vm-??? : shutdown vm-??? : destroy vm-??? : quit
- /etc/libvirt/qemu/win7.xml
<domain type='kvm'> <name>Win7</name> <uuid>??????</uuid> <memory>4194304</memory> <currentMemory>4194304</currentMemory> <vcpu cpuset='0-3'>4</vcpu> <os> <type arch='x86_64' machine='pc-1.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu match='exact'> <model>Westmere</model> <vendor>Intel</vendor> </cpu> <clock offset='localtime'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <target dev='hdc' bus='ide'/> <readonly/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/srv/kvm/win7/win7.img'/> <target dev='vdb' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='xx:xx:xx:xx:xx:xx'/> <source bridge='br0'/> <model type='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <sound model='ich6'> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> <model type='vga' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain>
- /etc/libvirt/qemu/ubuntu.xml
<domain type='kvm'> <name>vm-dev</name> <uuid>??????</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>4</vcpu> <os> <type arch='x86_64' machine='pc-1.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <cpu match='exact'> <model>Westmere</model> <vendor>Intel</vendor> <feature policy='require' name='tm2'/> <feature policy='require' name='est'/> <feature policy='require' name='monitor'/> <feature policy='require' name='ss'/> <feature policy='require' name='vme'/> <feature policy='require' name='rdtscp'/> <feature policy='require' name='ht'/> <feature policy='require' name='ds'/> <feature policy='require' name='pbe'/> <feature policy='require' name='tm'/> <feature policy='require' name='vmx'/> <feature policy='require' name='ds_cpl'/> <feature policy='require' name='xtpr'/> <feature policy='require' name='acpi'/> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='raw' cache='none'/> <source file='/srv/kvm/ubuntu/ubuntu.img'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <interface type='bridge'> <mac address='xx:xx:xx:xx:xx:xx'/> <source bridge='br0'/> <model type='e1000'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes'/> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain>
Iommu
- grub.cfg (Ubuntu 12.04)
linux /boot/*** intel_iommu=on