qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/3] scsi-disk: check for meduim on ALLOW_MEDIUM


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 2/3] scsi-disk: check for meduim on ALLOW_MEDIUM_REMOVAL
Date: Wed, 04 Dec 2013 18:34:10 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 04/12/2013 05:55, Alexey Kardashevskiy ha scritto:
> This prevents the guest from preventing DVD medium removal when
> there is no medium.
> 
> Without this, if the user has ejected a DVD, it is possible to
> have a block device with an open tray, no media but locked.

This state is weird but should not be a problem.  The tray can
still be closed when it is open and locked:

        if (!start && !s->tray_open && s->tray_locked) {
            scsi_check_condition(r,
                                 bdrv_is_inserted(s->qdev.conf.bs)
                                 ? SENSE_CODE(ILLEGAL_REQ_REMOVAL_PREVENTED)
                                 : SENSE_CODE(NOT_READY_REMOVAL_PREVENTED));
            return -1;
        }

Note that start && s->tray_open && s->tray_locked executes the
command normally, closing the tray and reporting that as a QMP
event.

Paolo

> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> ---
>  hw/scsi/scsi-disk.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index 08b6135..22b6859 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -1622,7 +1622,6 @@ static int32_t scsi_disk_emulate_command(SCSIRequest 
> *req, uint8_t *buf)
>      case RELEASE:
>      case RELEASE_10:
>      case START_STOP:
> -    case ALLOW_MEDIUM_REMOVAL:
>      case GET_CONFIGURATION:
>      case GET_EVENT_STATUS_NOTIFICATION:
>      case MECHANISM_STATUS:
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]