From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYGR3-0004sV-Dh for qemu-devel@nongnu.org; Fri, 03 May 2013 09:54:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYGR1-0007SS-QX for qemu-devel@nongnu.org; Fri, 03 May 2013 09:54:05 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:58252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYGR1-00073y-0M for qemu-devel@nongnu.org; Fri, 03 May 2013 09:54:03 -0400 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 May 2013 23:40:52 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp02.au.ibm.com (Postfix) with ESMTP id 0F0A62BB004F for ; Fri, 3 May 2013 23:53:05 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r43DdJup23724104 for ; Fri, 3 May 2013 23:39:19 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r43Dr47K004207 for ; Fri, 3 May 2013 23:53:04 +1000 From: Anthony Liguori In-Reply-To: <20130503123157.GH20766@redhat.com> References: <1367005387-330-1-git-send-email-aliguori@us.ibm.com> <1367005387-330-4-git-send-email-aliguori@us.ibm.com> <20130502084926.GA30664@dhcp-200-207.str.redhat.com> <878v3x4hy9.fsf@codemonkey.ws> <20130502140622.GC30664@dhcp-200-207.str.redhat.com> <87obct4ch5.fsf@codemonkey.ws> <20130503123157.GH20766@redhat.com> Date: Fri, 03 May 2013 08:52:59 -0500 Message-ID: <87ppx85fwk.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [libvirt] [PATCH 3/3] gtk: add devices menu to allow changing removable block devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Kevin Wolf , Libvirt , qemu-devel@nongnu.org "Daniel P. Berrange" writes: > On Thu, May 02, 2013 at 10:40:06AM -0500, Anthony Liguori wrote: >> Kevin Wolf writes: >> >> >> + >> >> >> + if (strcmp(type, "ide-cd") == 0) { >> >> >> + disk_type = DT_CDROM; >> >> >> + } else if (strcmp(type, "isa-fdc") == 0) { >> >> >> + disk_type = DT_FLOPPY; >> >> >> + } else { >> >> >> + disk_type = DT_NORMAL; >> >> >> + } >> >> > >> >> > Same thing here, comparing against strings is a hack. Devices should >> >> > probably have a property that says what kind of device they are. >> >> >> >> Ack, this is nasty. I would like to eliminate this. There is a type >> >> field in BlockInfo but: >> >> >> >> # @type: This field is returned only for compatibility reasons, it should >> >> # not be used (always returns 'unknown') >> >> >> >> I vaguely remember this happening but I don't remember the specific >> >> reason why. I would definitely prefer that we filled out type >> >> correctly. >> >> >> >> I think Markus was involved in this. Markus or Luiz, do you remember >> >> the story here? >> > >> > The reason is that BlockInfo is about the backend and it simply doesn't >> > know (ever since we introduced if=none, this was buggy, so we just >> > abandoned it at some point). We would have to ask the device, not the >> > block layer. >> >> Yes, this makes sense. We could introduce an interface that all disks >> implemented that returned information about whether it was a CD-ROM, >> Floppy, etc. >> >> How does libvirt cope with this today? I presume they do something >> similar to what this patch is doing in terms of hard coding device >> names. > > Sorry, not really sure what your question is here - how does libvirt > cope with what exactly ? Given a device, how do you figure out if it's a cdrom/floppy/whatever without hard coding a mapping of class name -> device type. Pretty sure libvirt just has a class name mapping, right? Regards, Anthony Liguori > > Daniel > -- > |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| > |: http://libvirt.org -o- http://virt-manager.org :| > |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| > |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|