Hi ZHOU, 如果我先stop虚拟机,再挂载volume,然后再启动虚拟机,那么一切都ok的。就是不能在虚拟机运行的时候挂载。或者我虚拟机第一次启动的时候,我挂载上去,那也是ok的,但是我卸载掉volume然后再挂载,那就会报错“Duplicate ID 'virtio-disk1”。 我通过libvirt来查看VM 的XML信息如下: root@openstack-server-1:/usr/bin# virsh dumpxml i-2-3-VM <domain type='kvm' id='11'> <name>i-2-3-VM</name> <uuid>3bec686e-ccfb-4cfd-ab0f-c709b8802f04</uuid> <description>Ubuntu 12.04 (64-bit)</description> <memory>524288</memory> <currentMemory>524288</currentMemory> <vcpu>1</vcpu> <cputune> <shares>500</shares> </cputune> <os> <type arch='x86_64' machine='pc-1.0'>hvm</type> <boot dev='cdrom'/> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <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='qcow2' cache='none'/> <source file='/mnt/d15f1dda-469f-31b1-a760-a3f477b6903e/ebe08b1d-91d2-4d38-b034-f65041b415a2'/> <target dev='vda' bus='virtio'/> <alias name='virtio-disk0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw' cache='none'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='bridge'> <mac address='06:23:76:00:00:0d'/> <source bridge='cloudbr0'/> <target dev='vnet9'/> <model type='virtio'/> <bandwidth> <inbound average='25600' peak='25600'/> <outbound average='25600' peak='25600'/> </bandwidth> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/6'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/6'> <source path='/dev/pts/6'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <input type='tablet' bus='usb'> <alias name='input0'/> </input> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5903' autoport='yes'/> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain> 里面只有virtio-disk0没有virtio-disk1啊!
谢谢 DuJun 在 2013年11月25日下午4:41,Wei ZHOU <ustcweiz...@gmail.com>写道: > 之前有过挂载、卸载的操作吗? > virsh dumpxml出来的文件里面有virtio-disk1吗? > > 有条件试试虚拟机OS是centos6或者rhel6的情况。 > 我记得linux kernel 3.*带的udev里面有个bug > > > 在 2013年11月24日下午1:38,Du Jun <dj199...@gmail.com>写道: > > > Hi ZHOU, > > 目前我的虚拟机还没有挂额外数据盘,物理机qemu版本1.0,libvirt版本0.9.8,虚拟机OS时ubuntu 12.04. > > > > Does these matters? > > > > ---- > > Best regards, > > DuJun > > > > 2013/11/24, Wei ZHOU <ustcweiz...@gmail.com>: > > > 你挂了几个盘?你的物理机的QEMU和LIBVIRT是什么版本,虚拟机用的什么OS > > > > > > 2013/11/23, Du Jun <dj199...@gmail.com>: > > >> Hi all, > > >> 我在为虚拟机绑定磁盘的时候碰到了一个问题,log信息如下: > > >> 2013-11-23 18:04:03,155 DEBUG [cloud.async.AsyncJobManagerImpl] > > >> (Job-Executor-57:job-81 = [ 260b8d64-570d-4469-92c6-f27d887955b0 ]) > > >> Complete async job-81 = [ 260b8d64-570d-4469-92c6-f27d887955b0 ], > > >> jobStatus: 2, resultCode: 530, result: Error Code: 530 Error text: > > >> Failed to attach volume: volume-a4903396-ca1b-48a9-838d-e82dbd190932 > > >> to VM: basic-inception-vm; org.libvirt.LibvirtException: internal > > >> error unable to execute QEMU command 'device_add': Duplicate ID > > >> 'virtio-disk1' for device > > >> 提示信息说:“Duplicate ID 'virtio-disk1' for > > >> device”,我就迷惑了,数据磁盘在我的主存储里面是独一无二的呀,求解释,求说明!谢谢! > > >> > > >> ---- > > >> Best regards, > > >> DuJun > > >> > > > > > >