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

[Xen-changelog] [xen staging] libxl: qemu_disk_scsi_drive_string: Break out common parts of disk config



commit 724e5aa31b58d1e430ad36b484cf0ec021497399
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Wed Jun 13 15:51:36 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jun 28 09:04:55 2018 +0200

    libxl: qemu_disk_scsi_drive_string: Break out common parts of disk config
    
    The generated configurations are identical apart from, in some cases,
    reordering of the id=%s element.  So, overall, no functional change.
    
    This is part of XSA-266.
    
    Reported-by: Andrew Reimers <andrew.reimers@xxxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_dm.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 18ada69e8b..deab371b71 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -798,6 +798,7 @@ static char *qemu_disk_scsi_drive_string(libxl__gc *gc, 
const char *target_path,
                                          int colo_mode, const char **id_ptr)
 {
     char *drive = NULL;
+    char *common = GCSPRINTF("if=none,cache=writeback");
     const char *exportname = disk->colo_export;
     const char *active_disk = disk->active_disk;
     const char *hidden_disk = disk->hidden_disk;
@@ -806,25 +807,23 @@ static char *qemu_disk_scsi_drive_string(libxl__gc *gc, 
const char *target_path,
     switch (colo_mode) {
     case LIBXL__COLO_NONE:
         id = GCSPRINTF("scsi0-hd%d", unit);
-        drive = GCSPRINTF("file=%s,if=none,id=%s,format=%s,cache=writeback",
-                          target_path, id, format);
+        drive = GCSPRINTF("file=%s,id=%s,format=%s,%s",
+                          target_path, id, format, common);
         break;
     case LIBXL__COLO_PRIMARY:
         id = exportname;
         drive = GCSPRINTF(
-            "if=none,cache=writeback,driver=quorum,"
-            "id=%s,"
+            "%s,id=%s,driver=quorum,"
             "children.0.file.filename=%s,"
             "children.0.driver=%s,"
             "read-pattern=fifo,"
             "vote-threshold=1",
-            id, target_path, format);
+            common, id, target_path, format);
         break;
     case LIBXL__COLO_SECONDARY:
         id = "top-colo";
         drive = GCSPRINTF(
-            "if=none,id=%s,cache=writeback,"
-            "driver=replication,"
+            "%s,id=%s,driver=replication,"
             "mode=secondary,"
             "top-id=top-colo,"
             "file.driver=qcow2,"
@@ -832,7 +831,7 @@ static char *qemu_disk_scsi_drive_string(libxl__gc *gc, 
const char *target_path,
             "file.backing.driver=qcow2,"
             "file.backing.file.filename=%s,"
             "file.backing.backing=%s",
-            id, active_disk, hidden_disk, exportname);
+            common, id, active_disk, hidden_disk, exportname);
         break;
     default:
         abort();
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
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®.