* [Qemu-devel] [PULL 0/5]: QMP queue
@ 2011-10-14 17:26 Luiz Capitulino
2011-10-20 15:01 ` Anthony Liguori
0 siblings, 1 reply; 16+ messages in thread
From: Luiz Capitulino @ 2011-10-14 17:26 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
Most of the patches are runstate fixes and have been sent to the list
already.
The changes (since 210b3a70383b0bcc4266856431491b39dcb4f14d) are available
in the following repository:
git://repo.or.cz/qemu/qmp-unstable.git qmp/queue
Luiz Capitulino (5):
QMP: Fix blockdev-snapshot-sync doc example
runstate: Print state transition when invalid
runstate: Allow to transition from paused to postmigrate
savevm: qemu_savevm_state(): Drop stop VM logic
runstate: Allow user to migrate twice
cpus.c | 11 +++++++++++
migration.c | 2 +-
qmp-commands.hx | 8 ++++----
savevm.c | 7 -------
sysemu.h | 1 +
vl.c | 12 ++++++++++--
6 files changed, 27 insertions(+), 14 deletions(-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5]: QMP queue
2011-10-14 17:26 [Qemu-devel] [PULL 0/5]: " Luiz Capitulino
@ 2011-10-20 15:01 ` Anthony Liguori
0 siblings, 0 replies; 16+ messages in thread
From: Anthony Liguori @ 2011-10-20 15:01 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
On 10/14/2011 12:26 PM, Luiz Capitulino wrote:
> Most of the patches are runstate fixes and have been sent to the list
> already.
>
> The changes (since 210b3a70383b0bcc4266856431491b39dcb4f14d) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git qmp/queue
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Luiz Capitulino (5):
> QMP: Fix blockdev-snapshot-sync doc example
> runstate: Print state transition when invalid
> runstate: Allow to transition from paused to postmigrate
> savevm: qemu_savevm_state(): Drop stop VM logic
> runstate: Allow user to migrate twice
>
> cpus.c | 11 +++++++++++
> migration.c | 2 +-
> qmp-commands.hx | 8 ++++----
> savevm.c | 7 -------
> sysemu.h | 1 +
> vl.c | 12 ++++++++++--
> 6 files changed, 27 insertions(+), 14 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PULL 0/5]: QMP queue
@ 2012-02-23 14:42 Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction Luiz Capitulino
` (5 more replies)
0 siblings, 6 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
Contains only the DEVICE_TRAY_MOVED event series.
The changes (since 235fe3bfd46b1104575b540d0bc3fdf584030b99) are available
in the following repository:
git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Luiz Capitulino (5):
block: Rename bdrv_mon_event() & BlockMonEventAction
block: bdrv_eject(): Make eject_flag a real bool
block: Don't call bdrv_eject() if the tray state didn't change
ide: drop ide_tray_state_post_load()
qmp: add DEVICE_TRAY_MOVED event
QMP/qmp-events.txt | 18 +++++++++++
block.c | 84 +++++++++++++++++++++++++++++++++------------------
block.h | 8 ++--
block/raw-posix.c | 6 ++--
block/raw.c | 2 +-
block_int.h | 2 +-
hw/ide/atapi.c | 7 +++-
hw/ide/core.c | 16 ++--------
hw/scsi-disk.c | 13 +++++---
hw/virtio-blk.c | 6 ++--
monitor.c | 3 ++
monitor.h | 1 +
12 files changed, 104 insertions(+), 62 deletions(-)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
@ 2012-02-23 14:42 ` Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 2/5] block: bdrv_eject(): Make eject_flag a real bool Luiz Capitulino
` (4 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
They are QMP events, not monitor events. Rename them accordingly.
Also, move bdrv_emit_qmp_error_event() up in the file. A new event will
be added soon and it's good to have them next each other.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 58 +++++++++++++++++++++++++++---------------------------
block.h | 6 ++--
hw/ide/core.c | 6 ++--
hw/scsi-disk.c | 6 ++--
hw/virtio-blk.c | 6 ++--
5 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/block.c b/block.c
index ae297bb..8d4cfea 100644
--- a/block.c
+++ b/block.c
@@ -943,6 +943,35 @@ void bdrv_set_dev_ops(BlockDriverState *bs, const BlockDevOps *ops,
}
}
+void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
+ BlockQMPEventAction action, int is_read)
+{
+ QObject *data;
+ const char *action_str;
+
+ switch (action) {
+ case BDRV_ACTION_REPORT:
+ action_str = "report";
+ break;
+ case BDRV_ACTION_IGNORE:
+ action_str = "ignore";
+ break;
+ case BDRV_ACTION_STOP:
+ action_str = "stop";
+ break;
+ default:
+ abort();
+ }
+
+ data = qobject_from_jsonf("{ 'device': %s, 'action': %s, 'operation': %s }",
+ bdrv->device_name,
+ action_str,
+ is_read ? "read" : "write");
+ monitor_protocol_event(QEVENT_BLOCK_IO_ERROR, data);
+
+ qobject_decref(data);
+}
+
static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load)
{
if (bs->dev_ops && bs->dev_ops->change_media_cb) {
@@ -2293,35 +2322,6 @@ int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
return data.ret;
}
-void bdrv_mon_event(const BlockDriverState *bdrv,
- BlockMonEventAction action, int is_read)
-{
- QObject *data;
- const char *action_str;
-
- switch (action) {
- case BDRV_ACTION_REPORT:
- action_str = "report";
- break;
- case BDRV_ACTION_IGNORE:
- action_str = "ignore";
- break;
- case BDRV_ACTION_STOP:
- action_str = "stop";
- break;
- default:
- abort();
- }
-
- data = qobject_from_jsonf("{ 'device': %s, 'action': %s, 'operation': %s }",
- bdrv->device_name,
- action_str,
- is_read ? "read" : "write");
- monitor_protocol_event(QEVENT_BLOCK_IO_ERROR, data);
-
- qobject_decref(data);
-}
-
BlockInfoList *qmp_query_block(Error **errp)
{
BlockInfoList *head = NULL, *cur_item = NULL;
diff --git a/block.h b/block.h
index 60ea730..ec0a6c8 100644
--- a/block.h
+++ b/block.h
@@ -85,15 +85,15 @@ typedef enum {
typedef enum {
BDRV_ACTION_REPORT, BDRV_ACTION_IGNORE, BDRV_ACTION_STOP
-} BlockMonEventAction;
+} BlockQMPEventAction;
void bdrv_iostatus_enable(BlockDriverState *bs);
void bdrv_iostatus_reset(BlockDriverState *bs);
void bdrv_iostatus_disable(BlockDriverState *bs);
bool bdrv_iostatus_is_enabled(const BlockDriverState *bs);
void bdrv_iostatus_set_err(BlockDriverState *bs, int error);
-void bdrv_mon_event(const BlockDriverState *bdrv,
- BlockMonEventAction action, int is_read);
+void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
+ BlockQMPEventAction action, int is_read);
void bdrv_info_print(Monitor *mon, const QObject *data);
void bdrv_info(Monitor *mon, QObject **ret_data);
void bdrv_stats_print(Monitor *mon, const QObject *data);
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 56b219b..0856385 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -519,7 +519,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
BlockErrorAction action = bdrv_get_on_error(s->bs, is_read);
if (action == BLOCK_ERR_IGNORE) {
- bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_IGNORE, is_read);
return 0;
}
@@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
|| action == BLOCK_ERR_STOP_ANY) {
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->error_status = op;
- bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RUN_STATE_IO_ERROR);
bdrv_iostatus_set_err(s->bs, error);
} else {
@@ -537,7 +537,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
} else {
ide_rw_error(s);
}
- bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_REPORT, is_read);
}
return 1;
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index c12e3a6..a5d2fd1 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -233,14 +233,14 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error)
BlockErrorAction action = bdrv_get_on_error(s->qdev.conf.bs, is_read);
if (action == BLOCK_ERR_IGNORE) {
- bdrv_mon_event(s->qdev.conf.bs, BDRV_ACTION_IGNORE, is_read);
+ bdrv_emit_qmp_error_event(s->qdev.conf.bs, BDRV_ACTION_IGNORE, is_read);
return 0;
}
if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)
|| action == BLOCK_ERR_STOP_ANY) {
- bdrv_mon_event(s->qdev.conf.bs, BDRV_ACTION_STOP, is_read);
+ bdrv_emit_qmp_error_event(s->qdev.conf.bs, BDRV_ACTION_STOP, is_read);
vm_stop(RUN_STATE_IO_ERROR);
bdrv_iostatus_set_err(s->qdev.conf.bs, error);
scsi_req_retry(&r->req);
@@ -259,7 +259,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error)
scsi_check_condition(r, SENSE_CODE(IO_ERROR));
break;
}
- bdrv_mon_event(s->qdev.conf.bs, BDRV_ACTION_REPORT, is_read);
+ bdrv_emit_qmp_error_event(s->qdev.conf.bs, BDRV_ACTION_REPORT, is_read);
}
return 1;
}
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index a5a4396..49990f8 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -69,7 +69,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
VirtIOBlock *s = req->dev;
if (action == BLOCK_ERR_IGNORE) {
- bdrv_mon_event(s->bs, BDRV_ACTION_IGNORE, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_IGNORE, is_read);
return 0;
}
@@ -77,14 +77,14 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
|| action == BLOCK_ERR_STOP_ANY) {
req->next = s->rq;
s->rq = req;
- bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(RUN_STATE_IO_ERROR);
bdrv_iostatus_set_err(s->bs, error);
} else {
virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
bdrv_acct_done(s->bs, &req->acct);
g_free(req);
- bdrv_mon_event(s->bs, BDRV_ACTION_REPORT, is_read);
+ bdrv_emit_qmp_error_event(s->bs, BDRV_ACTION_REPORT, is_read);
}
return 1;
--
1.7.9.111.gf3fb0.dirty
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 2/5] block: bdrv_eject(): Make eject_flag a real bool
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction Luiz Capitulino
@ 2012-02-23 14:42 ` Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 3/5] block: Don't call bdrv_eject() if the tray state didn't change Luiz Capitulino
` (3 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
block.c | 2 +-
block.h | 2 +-
block/raw-posix.c | 6 +++---
block/raw.c | 2 +-
block_int.h | 2 +-
5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index 8d4cfea..bfb0dec 100644
--- a/block.c
+++ b/block.c
@@ -3609,7 +3609,7 @@ int bdrv_media_changed(BlockDriverState *bs)
/**
* If eject_flag is TRUE, eject the media. Otherwise, close the tray
*/
-void bdrv_eject(BlockDriverState *bs, int eject_flag)
+void bdrv_eject(BlockDriverState *bs, bool eject_flag)
{
BlockDriver *drv = bs->drv;
diff --git a/block.h b/block.h
index ec0a6c8..49bca5a 100644
--- a/block.h
+++ b/block.h
@@ -265,7 +265,7 @@ int bdrv_enable_write_cache(BlockDriverState *bs);
int bdrv_is_inserted(BlockDriverState *bs);
int bdrv_media_changed(BlockDriverState *bs);
void bdrv_lock_medium(BlockDriverState *bs, bool locked);
-void bdrv_eject(BlockDriverState *bs, int eject_flag);
+void bdrv_eject(BlockDriverState *bs, bool eject_flag);
void bdrv_get_format(BlockDriverState *bs, char *buf, int buf_size);
BlockDriverState *bdrv_find(const char *name);
BlockDriverState *bdrv_next(BlockDriverState *bs);
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 2ee5d69..2d1bc13 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -994,7 +994,7 @@ static int floppy_media_changed(BlockDriverState *bs)
return ret;
}
-static void floppy_eject(BlockDriverState *bs, int eject_flag)
+static void floppy_eject(BlockDriverState *bs, bool eject_flag)
{
BDRVRawState *s = bs->opaque;
int fd;
@@ -1084,7 +1084,7 @@ static int cdrom_is_inserted(BlockDriverState *bs)
return 0;
}
-static void cdrom_eject(BlockDriverState *bs, int eject_flag)
+static void cdrom_eject(BlockDriverState *bs, bool eject_flag)
{
BDRVRawState *s = bs->opaque;
@@ -1194,7 +1194,7 @@ static int cdrom_is_inserted(BlockDriverState *bs)
return raw_getlength(bs) > 0;
}
-static void cdrom_eject(BlockDriverState *bs, int eject_flag)
+static void cdrom_eject(BlockDriverState *bs, bool eject_flag)
{
BDRVRawState *s = bs->opaque;
diff --git a/block/raw.c b/block/raw.c
index 6098070..1cdac0c 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -61,7 +61,7 @@ static int raw_media_changed(BlockDriverState *bs)
return bdrv_media_changed(bs->file);
}
-static void raw_eject(BlockDriverState *bs, int eject_flag)
+static void raw_eject(BlockDriverState *bs, bool eject_flag)
{
bdrv_eject(bs->file, eject_flag);
}
diff --git a/block_int.h b/block_int.h
index 7946cf6..04f4b83 100644
--- a/block_int.h
+++ b/block_int.h
@@ -197,7 +197,7 @@ struct BlockDriver {
/* removable device specific */
int (*bdrv_is_inserted)(BlockDriverState *bs);
int (*bdrv_media_changed)(BlockDriverState *bs);
- void (*bdrv_eject)(BlockDriverState *bs, int eject_flag);
+ void (*bdrv_eject)(BlockDriverState *bs, bool eject_flag);
void (*bdrv_lock_medium)(BlockDriverState *bs, bool locked);
/* to control generic scsi devices */
--
1.7.9.111.gf3fb0.dirty
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 3/5] block: Don't call bdrv_eject() if the tray state didn't change
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 2/5] block: bdrv_eject(): Make eject_flag a real bool Luiz Capitulino
@ 2012-02-23 14:42 ` Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 4/5] ide: drop ide_tray_state_post_load() Luiz Capitulino
` (2 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
It's not needed. Besides we can then assume that bdrv_eject() is
only called when there's a tray state change, which is useful to
the DEVICE_TRAY_MOVED event (going to be added in a future
commit).
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/atapi.c | 7 +++++--
hw/scsi-disk.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0adb27b..5919cf5 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -883,8 +883,11 @@ static void cmd_start_stop_unit(IDEState *s, uint8_t* buf)
ide_atapi_cmd_error(s, sense, ASC_MEDIA_REMOVAL_PREVENTED);
return;
}
- bdrv_eject(s->bs, !start);
- s->tray_open = !start;
+
+ if (s->tray_open != !start) {
+ bdrv_eject(s->bs, !start);
+ s->tray_open = !start;
+ }
}
ide_atapi_cmd_ok(s);
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index a5d2fd1..091ecdc 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1050,8 +1050,11 @@ static int scsi_disk_emulate_start_stop(SCSIDiskReq *r)
: SENSE_CODE(NOT_READY_REMOVAL_PREVENTED));
return -1;
}
- bdrv_eject(s->qdev.conf.bs, !start);
- s->tray_open = !start;
+
+ if (s->tray_open != !start) {
+ bdrv_eject(s->qdev.conf.bs, !start);
+ s->tray_open = !start;
+ }
}
return 0;
}
--
1.7.9.111.gf3fb0.dirty
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 4/5] ide: drop ide_tray_state_post_load()
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
` (2 preceding siblings ...)
2012-02-23 14:42 ` [Qemu-devel] [PATCH 3/5] block: Don't call bdrv_eject() if the tray state didn't change Luiz Capitulino
@ 2012-02-23 14:42 ` Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 5/5] qmp: add DEVICE_TRAY_MOVED event Luiz Capitulino
2012-02-24 16:35 ` [Qemu-devel] [PULL 0/5]: QMP queue Anthony Liguori
5 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
This is used to sync the physical tray state after migration when
using CD-ROM passthrough. However, migrating when using passthrough
is broken anyway and shouldn't be supported...
So, drop this function as it causes a problem with the DEVICE_TRAY_MOVED
event, which is going to be introduced by the next commit.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
hw/ide/core.c | 10 ----------
1 files changed, 0 insertions(+), 10 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 0856385..ce570a7 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2077,15 +2077,6 @@ static bool ide_drive_pio_state_needed(void *opaque)
|| (s->bus->error_status & BM_STATUS_PIO_RETRY);
}
-static int ide_tray_state_post_load(void *opaque, int version_id)
-{
- IDEState *s = opaque;
-
- bdrv_eject(s->bs, s->tray_open);
- bdrv_lock_medium(s->bs, s->tray_locked);
- return 0;
-}
-
static bool ide_tray_state_needed(void *opaque)
{
IDEState *s = opaque;
@@ -2125,7 +2116,6 @@ static const VMStateDescription vmstate_ide_tray_state = {
.version_id = 1,
.minimum_version_id = 1,
.minimum_version_id_old = 1,
- .post_load = ide_tray_state_post_load,
.fields = (VMStateField[]) {
VMSTATE_BOOL(tray_open, IDEState),
VMSTATE_BOOL(tray_locked, IDEState),
--
1.7.9.111.gf3fb0.dirty
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 5/5] qmp: add DEVICE_TRAY_MOVED event
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
` (3 preceding siblings ...)
2012-02-23 14:42 ` [Qemu-devel] [PATCH 4/5] ide: drop ide_tray_state_post_load() Luiz Capitulino
@ 2012-02-23 14:42 ` Luiz Capitulino
2012-02-24 16:35 ` [Qemu-devel] [PULL 0/5]: QMP queue Anthony Liguori
5 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2012-02-23 14:42 UTC (permalink / raw)
To: aliguori; +Cc: qemu-devel
It's emitted whenever the tray is moved by the guest or by HMP/QMP
commands.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
---
QMP/qmp-events.txt | 18 ++++++++++++++++++
block.c | 24 ++++++++++++++++++++++++
monitor.c | 3 +++
monitor.h | 1 +
4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
index 06cb404..9286af5 100644
--- a/QMP/qmp-events.txt
+++ b/QMP/qmp-events.txt
@@ -26,6 +26,24 @@ Example:
Note: If action is "stop", a STOP event will eventually follow the
BLOCK_IO_ERROR event.
+DEVICE_TRAY_MOVED
+-----------------
+
+It's emitted whenever the tray of a removable device is moved by the guest
+or by HMP/QMP commands.
+
+Data:
+
+- "device": device name (json-string)
+- "tray-open": true if the tray has been opened or false if it has been closed
+ (json-bool)
+
+{ "event": "DEVICE_TRAY_MOVED",
+ "data": { "device": "ide1-cd0",
+ "tray-open": true
+ },
+ "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
+
RESET
-----
diff --git a/block.c b/block.c
index bfb0dec..e27d528 100644
--- a/block.c
+++ b/block.c
@@ -972,10 +972,30 @@ void bdrv_emit_qmp_error_event(const BlockDriverState *bdrv,
qobject_decref(data);
}
+static void bdrv_emit_qmp_eject_event(BlockDriverState *bs, bool ejected)
+{
+ QObject *data;
+
+ data = qobject_from_jsonf("{ 'device': %s, 'tray-open': %i }",
+ bdrv_get_device_name(bs), ejected);
+ monitor_protocol_event(QEVENT_DEVICE_TRAY_MOVED, data);
+
+ qobject_decref(data);
+}
+
static void bdrv_dev_change_media_cb(BlockDriverState *bs, bool load)
{
if (bs->dev_ops && bs->dev_ops->change_media_cb) {
+ bool tray_was_closed = !bdrv_dev_is_tray_open(bs);
bs->dev_ops->change_media_cb(bs->dev_opaque, load);
+ if (tray_was_closed) {
+ /* tray open */
+ bdrv_emit_qmp_eject_event(bs, true);
+ }
+ if (load) {
+ /* tray close */
+ bdrv_emit_qmp_eject_event(bs, false);
+ }
}
}
@@ -3616,6 +3636,10 @@ void bdrv_eject(BlockDriverState *bs, bool eject_flag)
if (drv && drv->bdrv_eject) {
drv->bdrv_eject(bs, eject_flag);
}
+
+ if (bs->device_name[0] != '\0') {
+ bdrv_emit_qmp_eject_event(bs, eject_flag);
+ }
}
/**
diff --git a/monitor.c b/monitor.c
index 0d4daad..03beab3 100644
--- a/monitor.c
+++ b/monitor.c
@@ -485,6 +485,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
case QEVENT_BLOCK_JOB_CANCELLED:
event_name = "BLOCK_JOB_CANCELLED";
break;
+ case QEVENT_DEVICE_TRAY_MOVED:
+ event_name = "DEVICE_TRAY_MOVED";
+ break;
default:
abort();
break;
diff --git a/monitor.h b/monitor.h
index b72ea07..b6f700f 100644
--- a/monitor.h
+++ b/monitor.h
@@ -38,6 +38,7 @@ typedef enum MonitorEvent {
QEVENT_SPICE_DISCONNECTED,
QEVENT_BLOCK_JOB_COMPLETED,
QEVENT_BLOCK_JOB_CANCELLED,
+ QEVENT_DEVICE_TRAY_MOVED,
QEVENT_MAX,
} MonitorEvent;
--
1.7.9.111.gf3fb0.dirty
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5]: QMP queue
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
` (4 preceding siblings ...)
2012-02-23 14:42 ` [Qemu-devel] [PATCH 5/5] qmp: add DEVICE_TRAY_MOVED event Luiz Capitulino
@ 2012-02-24 16:35 ` Anthony Liguori
5 siblings, 0 replies; 16+ messages in thread
From: Anthony Liguori @ 2012-02-24 16:35 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: qemu-devel
On 02/23/2012 08:42 AM, Luiz Capitulino wrote:
> Contains only the DEVICE_TRAY_MOVED event series.
>
> The changes (since 235fe3bfd46b1104575b540d0bc3fdf584030b99) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Pulled. Thanks.
Regards,
Anthony Liguori
>
> Luiz Capitulino (5):
> block: Rename bdrv_mon_event()& BlockMonEventAction
> block: bdrv_eject(): Make eject_flag a real bool
> block: Don't call bdrv_eject() if the tray state didn't change
> ide: drop ide_tray_state_post_load()
> qmp: add DEVICE_TRAY_MOVED event
>
> QMP/qmp-events.txt | 18 +++++++++++
> block.c | 84 +++++++++++++++++++++++++++++++++------------------
> block.h | 8 ++--
> block/raw-posix.c | 6 ++--
> block/raw.c | 2 +-
> block_int.h | 2 +-
> hw/ide/atapi.c | 7 +++-
> hw/ide/core.c | 16 ++--------
> hw/scsi-disk.c | 13 +++++---
> hw/virtio-blk.c | 6 ++--
> monitor.c | 3 ++
> monitor.h | 1 +
> 12 files changed, 104 insertions(+), 62 deletions(-)
>
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PULL 0/5] QMP queue
@ 2013-01-17 15:12 Luiz Capitulino
2013-01-20 20:49 ` Anthony Liguori
0 siblings, 1 reply; 16+ messages in thread
From: Luiz Capitulino @ 2013-01-17 15:12 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori
The changes (since 47f4dac3fde809e3da4e60d9eb699f1d4b378249) are available
in the following repository:
git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Wenchao Xia (5):
HMP: add QDict to info callback handler
HMP: delete info handler
HMP: add infrastructure for sub command
HMP: move define of mon_cmds
HMP: add sub command table to info
hmp-commands.hx | 3 +-
hmp.c | 36 ++++-----
hmp.h | 36 ++++-----
hw/i8259.c | 4 +-
hw/lm32_pic.c | 4 +-
hw/lm32_pic.h | 4 +-
hw/loader.c | 2 +-
hw/loader.h | 3 +-
hw/pc.h | 4 +-
hw/pcmcia.h | 2 +-
hw/qdev-monitor.c | 4 +-
hw/qdev-monitor.h | 4 +-
hw/sun4m.c | 4 +-
hw/sun4m.h | 4 +-
hw/usb.h | 2 +-
hw/usb/bus.c | 2 +-
hw/usb/host-bsd.c | 2 +-
hw/usb/host-linux.c | 2 +-
include/net/net.h | 2 +-
include/net/slirp.h | 2 +-
include/sysemu/sysemu.h | 4 +-
monitor.c | 200 +++++++++++++++++++++++++-----------------------
net/net.c | 2 +-
net/slirp.c | 2 +-
savevm.c | 2 +-
vl.c | 2 +-
26 files changed, 174 insertions(+), 164 deletions(-)
--
1.8.1.GIT
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5] QMP queue
2013-01-17 15:12 Luiz Capitulino
@ 2013-01-20 20:49 ` Anthony Liguori
0 siblings, 0 replies; 16+ messages in thread
From: Anthony Liguori @ 2013-01-20 20:49 UTC (permalink / raw)
To: Luiz Capitulino, qemu-devel; +Cc: aliguori
Pulled. Thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PULL 0/5] QMP queue
@ 2014-01-28 17:27 Luiz Capitulino
2014-02-01 23:41 ` Peter Maydell
0 siblings, 1 reply; 16+ messages in thread
From: Luiz Capitulino @ 2014-01-28 17:27 UTC (permalink / raw)
To: anthony; +Cc: qemu-devel
The changes (since 0169c511554cb0014a00290b0d3d26c31a49818f) are available
in the following repository:
git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Igor Mammedov (4):
object_add: consolidate error handling
vl.c: -object: don't ignore duplicate 'id'
add optional 2nd stage initialization to -object/object-add commands
virtio_rng: replace custom backend API with UserCreatable.complete()
callback
Stratos Psomadakis (1):
monitor: Cleanup mon->outbuf on write error
backends/rng.c | 17 +++++++++--
hw/virtio/virtio-rng.c | 15 ++++++----
include/qom/object_interfaces.h | 62 +++++++++++++++++++++++++++++++++++++++++
include/sysemu/rng.h | 11 --------
monitor.c | 4 +--
qmp.c | 22 ++++++++++++---
qom/Makefile.objs | 1 +
qom/object_interfaces.c | 32 +++++++++++++++++++++
vl.c | 22 ++++++++++++++-
9 files changed, 160 insertions(+), 26 deletions(-)
create mode 100644 include/qom/object_interfaces.h
create mode 100644 qom/object_interfaces.c
--
1.8.1.4
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5] QMP queue
2014-01-28 17:27 Luiz Capitulino
@ 2014-02-01 23:41 ` Peter Maydell
0 siblings, 0 replies; 16+ messages in thread
From: Peter Maydell @ 2014-02-01 23:41 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: QEMU Developers, Anthony Liguori
On 28 January 2014 17:27, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> The changes (since 0169c511554cb0014a00290b0d3d26c31a49818f) are available
> in the following repository:
>
> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PULL 0/5] QMP queue
@ 2015-03-04 19:13 Luiz Capitulino
2015-03-08 14:08 ` Peter Maydell
0 siblings, 1 reply; 16+ messages in thread
From: Luiz Capitulino @ 2015-03-04 19:13 UTC (permalink / raw)
To: peter.maydell; +Cc: qemu-devel
Hi,
This pull request contains two series. A balloon series and memory hotplug
doc series. The balloon series is not totally QMP related, but it has
implications to libvirt when using memory hotplug. So, I'm picking it up.
The second series is a memory hotplug doc improvement. This is not QMP
related at all, but I'm adding it here as it got fully reviewed and is
really wanted.
The following changes since commit 3539bbb93e944ffde31c61c369ea9eedcc5697a6:
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150302.0' into staging (2015-03-04 14:37:31 +0000)
are available in the git repository at:
git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
for you to fetch changes up to a3b042179859c68b3d08f8aa43866d28d6b56987:
docs: add memory-hotplug.txt (2015-03-04 13:00:36 -0500)
----------------------------------------------------------------
Luiz Capitulino (2):
qemu-options.hx: improve -m description
docs: add memory-hotplug.txt
zhanghailiang (3):
pc-dimm: add a function to calculate VM's current RAM size
virtio-balloon: Fix balloon not working correctly when hotplug memory
virtio-balloon: Add some trace events
docs/memory-hotplug.txt | 76 +++++++++++++++++++++++++++++++++++++++++
hw/mem/pc-dimm.c | 26 ++++++++++++++
hw/virtio/virtio-balloon.c | 21 ++++++++----
include/exec/cpu-common.h | 1 +
qemu-options.hx | 22 +++++++++---
stubs/qmp_pc_dimm_device_list.c | 5 +++
trace-events | 4 +++
7 files changed, 144 insertions(+), 11 deletions(-)
create mode 100644 docs/memory-hotplug.txt
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5] QMP queue
2015-03-04 19:13 [Qemu-devel] [PULL 0/5] " Luiz Capitulino
@ 2015-03-08 14:08 ` Peter Maydell
2015-03-09 13:03 ` Luiz Capitulino
0 siblings, 1 reply; 16+ messages in thread
From: Peter Maydell @ 2015-03-08 14:08 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: QEMU Developers
On 5 March 2015 at 04:13, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> Hi,
>
> This pull request contains two series. A balloon series and memory hotplug
> doc series. The balloon series is not totally QMP related, but it has
> implications to libvirt when using memory hotplug. So, I'm picking it up.
> The second series is a memory hotplug doc improvement. This is not QMP
> related at all, but I'm adding it here as it got fully reviewed and is
> really wanted.
>
> The following changes since commit 3539bbb93e944ffde31c61c369ea9eedcc5697a6:
>
> Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150302.0' into staging (2015-03-04 14:37:31 +0000)
>
> are available in the git repository at:
>
>
> git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
>
> for you to fetch changes up to a3b042179859c68b3d08f8aa43866d28d6b56987:
>
> docs: add memory-hotplug.txt (2015-03-04 13:00:36 -0500)
Nudge: this isn't a signed pull request. I'm not currently rejecting
unsigned pulls, but at some point in the not very distant future
(maybe after 2.3?) I plan to start doing so...
That said, I've applied this to master.
thanks
-- PMM
-- PMM
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PULL 0/5] QMP queue
2015-03-08 14:08 ` Peter Maydell
@ 2015-03-09 13:03 ` Luiz Capitulino
0 siblings, 0 replies; 16+ messages in thread
From: Luiz Capitulino @ 2015-03-09 13:03 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On Sun, 8 Mar 2015 23:08:04 +0900
Peter Maydell <peter.maydell@linaro.org> wrote:
> On 5 March 2015 at 04:13, Luiz Capitulino <lcapitulino@redhat.com> wrote:
> > Hi,
> >
> > This pull request contains two series. A balloon series and memory hotplug
> > doc series. The balloon series is not totally QMP related, but it has
> > implications to libvirt when using memory hotplug. So, I'm picking it up.
> > The second series is a memory hotplug doc improvement. This is not QMP
> > related at all, but I'm adding it here as it got fully reviewed and is
> > really wanted.
> >
> > The following changes since commit 3539bbb93e944ffde31c61c369ea9eedcc5697a6:
> >
> > Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20150302.0' into staging (2015-03-04 14:37:31 +0000)
> >
> > are available in the git repository at:
> >
> >
> > git://repo.or.cz/qemu/qmp-unstable.git queue/qmp
> >
> > for you to fetch changes up to a3b042179859c68b3d08f8aa43866d28d6b56987:
> >
> > docs: add memory-hotplug.txt (2015-03-04 13:00:36 -0500)
>
> Nudge: this isn't a signed pull request. I'm not currently rejecting
> unsigned pulls, but at some point in the not very distant future
> (maybe after 2.3?) I plan to start doing so...
My bad. I knew there was something missing when I was fixing my
scripts after a long time without sending pull requests. Sorry
about that.
> That said, I've applied this to master.
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2015-03-09 13:03 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-23 14:42 [Qemu-devel] [PULL 0/5]: QMP queue Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 1/5] block: Rename bdrv_mon_event() & BlockMonEventAction Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 2/5] block: bdrv_eject(): Make eject_flag a real bool Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 3/5] block: Don't call bdrv_eject() if the tray state didn't change Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 4/5] ide: drop ide_tray_state_post_load() Luiz Capitulino
2012-02-23 14:42 ` [Qemu-devel] [PATCH 5/5] qmp: add DEVICE_TRAY_MOVED event Luiz Capitulino
2012-02-24 16:35 ` [Qemu-devel] [PULL 0/5]: QMP queue Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2015-03-04 19:13 [Qemu-devel] [PULL 0/5] " Luiz Capitulino
2015-03-08 14:08 ` Peter Maydell
2015-03-09 13:03 ` Luiz Capitulino
2014-01-28 17:27 Luiz Capitulino
2014-02-01 23:41 ` Peter Maydell
2013-01-17 15:12 Luiz Capitulino
2013-01-20 20:49 ` Anthony Liguori
2011-10-14 17:26 [Qemu-devel] [PULL 0/5]: " Luiz Capitulino
2011-10-20 15:01 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).