From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTwLZ-0005hS-CG for qemu-devel@nongnu.org; Tue, 07 Jun 2011 09:29:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTwLX-0005oD-Rm for qemu-devel@nongnu.org; Tue, 07 Jun 2011 09:29:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTwLX-0005o9-CK for qemu-devel@nongnu.org; Tue, 07 Jun 2011 09:29:27 -0400 Date: Tue, 7 Jun 2011 18:59:12 +0530 From: Amit Shah Message-ID: <20110607132912.GG11606@amit-x200.redhat.com> References: <1307127842-12102-1-git-send-email-lcapitulino@redhat.com> <1307127842-12102-6-git-send-email-lcapitulino@redhat.com> <20110606114032.GA8114@amit-x200.redhat.com> <20110606113803.68d5312a@doriath> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110606113803.68d5312a@doriath> Subject: Re: [Qemu-devel] [RFC 05/10] QMP: Introduce the blockdev-tray-open command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: kwolf@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com On (Mon) 06 Jun 2011 [11:38:03], Luiz Capitulino wrote: > On Mon, 6 Jun 2011 17:10:32 +0530 > Amit Shah wrote: > > > On (Fri) 03 Jun 2011 [16:03:57], Luiz Capitulino wrote: > > > > > +static int tray_open(const char *device, int remove, int force) > > > +{ > > > + BlockDriverState *bs; > > > + > > > + bs = bdrv_removable_find(device); > > > + if (!bs) { > > > + return -1; > > > + } > > > + > > > + if (bdrv_eject(bs, 1, force) < 0) { > > > + /* FIXME: will report undefined error in QMP */ > > > + return -1; > > > + } > > > + > > > + if (remove) { > > > + bdrv_close(bs); > > > + } > > > + > > > + return 0; > > > +} > > > > What's the reason to tie the 'remove' with tray open? > > In my first try I had a command called 'blockdev-media-remove', but then > I had the impression that I was going too far as the only reason a client > would ever want to open the tray is to remove the media. Not necessary -- CD/DVD writers eject and reload trays after erasing media -- at least they used to. > > Won't it be > > simpler to have it separated out, perhaps a 'change' event instead of > > 'insert' that can accept NULL which means just remove medium? > > You meant 'command' instead of 'event', right? > > I don't think a change command makes sense, because it's just a shortcut > to open/remove/insert/close. Yes, command, sorry. And by 'change' I don't mean the current monitor change command -- that's a badly-named one. By change I mean just that -- replace the media. And that should succeed only if tray is open. And tray remains open after the change. Amit