Received: from eggs.gnu.org ([140.186.70.92]:41952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rat5R-0001hl-UQ for qemu-devel@nongnu.org; Wed, 14 Dec 2011 12:57:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rat5M-0003r5-BZ for qemu-devel@nongnu.org; Wed, 14 Dec 2011 12:57:49 -0500 Received: from indium.canonical.com ([91.189.90.7]:46965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rat5L-0003qu-Tl for qemu-devel@nongnu.org; Wed, 14 Dec 2011 12:57:44 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1Rat5K-0007Mh-9w for ; Wed, 14 Dec 2011 17:57:42 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 59C982E813E for ; Wed, 14 Dec 2011 17:21:10 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 14 Dec 2011 17:10:42 -0000 From: Justin L Werner <897750@bugs.launchpad.net> Sender: bounces@canonical.com References: <20111129155310.23239.76602.malonedeb@wampee.canonical.com> Message-Id: <20111214171042.7248.57967.malone@gac.canonical.com> Errors-To: bounces@canonical.com Subject: [Qemu-devel] [Bug 897750] Re: libvirt/kvm problem with disk attach/detach/reattach on running virt Reply-To: Bug 897750 <897750@bugs.launchpad.net> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org I've been looking at libvirt and qemu for other work, I'm doing, and I've criceld back to take another look at this. Since I first looked at this, my testbed has updated to use the "oneiric-pr= oposed" = qemu-kvm package '0.14.1+noroms-0ubuntu6.1' while retaining the libvirt-bin package 0.9.2-4ubuntu15.1 I tried to duplicate the problem again, but this time my Linux virt had 'a= cpiphp.ko' (the PCI hotplug module) loaded, and I was *unable* to reproduce the 'Dupli= cate ID' error. Instead, continued attach/detach cycles resulted in success every t= ime after .gt. 30 iterations. =3D=3D **As a side-note and possibly to be addressed as a separate bug, the drive= does not actually get attached as the specified device each time inside the virt. = So even though the 'attach-disk --target' specifies, say, vdb, the virt kernel increments= the devname inside itself, so that we get vdc, vdd, vde.... The attaches subsequent = to the detatch of vdz results in vdaa,, vdab, vdac and so on. =3D=3D Now here's the kicker. If you do an 'rmmod' on the PCI hotplug module with= in the virt and try the attach/detach/attach, the 'Duplicate ID' problem re-occurs= . This implies to me that there is some sort of effective interaction between qemu= -kvm and the virt that affects this. That is, when the virt actually gets and = handles a device eject, then qemu-kvm behaves differently than when the virt does not get/handle it. -- Dec 14 09:54:16 base1 kernel: [ 2226.835417] acpiphp_glue: handle_hotplug_e= vent_func: Device eject notify on \_SB_.PCI0.S27_ Dec 14 09:54:16 base1 kernel: [ 2226.877208] virtio-pci 0000:00:1b.0: PCI I= NT A disabled -- So, this gives us a better characterization of the bug, and I will look int= o it some more with this in mind. -- = You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/897750 Title: libvirt/kvm problem with disk attach/detach/reattach on running virt Status in QEMU: New Status in =E2=80=9Cqemu-kvm=E2=80=9D package in Ubuntu: Confirmed Bug description: Release: Ubuntu 11.10 (Oneiric) libvirt-bin: 0.9.2-4ubuntu15.1 qemu-kvm: 0.14.1+noroms-0ubuntu6 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 succ= eeded Actual behavior: Duplicate ID error reported = I believe this is most likely a qemu-kvm issue, as the DOM kvm spits bac= k at libvirt after the 'detach-disk' does not show the just-detached disk. There is some kind of registry/lo= okup 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 atte= mpt from: = qemu-option.c:qemu_opts_create:697 684 QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, int fa= il_if_exists) = 685 { = = 686 QemuOpts *opts =3D NULL; = = 687 = = 688 if (id) { = = 689 if (!id_wellformed(id)) { = = 690 qerror_report(QERR_INVALID_PARAMETER_VALUE, "id", "an ide= ntifier"); = 691 error_printf_unless_qmp("Identifiers consist of letters, = digits, '-', '.', '_', starting with a letter.\n"); = 692 return NULL; = = 693 } = = 694 opts =3D qemu_opts_find(list, id); = = 695 if (opts !=3D NULL) { = = 696 if (fail_if_exists) { = = 697 qerror_report(QERR_DUPLICATE_ID, id, list->name); = <<<< =3D=3D=3D=3D=3D=3D HERE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = = 698 return NULL; = = 699 } else { = = 700 return opts; = = 701 } = = 702 } = = 703 } = = 704 opts =3D qemu_mallocz(sizeof(*opts)); = = 705 if (id) { = = 706 opts->id =3D qemu_strdup(id); = = 707 } = = 708 opts->list =3D list; = = 709 loc_save(&opts->loc); = = 710 QTAILQ_INIT(&opts->head); = = 711 QTAILQ_INSERT_TAIL(&list->head, opts, next); = = 712 return opts; = = 713 } = = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Output of my attach/detach/attach =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D virsh # attach-disk base1 /var/lib/libvirt/images/extrastorage.img vdb Disk attached successfully virsh # dumpxml base1 base1 9ebebe7f-7dfa-4735-a80c-c19ebe4e1459 1048576 1048576 2 hvm Opteron_G3 AMD destroy restart restart /usr/bin/kvm