Re: [PATCH 05/11] qemu: Prohibit setting tray status as open for block type disk

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

 



On Wed, Mar 14, 2012 at 11:26:49PM +0800, Osier Yang wrote:
> --
> Created this as a seperate patch, as I'm not quite sure if it's
> good to do this in libvirt, it's more like a protection for
> qemu problem, i.e. closing the physical drive tray won't close
> the guest tray. Paolo persist in doing this in libvirt, but IMHO
> QEMU is the better place to prevent that. Anyway, let's evaluate.
> ---
>  src/qemu/qemu_command.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index ba6edce..29cc4bd 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1963,6 +1963,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
>                  break;
>              }
>          } else {
> +            if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) &&
> +                (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
> +                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                                _("tray status 'open' is invalid for "
> +                                  "block type disk"));
> +                goto error;
> +            }
>              virBufferEscape(&opt, ',', ",", "file=%s,", disk->src);
>          }
>      }
> @@ -4625,6 +4632,14 @@ qemuBuildCommandLine(virConnectPtr conn,
>              const char *fmt;
>              virDomainDiskDefPtr disk = def->disks[i];
>  
> +            if ((disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK) &&
> +                (disk->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN)) {
> +                qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                                _("tray status 'open' is invalid for "
> +                                  "block type disk"));
> +                goto error;
> +            }
> +
>              if (disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
>                  if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
>                      virCommandAddArg(cmd, "-usbdevice");

  I think it's fine to do this in libvirt, after all we decided that
hard drives could have no tray, that's a libvirt decision from an API
POV, so I think it fine to implement the check here IMHO,

 ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]