From patchwork Thu Dec 10 10:11:07 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 40794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8A35DB6F10 for ; Thu, 10 Dec 2009 21:17:30 +1100 (EST) Received: from localhost ([127.0.0.1]:60471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIg5P-00074Q-Np for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2009 05:17:27 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIfzX-0005CX-H8 for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIfzS-00058N-3A for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:22 -0500 Received: from [199.232.76.173] (port=49969 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIfzQ-00057x-VK for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45590) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIfzQ-0007nr-J9 for qemu-devel@nongnu.org; Thu, 10 Dec 2009 05:11:16 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBAABFEf007607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Dec 2009 05:11:15 -0500 Received: from zweiblum.home.kraxel.org (vpn2-9-140.ams2.redhat.com [10.36.9.140]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBAABEP7030270; Thu, 10 Dec 2009 05:11:14 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 185A3700E5; Thu, 10 Dec 2009 11:11:11 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 10 Dec 2009 11:11:07 +0100 Message-Id: <1260439868-15061-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1260439868-15061-1-git-send-email-kraxel@redhat.com> References: <1260439868-15061-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [FOR 0.12 PATCH 3/4] scsi: fix drive hotplug. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch fills the DriveInfo->unit after hotplugging a scsi disk. It makes a difference when auto-assigning a scsi id, where unit was left filled with '-1' instead of the actual scsi id. With this patch applied the the drive naming logic in drive_init() works as good as it did in previous releases. Which means it works fine with a single scsi bus. Signed-off-by: Gerd Hoffmann --- 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 7e5c51d..9e8e6ed 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -93,6 +93,7 @@ static int scsi_hot_add(DeviceState *adapter, DriveInfo *dinfo, int printinfo) */ dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1); scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo, dinfo->unit); + dinfo->unit = scsidev->id; if (printinfo) qemu_error("OK bus %d, unit %d\n", scsibus->busnr, scsidev->id);