|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] libxl: Allow Phy backend for CDROM devices
commit d9d4c5a142c9c519a7c6b71f157f04234b8d09a5
Author: Jason Andryuk <jandryuk@xxxxxxxxx>
AuthorDate: Wed Feb 14 10:41:17 2024 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 14 10:41:17 2024 +0100
libxl: Allow Phy backend for CDROM devices
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. Phy support has been enhanced to provide a placeholder file
forempty disks, so it is usable as a CDROM backend as well. Allow Phy
to pass the check as well.
(Bypassing just for a linux-based stubdom doesn't work because
libxl__device_disk_setdefault() gets called early in domain creation
before xenstore is populated with relevant information for the stubdom
type. The build information isn't readily available and won't exist in
some call trees, so it isn't usable either.)
Let disk_try_backend() allow format empty for Phy cdrom drives.
Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx>
Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
tools/libs/light/libxl_device.c | 12 ++++++++----
tools/libs/light/libxl_disk.c | 11 +++++++----
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/tools/libs/light/libxl_device.c b/tools/libs/light/libxl_device.c
index 8bd780493f..6f0100d05e 100644
--- a/tools/libs/light/libxl_device.c
+++ b/tools/libs/light/libxl_device.c
@@ -301,13 +301,17 @@ static int disk_try_backend(disk_try_backend_args *a,
switch (backend) {
case LIBXL_DISK_BACKEND_PHY:
- if (a->disk->format != LIBXL_DISK_FORMAT_RAW) {
- goto bad_format;
- }
-
if (libxl_defbool_val(a->disk->colo_enable))
goto bad_colo;
+ if (a->disk->is_cdrom && a->disk->format == LIBXL_DISK_FORMAT_EMPTY) {
+ LOG(DEBUG, "Disk vdev=%s is an empty cdrom", a->disk->vdev);
+ return backend;
+ }
+
+ if (a->disk->format != LIBXL_DISK_FORMAT_RAW)
+ goto bad_format;
+
if (a->disk->backend_domid != LIBXL_TOOLSTACK_DOMID) {
LOG(DEBUG, "Disk vdev=%s, is using a storage driver domain, "
"skipping physical device check", a->disk->vdev);
diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index 95b32f9d29..ee2e4b0bd3 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -190,15 +190,18 @@ static int libxl__device_disk_setdefault(libxl__gc *gc,
uint32_t domid,
return ERROR_FAIL;
}
- /* Force Qdisk backend for CDROM devices of guests with a device model. */
+ /* Only allow Qdisk or Phy for CDROM devices. */
if (disk->is_cdrom != 0 &&
libxl__domain_type(gc, domid) == LIBXL_DOMAIN_TYPE_HVM) {
+ if (disk->backend == LIBXL_DISK_BACKEND_UNKNOWN)
+ disk->backend = LIBXL_DISK_BACKEND_QDISK;
+
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");
+ disk->backend == LIBXL_DISK_BACKEND_PHY)) {
+ LOGD(ERROR, domid,
+ "Backend for CD devices on HVM guests must be Qdisk or Phy");
return ERROR_FAIL;
}
- disk->backend = LIBXL_DISK_BACKEND_QDISK;
}
if (disk->is_cdrom &&
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |