From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MtGSK-0005lq-44 for qemu-devel@nongnu.org; Thu, 01 Oct 2009 03:52:04 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MtGSD-0005ee-54 for qemu-devel@nongnu.org; Thu, 01 Oct 2009 03:52:02 -0400 Received: from [199.232.76.173] (port=41963 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MtGSC-0005eF-TP for qemu-devel@nongnu.org; Thu, 01 Oct 2009 03:51:56 -0400 Received: from mx20.gnu.org ([199.232.41.8]:29942) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MtGSC-00023R-AG for qemu-devel@nongnu.org; Thu, 01 Oct 2009 03:51:56 -0400 Received: from lizzard.sbs.de ([194.138.37.39]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MtGSA-00085e-S5 for qemu-devel@nongnu.org; Thu, 01 Oct 2009 03:51:55 -0400 Message-ID: <4AC4602F.3050103@siemens.com> Date: Thu, 01 Oct 2009 09:54:23 +0200 From: Wolfgang Mauerer MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 3/4] SCSI-Hotdel: Implement drive_hot_del References: <1253287594-12905-1-git-send-email-wolfgang.mauerer@siemens.com> <1253287594-12905-2-git-send-email-wolfgang.mauerer@siemens.com> <1253287594-12905-3-git-send-email-wolfgang.mauerer@siemens.com> <1253287594-12905-4-git-send-email-wolfgang.mauerer@siemens.com> <4AB73114.4050508@redhat.com> <4AC37D08.7050506@siemens.com> <4AC3ABD2.6080508@redhat.com> In-Reply-To: <4AC3ABD2.6080508@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: "Kiszka, Jan" , "qemu-devel@nongnu.org" , "wlm.libvirt@googlemail.com" Gerd Hoffmann wrote: > On 09/30/09 17:45, Wolfgang Mauerer wrote: >> Gerd Hoffmann wrote: >>> Hi, >>> >>>> + dinfo = drive_get(type, bus, unit); >>>> + if (!dinfo) { >>>> + monitor_printf(mon, "Trying to remove non-existent device\n"); >>>> + return; >>>> + } >>> No. Just don't do this silly if/bus/unit parsing. At very minimum use >>> drive_get_by_id() here, then have something like 'drive_del $id'. >>> >>> IMHO much better would be to go qdev instead though. We should have >>> generic device_add + device_del monitor commands which work for any >>> device, pretty much like the -device command line switch. >> That makes sense, but I'd nevertheless prefer to stick with the >> more traditional approach right now, replacing the >> bus/unit parsing with an ID-based variant. > > Have a look at the "qdev: bus management updates." patch series posted a > few days ago. It adds device_add+device_del. Thanks for the pointer. The reason why I'd (still :-)) like to stick to the non-qdev variant is because I would want the patch to be applicable to older qemu releases for various reasons, and backporting all the required qdev changes does not seem to be a reasonable option (but please tell me if you think this would make sense) >> However, is there any >> standard way to get from an instance of DriveInfo to >> the corresponding instance of SCSIDevice respectively >> SCSIDeviceInfo? > > No. It is linked the other way around: The device has a reference to > the DriveInfo. Which is one of the reasons why I think drive_del isn't > that a great idea. Cheers, Wolfgang