Received: from eggs.gnu.org ([140.186.70.92]:38528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVTXu-0006fQ-6z for qemu-devel@nongnu.org; Tue, 29 Nov 2011 14:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RVTXo-0002TD-W4 for qemu-devel@nongnu.org; Tue, 29 Nov 2011 14:40:50 -0500 Received: from indium.canonical.com ([91.189.90.7]:40126) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RVTXo-0002T5-JC for qemu-devel@nongnu.org; Tue, 29 Nov 2011 14:40:44 -0500 Received: from loganberry.canonical.com ([91.189.90.37]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1RVTXn-000289-E7 for ; Tue, 29 Nov 2011 19:40:43 +0000 Received: from loganberry.canonical.com (localhost [127.0.0.1]) by loganberry.canonical.com (Postfix) with ESMTP id 652632E8030 for ; Tue, 29 Nov 2011 19:40:43 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Date: Tue, 29 Nov 2011 19:31:32 -0000 From: Serge Hallyn <897750@bugs.launchpad.net> Sender: bounces@canonical.com References: <20111129155310.23239.76602.malonedeb@wampee.canonical.com> Message-Id: <20111129193132.9969.74857.malone@wampee.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 (qemu) device_add driver=3Dne2k_pci,id=3Dx (qemu) device_del x (qemu) device_add driver=3Dne2k_pci,id=3Dx Duplicate ID 'x' for device It appears that drive_add/drive_del works fine, but device_del does not fully delete its members. This happens with today's git HEAD of qemu as well, in other words it affects upstream. ** Also affects: qemu Importance: Undecided Status: New -- = 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