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

[Xen-changelog] [xen stable-4.8] libxl: restore passing "readonly=" to qemu for SCSI disks



commit 321254a107fe695a84c45acadcec842e36fe8bbf
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Thu Jun 28 11:23:11 2018 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jun 28 11:23:11 2018 +0200

    libxl: restore passing "readonly=" to qemu for SCSI disks
    
    A read-only check was introduced for XSA-142, commit ef6cb76026 ("libxl:
    relax readonly check introduced by XSA-142 fix") added the passing of
    the extra setting, but commit dab0539568 ("Introduce COLO mode and
    refactor relevant function") dropped the passing of the setting again,
    quite likely due to improper re-basing.
    
    Restore the readonly= parameter to SCSI disks.  For IDE disks this is
    supposed to be rejected; add an assert.  And there is a bare ad-hoc
    disk drive string in libxl__build_device_model_args_new, which we also
    update.
    
    This is XSA-266.
    
    Reported-by: Andrew Reimers <andrew.reimers@xxxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    master commit: dd64d3c41a2d15139c3a35d22d4cb6b78f4c5c59
    master date: 2018-06-28 09:05:06 +0200
---
 tools/libxl/libxl_dm.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index e9d4cc6bac..fe329231f9 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -773,7 +773,8 @@ static char *qemu_disk_scsi_drive_string(libxl__gc *gc, 
const char *target_path,
                                          int colo_mode)
 {
     char *drive = NULL;
-    char *common = GCSPRINTF("cache=writeback");
+    char *common = GCSPRINTF("cache=writeback,readonly=%s",
+                             disk->readwrite ? "off" : "on");
     const char *exportname = disk->colo_export;
     const char *active_disk = disk->active_disk;
     const char *hidden_disk = disk->hidden_disk;
@@ -840,6 +841,8 @@ static char *qemu_disk_ide_drive_string(libxl__gc *gc, 
const char *target_path,
     const char *exportname = disk->colo_export;
     const char *active_disk = disk->active_disk;
     const char *hidden_disk = disk->hidden_disk;
+    
+    assert(disk->readwrite); /* should have been checked earlier */
 
     switch (colo_mode) {
     case LIBXL__COLO_NONE:
@@ -1403,8 +1406,9 @@ static int libxl__build_device_model_args_new(libxl__gc 
*gc,
                 if (strncmp(disks[i].vdev, "sd", 2) == 0) {
                     if (colo_mode == LIBXL__COLO_SECONDARY) {
                         drive = libxl__sprintf
-                            (gc, "if=none,driver=%s,file=%s,id=%s",
-                             format, target_path, disks[i].colo_export);
+                            (gc, "if=none,driver=%s,file=%s,id=%s,readonly=%s",
+                             format, target_path, disks[i].colo_export,
+                             disks[i].readwrite ? "off" : "on");
 
                         flexarray_append(dm_args, "-drive");
                         flexarray_append(dm_args, drive);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

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