diff mbox series

[1/2] libxl: Remove cdrom forced QDISK w/ stubdom

Message ID 20240109204655.72063-2-jandryuk@gmail.com (mailing list archive)
State Superseded
Headers show
Series libxl: Stubdom cd-rom changing support | expand

Commit Message

Jason Andryuk Jan. 9, 2024, 8:46 p.m. UTC
A Linux HVM domain ignores PV block devices with type cdrom.  The
Windows PV drivers also ignore device-type != "disk".  Therefore QEMU's
emulated CD-ROM support is used.  This allows ejection and other CD-ROM
features to work.

With a stubdom, QEMU is running in the stubdom.  A PV disk is still
connected into the stubdom, and then QEMU can emulate the CD-ROM into
the guest.  This removes the need for forcing to a QDISK.  Relax the
checks to support this.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
---
 tools/libs/light/libxl_disk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Marek Marczykowski-Górecki Jan. 10, 2024, 2:08 p.m. UTC | #1
On Tue, Jan 09, 2024 at 03:46:54PM -0500, Jason Andryuk wrote:
> A Linux HVM domain ignores PV block devices with type cdrom.  The
> Windows PV drivers also ignore device-type != "disk".  Therefore QEMU's
> emulated CD-ROM support is used.  This allows ejection and other CD-ROM
> features to work.
> 
> With a stubdom, QEMU is running in the stubdom.  A PV disk is still
> connected into the stubdom, and then QEMU can emulate the CD-ROM into
> the guest.  This removes the need for forcing to a QDISK.  Relax the
> checks to support this.
> 
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
> ---
>  tools/libs/light/libxl_disk.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
> index b65cad33cc..d1f84ef404 100644
> --- a/tools/libs/light/libxl_disk.c
> +++ b/tools/libs/light/libxl_disk.c
> @@ -192,7 +192,8 @@ static int libxl__device_disk_setdefault(libxl__gc *gc, uint32_t domid,
>  
>      /* Force Qdisk backend for CDROM devices of guests with a device model. */
>      if (disk->is_cdrom != 0 &&
> -        libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) {
> +        libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM &&
> +        !libxl_get_stubdom_id(CTX, domid)) {

Should this check for stubdomain flavor too? I guess it won't really
work with qemu-traditional.
Similar check also wants to be in the next patch, instead of completely
dropping stubdomain check.

>          if (!(disk->backend == LIBXL_DISK_BACKEND_QDISK ||
>                disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)) {
>              LOGD(ERROR, domid, "Backend for CD devices on HVM guests must be Qdisk");
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index b65cad33cc..d1f84ef404 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -192,7 +192,8 @@  static int libxl__device_disk_setdefault(libxl__gc *gc, uint32_t domid,
 
     /* Force Qdisk backend for CDROM devices of guests with a device model. */
     if (disk->is_cdrom != 0 &&
-        libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) {
+        libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM &&
+        !libxl_get_stubdom_id(CTX, domid)) {
         if (!(disk->backend == LIBXL_DISK_BACKEND_QDISK ||
               disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)) {
             LOGD(ERROR, domid, "Backend for CD devices on HVM guests must be Qdisk");