From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mt4U1-00073w-J6 for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:05:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mt4Tw-0006vb-QG for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:05:00 -0400 Received: from [199.232.76.173] (port=53928 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt4Tw-0006vJ-FM for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:04:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1459) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mt4Tv-0004Zy-Re for qemu-devel@nongnu.org; Wed, 30 Sep 2009 15:04:56 -0400 Message-ID: <4AC3ABD2.6080508@redhat.com> Date: Wed, 30 Sep 2009 21:04:50 +0200 From: Gerd Hoffmann 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> In-Reply-To: <4AC37D08.7050506@siemens.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wolfgang Mauerer Cc: "Kiszka, Jan" , "qemu-devel@nongnu.org" , "wlm.libvirt@googlemail.com" 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. > 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, Gerd