Received: from eggs.gnu.org ([140.186.70.92]:45778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyMEv-0003Sf-AL for qemu-devel@nongnu.org; Fri, 17 Feb 2012 06:44:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyMEp-0001Mq-Ja for qemu-devel@nongnu.org; Fri, 17 Feb 2012 06:44:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28893) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyMEp-0001Mc-C7 for qemu-devel@nongnu.org; Fri, 17 Feb 2012 06:44:31 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1HBiTGn031672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Feb 2012 06:44:29 -0500 From: Markus Armbruster References: <1329331347-11232-1-git-send-email-lcapitulino@redhat.com> <1329331347-11232-5-git-send-email-lcapitulino@redhat.com> <20120216111447.2160fa63@doriath.home> <4F3D054C.9020603@redhat.com> <4F3E239C.6050402@redhat.com> Date: Fri, 17 Feb 2012 12:44:28 +0100 In-Reply-To: <4F3E239C.6050402@redhat.com> (Kevin Wolf's message of "Fri, 17 Feb 2012 10:53:32 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 4/4] qmp: add BLOCK_MEDIUM_EJECT event List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, eblake@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino Kevin Wolf writes: > Am 16.02.2012 19:30, schrieb Markus Armbruster: >> Let's figure out how this stuff really works. >> >> 1. Guest load/eject >> >> Guest commands load or eject. Device model updates its state of virtual >> tray (e.g. IDEState member tray_open) unless locked, then calls >> bdrv_eject(). >> >> bdrv_eject() is a no-op except for pass-through backends such as >> host_cdrom. >> >> Note: device models call bdrv_eject() whether the state changed or not. >> The only use for that I can see is syncing a wayward physical tray to >> the virtual one. Shouldn't be necessary with Paolo's recent work, >> should it? > > The one case that I'm unsure about is migration. I thought we sync the > physical tray with the virtual one then (or at least we discussed it), > but I don't really know what we do today, or even what the right thing > to do is in some cases. I looked into this back when I moved tray stuff into device models. I believe it needs fixing, but my patch was flawed[*], so I shelved it. Whether migration makes sense while the host CD-ROM is passed through is a valid question. >> I figure Luiz's patch works. But maybe it could be simplified some by >> replacing bdrv_dev_change_media_cb() by a "open/close tray" callback >> that returns whether it moved. bdrv_dev_change_media_cb() would then >> simply open the tray, emit event if it moved, close the tray, emit event >> if it moved. > > Yes, I had the same impression after reading the first few paragraphs of > your analysis (which looks right to me). If I understand Luiz correctly, he'd like to do that in a follow-up patch. [*] http://lists.nongnu.org/archive/html/qemu-devel/2011-09/msg00324.html