From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50358 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ontjt-00070I-N4 for qemu-devel@nongnu.org; Tue, 24 Aug 2010 09:40:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ontjo-0002Wp-0Y for qemu-devel@nongnu.org; Tue, 24 Aug 2010 09:40:33 -0400 Received: from cantor.suse.de ([195.135.220.2]:50271 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ontjn-0002WN-MX for qemu-devel@nongnu.org; Tue, 24 Aug 2010 09:40:27 -0400 Message-ID: <4C73CBC9.4050602@suse.de> Date: Tue, 24 Aug 2010 15:40:25 +0200 From: Alexander Graf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 4/5] Add generic drive hotplugging References: <1282600951-30803-1-git-send-email-agraf@suse.de> <1282600951-30803-5-git-send-email-agraf@suse.de> <20100824093155.GB7376@redhat.com> <4C73A2BF.2050605@suse.de> <20100824105154.GH7376@redhat.com> In-Reply-To: <20100824105154.GH7376@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: "Daniel P. Berrange" Cc: Markus Armbruster , Luiz Capitulino , qemu-devel List , Aurelien Jarno , Gerd Hoffmann Daniel P. Berrange wrote: > On Tue, Aug 24, 2010 at 12:45:19PM +0200, Alexander Graf wrote: > >> Daniel P. Berrange wrote: >> >>> On Tue, Aug 24, 2010 at 12:02:30AM +0200, Alexander Graf wrote: >>> >>> >>>> The monitor command for hotplugging is in i386 specific code. This is just >>>> plain wrong, as S390 just learned how to do hotplugging too and needs to >>>> get drives for that. >>>> >>>> So let's add a generic copy to generic code that handles drive_add in a >>>> way that doesn't have pci dependencies. >>>> >>>> I'm not fully happy with the patch as is. IMHO there should only be a >>>> single target agnostic drive_hot_add function available. How we could >>>> potentially fit IF_SCSI in there I don't know though. >>>> >>>> >>> I'm not sure that this patch is actually neccessary. Via a undocumented, >>> sick, dirty hack, you can already use the current drive_add command >>> without a PCI address, for both virtio + scsi. In fact not using the >>> PCI address with drive_add is the preferred approach in the new qdev >>> world even on x86 >>> >>> >> It is certainly necessary since the current code is in a big fat #if >> defined(TARGET_I386) block :). >> > > True, true, killing the #ifdef is needed :-) > And moving it out of the pci specific file. Yeah :). Basically my proposal was to take the patches as is and phase out the pci-hotplug.c version. > >>> The key is that you should use if=none for all cases. Here are two >>> examples of how libvirt does it currently: >>> >>> VirtIO: >>> >>> drive_add dummy file=/var/lib/libvirt/images/data.img,if=none,id=drive-virtio-disk1,format=raw >>> device_add virtio-blk-pci,bus=pci.0,addr=0x0,drive=drive-virtio-disk1,id=virtio-disk1' >>> >>> SCSI: >>> >>> drive_add dummy file=/var/lib/libvirt/images/data.img,if=none,id=drive-scsi0-0-1,format=raw' >>> device_add scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 >>> >>> The 'dummy' value there can be absolutely anything you want. >>> It is totaly ignored when QEMU sees if=none in 2nd arg. >>> >>> >> I'd be all for removing the pci-hotplug.c version of drive_add then. But >> I think the IF_SCSI option there is to append a drive to an existing >> SCSI bus, no? >> > > Actually this SCSI example I give above is appending a drive to an existing > bus (scsi0), in slot 1 (scsi-id=1). To best of my knowledge there is no > remaining use case that requires use of IF_SCSI, IF_IDE, etc. The IF_NONE > approach can cope with all, modulo bugs that appear periodically with code > that mistakenly checks for a particular IF_XXX constant. > > If you wanted to also create a new SCSI bus, before creating the drive on > it, you'd need to run three commands in total: > > device_add lsi,id=scsi0,bus=pci.0,addr=0x7 > drive_add dummy file=/var/lib/libvirt/images/data.img,if=none,id=drive-scsi0-0-1,format=raw > device_add scsi-disk,bus=scsi0.0,scsi-id=1,drive=drive-scsi0-0-1,id=scsi0-0-1 > Nice - so we can just deprecate if=!none? Alex