Received: from eggs.gnu.org ([140.186.70.92]:52806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RupUL-00052V-Jn for qemu-devel@nongnu.org; Tue, 07 Feb 2012 13:09:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RupUK-0003Z7-8o for qemu-devel@nongnu.org; Tue, 07 Feb 2012 13:09:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RupUK-0003Yx-23 for qemu-devel@nongnu.org; Tue, 07 Feb 2012 13:09:56 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q17I9rd3027719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 7 Feb 2012 13:09:54 -0500 From: Luiz Capitulino Date: Tue, 7 Feb 2012 16:09:44 -0200 Message-Id: <1328638189-9534-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [RFC 0/5]: QMP: Introduce GUEST_MEDIUM_EJECT & BLOCK_MEDIUM_CHANGED List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, eblake@redhat.com, armbru@redhat.com I've tried to implement a BLOCK_MEDIUM_EJECT event that, as we discussed[1], would be emitted by guest-initiated ejects and by the QMP/HMP eject and change commands. However, that turned to be a bit problematic, because the eject and change commands don't exactly handle tray movements: they actually insert/purge a medium from from the drive. Consider this example: you have a medium inserted and locked; a first eject from HMP will tell the guest to eject the medium; if the guest does eject, a second eject from HMP will just purge the medium (in which case BLOCK_MEDIUM_EJECT is a bad event to be emitted). What we really want to do is to tell mngt that the medium was purged. The same is valid for the change command: we want to inform mngt if a medium was inserted or purged and not emulate tray movements with two eject events as we discussed[1]. So, the solution I came up with is to have two events: o GUEST_MEDIUM_EJECTED: emitted when the tray state is changed by the guest o BLOCK_MEDIUM_CHANGED: emitted when there's a medium change. This should happen when the eject and change QMP/HMP commands are used QMP/qmp-events.txt | 38 ++++++++++++++++++++++++++++++++++++++ block.c | 33 ++++++++++++++++++++++++++++++--- block.h | 8 ++++---- block/raw-posix.c | 6 +++--- block/raw.c | 4 ++-- block_int.h | 2 +- hw/ide/atapi.c | 2 +- hw/ide/core.c | 8 ++++---- hw/scsi-disk.c | 8 ++++---- hw/virtio-blk.c | 6 +++--- monitor.c | 6 ++++++ monitor.h | 2 ++ 12 files changed, 98 insertions(+), 25 deletions(-)