libvirt/kvm problem with disk attach/detach/reattach on running virt
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned | ||
qemu-kvm (Ubuntu) |
Expired
|
Low
|
Unassigned |
Bug Description
Release: Ubuntu 11.10 (Oneiric)
libvirt-bin: 0.9.2-4ubuntu15.1
qemu-kvm: 0.14.1+
Summary: With a running KVM virt, performing an 'attach-disk', then a 'detach-disk', then another 'attach-disk'
in an attempt to reattach the volume at the same point on the virt, fails, with the qemu reporting back to
libvirt a 'Duplicate ID' error.
Expected behavior: The 2nd invocation of 'attach-disk' should have succeeded
Actual behavior: Duplicate ID error reported
I believe this is most likely a qemu-kvm issue, as the DOM kvm spits back at libvirt after the 'detach-disk'
does not show the just-detached disk. There is some kind of registry/lookup for devices in qemu-kvm
and for whatever reason, the entry for the disk does not get removed when it is detached from the
virt. Specifically, the error gets reported at the 2nd attach-disk attempt from:
qemu-
684 QemuOpts *qemu_opts_
685 {
686 QemuOpts *opts = NULL;
687
688 if (id) {
689 if (!id_wellformed
690 qerror_
691 error_printf_
692 return NULL;
693 }
694 opts = qemu_opts_
695 if (opts != NULL) {
696 if (fail_if_exists) {
697 qerror_
698 return NULL;
699 } else {
700 return opts;
701 }
702 }
703 }
704 opts = qemu_mallocz(
705 if (id) {
706 opts->id = qemu_strdup(id);
707 }
708 opts->list = list;
709 loc_save(
710 QTAILQ_
711 QTAILQ_
712 return opts;
713 }
=======
Output of my attach/
=======
virsh # attach-disk base1 /var/lib/
Disk attached successfully
virsh # dumpxml base1
<domain type='kvm' id='2'>
<name>
<uuid>
<memory>
<currentMemor
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine=
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu match='exact'>
<model>
<vendor>
<feature policy='require' name='skinit'/>
<feature policy='require' name='vme'/>
<feature policy='require' name='mmxext'/>
<feature policy='require' name='fxsr_opt'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='3dnowpref
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='wdt'/>
<feature policy='require' name='extapic'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='osvw'/>
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='3dnow'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>
<on_reboot>
<on_crash>
<devices>
<emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/dev/rbd1'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/var/
<target dev='vdb' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</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=
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes'/>
<sound model='ich6'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<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='0x06' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor'>
<label>
<imagelabel
</seclabel>
</domain>
virsh # detach-disk base1 vdb
Disk detached successfully
virsh # dumpxml base1
<domain type='kvm' id='2'>
<name>
<uuid>
<memory>
<currentMemor
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine=
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu match='exact'>
<model>
<vendor>
<feature policy='require' name='skinit'/>
<feature policy='require' name='vme'/>
<feature policy='require' name='mmxext'/>
<feature policy='require' name='fxsr_opt'/>
<feature policy='require' name='cr8legacy'/>
<feature policy='require' name='ht'/>
<feature policy='require' name='3dnowpref
<feature policy='require' name='3dnowext'/>
<feature policy='require' name='wdt'/>
<feature policy='require' name='extapic'/>
<feature policy='require' name='pdpe1gb'/>
<feature policy='require' name='osvw'/>
<feature policy='require' name='cmp_legacy'/>
<feature policy='require' name='3dnow'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>
<on_reboot>
<on_crash>
<devices>
<emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/dev/rbd1'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</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=
<source bridge='br0'/>
<target dev='vnet0'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/1'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/1'>
<source path='/dev/pts/1'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='5900' autoport='yes'/>
<sound model='ich6'>
<alias name='sound0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<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='0x06' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor'>
<label>
<imagelabel
</seclabel>
</domain>
virsh # attach-disk base1 /var/lib/
error: Failed to attach disk
error: operation failed: adding virtio-
=======
Changed in qemu-kvm (Ubuntu): | |
status: | Confirmed → Incomplete |
reproduced in precise as well.