Ubuntu 10.04下使用 libvirt 创建KVM虚拟机

配置网络

vim /etc/network/interface 

改为如下

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet manual

auto br0 
iface br0 inet dhcp //宿主机是vmware创建的,需要使用动态的IP
bridge_ports eth0
bridge_fd 0
bridge_stp off
bridge_maxwait 0

 

编写setup.xml

<domain type = 'kvm'>
<name>test_ubuntu</name>
<memory>1048576</memory>
<currentMemory>1048576</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch = 'x86_64' machine = 'pc'>hvm</type>
<boot dev = 'cdrom'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset = 'localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type = 'file' device = 'disk'>
<driver name = 'qemu' type = 'raw'/>
<source file = '/disks/ubuntu.raw'/>
<target dev = 'hda' bud = 'ide'/>
</disk>
<disk type = 'file' device = 'cdrom'>
<source file = '/iso/ubuntu-10.04.3-server-amd64.iso'/>
<target dev = 'hdb' bus = 'ide'/>
</disk>
<interface type = 'bridge'>
<source bridge = 'br0'/>
<mac address = "00:16:3e:5d:aa:a8"/>
</interface>
<input type = 'mouse' bus = 'ps2'/>
<graphics type = 'vnc' port = '-1' autoport = 'yes' keymap = 'en-us'/>
</devices>
</domain>

 

你可能感兴趣的:(ubuntu)