Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  qmp: add DEVICE_TRAY_MOVED event
  ide: drop ide_tray_state_post_load()
  block: Don't call bdrv_eject() if the tray state didn't change
  block: bdrv_eject(): Make eject_flag a real bool
  block: Rename bdrv_mon_event() & BlockMonEventAction
This commit is contained in:
Anthony Liguori 2012-02-24 09:45:22 -06:00
commit 7c1daf341f
12 changed files with 104 additions and 62 deletions

View file

@ -291,14 +291,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);
@ -317,7 +317,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;
}
@ -1116,8 +1116,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;
}