配置文件如下:
<domain type='kvm'>
<name>ubuntu12</name> //the name of kvm
<memory>1048576</memory> //max Memory
<currentMemory>1048576</currentMemory> //usedable Memory
<vcpu>1</vcpu> //virtual CPU num
<os>
<type arch='x86_64'>hvm</type>
<boot dev='cdrom'/> //start width 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='/home/yu/kvm_demo/demo/test.raw'/>
<target dev='hda' bus='ide'/>
</disk>
<disk type='file' device='cdrom'>
<source file='/home/yu/kvm_demo/demo/ubuntu-12.04.4-desktop-amd64.iso'/>
<target dev='hda' bus='ide'/>
</disk>
<interface type='network'>
<mac address="50:e5:49:22:70:1b"/>
<source network='default' />
<adress type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' />
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
</devices>
</domain>
报错如下:
root@yu-H61M-D2-B3:/home/yu/kvm_demo/demo# vi setup.xml
root@yu-H61M-D2-B3:/home/yu/kvm_demo/demo# virsh define setup.xml
定义域 ubuntu12(从 setup.xml)
root@yu-H61M-D2-B3:/home/yu/kvm_demo/demo# virsh start ubuntu12
错误: 开始域 ubuntu12 失败
错误: internal error: process exited while connecting to monitor: qemu-system-x86_64: -drive file=/home/yu/kvm_demo/demo/ubuntu-12.04.4-desktop-amd64.iso,if=none,id=drive-ide0-0-0,readonly=on,format=raw: Duplicate ID 'drive-ide0-0-0' for drive
原因:
使用了两个hda,第二个要换成hdb。