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

[Xen-changelog] [xen stable-4.10] libxl: Specify format of inserted cdrom



commit d27de97cd116b3e68a7e5f4caf841d2ca7982a52
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Wed Apr 25 14:44:34 2018 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Apr 25 14:44:34 2018 +0200

    libxl: Specify format of inserted cdrom
    
    Without this extra parameter on the QMP command, QEMU will guess the
    format of the new file.
    
    This is XSA-258.
    
    Reported-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    master commit: d8f65e68a7c1047fad97206a6282c281247fadc2
    master date: 2018-04-25 14:38:47 +0200
---
 tools/libxl/libxl_device.c   | 13 +++++++++++++
 tools/libxl/libxl_dm.c       | 17 ++---------------
 tools/libxl/libxl_internal.h |  1 +
 tools/libxl/libxl_qmp.c      |  2 ++
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 5438577c3c..17c743d867 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -430,6 +430,19 @@ char 
*libxl__device_disk_string_of_backend(libxl_disk_backend backend)
     }
 }
 
+const char *libxl__qemu_disk_format_string(libxl_disk_format format)
+{
+    switch (format) {
+    case LIBXL_DISK_FORMAT_QCOW: return "qcow";
+    case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
+    case LIBXL_DISK_FORMAT_VHD: return "vpc";
+    case LIBXL_DISK_FORMAT_RAW: return "raw";
+    case LIBXL_DISK_FORMAT_EMPTY: return NULL;
+    case LIBXL_DISK_FORMAT_QED: return "qed";
+    default: return NULL;
+    }
+}
+
 int libxl__device_physdisk_major_minor(const char *physpath, int *major, int 
*minor)
 {
     struct stat buf;
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index a3cddce8b7..b51178b9fd 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -677,19 +677,6 @@ static int libxl__build_device_model_args_old(libxl__gc 
*gc,
     return 0;
 }
 
-static const char *qemu_disk_format_string(libxl_disk_format format)
-{
-    switch (format) {
-    case LIBXL_DISK_FORMAT_QCOW: return "qcow";
-    case LIBXL_DISK_FORMAT_QCOW2: return "qcow2";
-    case LIBXL_DISK_FORMAT_VHD: return "vpc";
-    case LIBXL_DISK_FORMAT_RAW: return "raw";
-    case LIBXL_DISK_FORMAT_EMPTY: return NULL;
-    case LIBXL_DISK_FORMAT_QED: return "qed";
-    default: return NULL;
-    }
-}
-
 static char *dm_spice_options(libxl__gc *gc,
                                     const libxl_spice_info *spice)
 {
@@ -1516,9 +1503,9 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
              * always raw
              */
             if (disks[i].backend == LIBXL_DISK_BACKEND_QDISK)
-                format = qemu_disk_format_string(disks[i].format);
+                format = libxl__qemu_disk_format_string(disks[i].format);
             else
-                format = qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
+                format = libxl__qemu_disk_format_string(LIBXL_DISK_FORMAT_RAW);
 
             if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
                 if (!disks[i].is_cdrom) {
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7ff9a67e50..85ee7b0e15 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1202,6 +1202,7 @@ _hidden int libxl__domain_pvcontrol_write(libxl__gc *gc, 
xs_transaction_t t,
 /* from xl_device */
 _hidden char *libxl__device_disk_string_of_backend(libxl_disk_backend backend);
 _hidden char *libxl__device_disk_string_of_format(libxl_disk_format format);
+_hidden const char *libxl__qemu_disk_format_string(libxl_disk_format format);
 _hidden int libxl__device_disk_set_backend(libxl__gc*, libxl_device_disk*);
 
 _hidden int libxl__device_physdisk_major_minor(const char *physpath, int 
*major, int *minor);
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index eab993aca9..567ed1e772 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -982,6 +982,8 @@ int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid,
         return qmp_run_command(gc, domid, "eject", args, NULL, NULL);
     } else {
         qmp_parameters_add_string(gc, &args, "target", disk->pdev_path);
+        qmp_parameters_add_string(gc, &args, "arg",
+            libxl__qemu_disk_format_string(disk->format));
         return qmp_run_command(gc, domid, "change", args, NULL, NULL);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.