On Wed, Apr 20, 2016 at 05:58:21PM +0200, Peter Krempa wrote:
> ---
>  src/conf/domain_conf.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 

This will let you specify tray='closed' for non-removable media too.
The previous patch has a similar issue, but sgio="default" for a disk
that does not support it looks a bit less odd than tray="closed" for a
hard drive.

Jan

> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 8ac308c..5fd8cc4 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -6925,6 +6925,14 @@ virDomainDiskDefValidate(const virDomainDiskDef *def)
>          }
>      }
> 
> +    if (def->tray_status != VIR_DOMAIN_DISK_TRAY_CLOSED  &&
> +        def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
> +        def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
> +        virReportError(VIR_ERR_XML_ERROR, "%s",
> +                       _("tray is only valid for cdrom and floppy"));
> +        return -1;
> +    }
> +
>      return 0;
>  }
> 
> @@ -7392,13 +7400,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
>                             _("unknown disk tray status '%s'"), tray);
>              goto error;
>          }
> -
> -        if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
> -            def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
> -            virReportError(VIR_ERR_XML_ERROR, "%s",
> -                           _("tray is only valid for cdrom and floppy"));
> -            goto error;
> -        }
>      }
> 
>      if (removable) {
> -- 
> 2.8.1
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to