From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52887 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiQyY-0006tR-Gr for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:29:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiQyW-0007fP-P5 for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:29:22 -0500 Received: from oxygen.pond.sub.org ([213.239.205.148]:58218) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiQyV-0007dr-TU for qemu-devel@nongnu.org; Thu, 27 Jan 2011 07:29:20 -0500 From: Markus Armbruster Date: Thu, 27 Jan 2011 13:29:08 +0100 Message-Id: <1296131356-27257-2-git-send-email-armbru@redhat.com> In-Reply-To: <1296131356-27257-1-git-send-email-armbru@redhat.com> References: <1296131356-27257-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 01/10] scsi hotplug: Set DriveInfo member bus correctly List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com drive_init() picks the first free bus and unit number, unless the user specifies them. This isn't a good fit for the drive_add monitor command, because there we specify the controller by PCI address instead of using bus number set by drive_init(). scsi_hot_add() takes care to replace the unit number set by drive_init() by the real one, but it neglects to replace the bus number. Thus, bus/unit in DriveInfo may be bogus. Affects drive_get() and drive_get_max_bus(). I'm not aware of anything bad happening because of that; looks like by the time we're hot-plugging, the two functions aren't used anymore. Fix it anyway. Signed-off-by: Markus Armbruster --- hw/pci-hotplug.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 270a982..b6dcbda 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -90,6 +90,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, * specified). */ dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1); + dinfo->bus = scsibus->busnr; scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo->unit, false); if (!scsidev) { return -1; -- 1.7.2.3