今天把系统重装为Ubuntu 12.04.3LTS,然后把虚拟机迁移回来。出现若干错误。现把解决方法记录如下:
$ sudo virsh define /etc/libvirt/qemu/vm1.xml
error: Failed to create domain from ubuntu.xml
error: unknown OS type hvm
解决方法:
把 root 添加到libvirtd和kvm组中。
sudo su adduser `id -un` kvm adduser `id -un` libvirtd
$ sudo virsh start vm1
error: Failed to start domain vm1
error: Network not found: no network with matching name 'default'
解决方法:
$ virsh net-list --allName State Autostart
$ sudo virsh net-define /var/lib/libvirt/network/default.xmlNetwork default defined from /var/lib/libvirt/network/default.xml
$ sudo virsh net-autostart defaultNetwork default marked as autostarted
$ sudo virsh net-start defaultNetwork default started
$ brctl showbridge name bridge id STP enabled interfaces
$ virsh net-list --all
$ sudo virsh start vm1error: Failed to start domain vm1
解决方法:
修改vm1.xml:
<domain type='kvm'>
<name>vm-gitlab6</name>
<uuid>6deea115-1bdf-03f3-974e-182c140411b5</uuid>
<memory unit='KiB'>4194304</memory>
<currentMemory unit='KiB'>4194304</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<!-- for ubuntu 13.04 and later
<type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
-->
<boot dev='hd'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<!-- for ubuntu 12.04.1 and before
<emulator>/usr/bin/kvm</emulator>
-->
<emulator>/usr/bin/qemu-system-x86_64</emulator>
......
$ sudo virsh start vm-ubuntu1204
error: Failed to start domain vm-ubuntu1204
error: Unable to read from monitor: Connection reset by peer
网上说:
$ sudo virsh managedsave-remove vm-ubuntu1204
仍然报错:
Domain vm-ubuntu1204 has no manage save image; removal skipped
机器CPU/内存不足,你需要更新硬件了。