From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mt1KK-00013W-Vz for qemu-devel@nongnu.org; Wed, 30 Sep 2009 11:42:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mt1KG-000116-TK for qemu-devel@nongnu.org; Wed, 30 Sep 2009 11:42:48 -0400 Received: from [199.232.76.173] (port=51881 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mt1KG-00010q-83 for qemu-devel@nongnu.org; Wed, 30 Sep 2009 11:42:44 -0400 Received: from gecko.sbs.de ([194.138.37.40]:24039) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mt1KF-0007fT-KZ for qemu-devel@nongnu.org; Wed, 30 Sep 2009 11:42:44 -0400 Message-ID: <4AC37D08.7050506@siemens.com> Date: Wed, 30 Sep 2009 17:45:12 +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> In-Reply-To: <4AB73114.4050508@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: > 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. However, is there any standard way to get from an instance of DriveInfo to the corresponding instance of SCSIDevice respectively SCSIDeviceInfo? It's a bit unclear to me if there is no such connection, of if I'm just overlooking something. Thanks, Wolfgang