[iyunv@NB vhost]# virsh list
Id Name State
----------------------------------------------------
1 win64 running
2 c01 running
先关掉要加硬盘的虚机win64,然后编辑该虚机的配置文件:
[iyunv@NB vhost]# virsh destroy win64
Domain win64 destroyed
[iyunv@NB vhost]# virsh list --all
Id Name State
----------------------------------------------------
2 c01 running
- 1xp shut off
- app01 shut off
- app02 shut off
- ha01 shut off
- ha02 shut off
- win64 shut off
[iyunv@NB vhost]# virsh edit win64
..
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/data/vhost/add_win_desk.img'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
...下面的报错是因为<address type='drive' controller='0' bus='0' target='0' unit='0'/>
应该是:<address type='drive' controller='0' bus='0' target='0' unit='1'/>
注意,我们在些使用的硬盘接口为ide接口,硬盘名称为hdb,所以添加完毕后系统是可以直接识别的。
[iyunv@NB vhost]# virsh start win64
error: Failed to start domain win64
error: internal error Process exited while reading console log output: qemu-kvm: -drive file=/data/vhost/add_win_desk.img,if=none,id=drive-ide0-0-0,format=qcow2,cache=none: Duplicate ID 'drive-ide0-0-0' for drive
启动失败!!!!
重新加载配置文件:
[iyunv@NB qemu]# cd /etc/libvirt/qemu/
[iyunv@NB qemu]# ls
1xp.xml app02.xml ha01.xml networks
app01.xml c01.xml ha02.xml win64.xml
[iyunv@NB qemu]# virsh define win64.xml
Domain win64 defined from win64.xml
看计算机管理: