Patchwork [4/5] scsi: Generate BLOCK_IO_ERROR QMP event

login
register
mail settings
Submitter Luiz Capitulino
Date Feb. 3, 2010, 2:41 p.m.
Message ID <1265208064-16039-5-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/44380/
State New
Headers show

Comments

Luiz Capitulino - Feb. 3, 2010, 2:41 p.m.
Just call bdrv_mon_event() in the right place.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 hw/scsi-disk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index b34fbaa..1285122 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -182,16 +182,20 @@  static int scsi_handle_write_error(SCSIDiskReq *r, int error)
     BlockInterfaceErrorAction action =
         drive_get_on_error(s->qdev.dinfo->bdrv, 0);
 
-    if (action == BLOCK_ERR_IGNORE)
+    if (action == BLOCK_ERR_IGNORE) {
+        bdrv_mon_event(s->qdev.dinfo->bdrv, BDRV_ACTION_IGNORE, 0);
         return 0;
+    }
 
     if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)
             || action == BLOCK_ERR_STOP_ANY) {
         r->status |= SCSI_REQ_STATUS_RETRY;
         vm_stop(0);
+        bdrv_mon_event(s->qdev.dinfo->bdrv, BDRV_ACTION_STOP, 0);
     } else {
         scsi_command_complete(r, CHECK_CONDITION,
                 HARDWARE_ERROR);
+        bdrv_mon_event(s->qdev.dinfo->bdrv, BDRV_ACTION_REPORT, 0);
     }
 
     return 1;