]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: domain: Forbid slice/encryption/copy_on_read with disk type='lun'
authorPeter Krempa <pkrempa@redhat.com>
Thu, 7 May 2020 08:55:37 +0000 (10:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 May 2020 04:55:00 +0000 (06:55 +0200)
Any non-raw block layer feature will not work with raw SCSI command
passthrough via 'scsi-block'. Explicitly refuse use of luks encryption,
storage slices and copy on read.

https://bugzilla.redhat.com/show_bug.cgi?id=1820040

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_validate.c

index 4205c42a56677d0387851edda585aa3e7ec236ef..800aa44f750c17d6eaa3ad97957d62e66d27d344 100644 (file)
@@ -10487,6 +10487,19 @@ qemuDomainDefValidateDiskLunSource(const virStorageSource *src)
         return -1;
     }
 
+    if (src->sliceStorage) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("disk device 'lun' doesn't support storage slice"));
+        return -1;
+    }
+
+    if (src->encryption &&
+        src->encryption->format != VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("disk device 'lun' doesn't support encryption"));
+        return -1;
+    }
+
     return 0;
 }
 
index f789ed075ad7b068fced3b2e12b37c4dfb4ed0f5..d34151050f42c36258e73e09184713ae8976ccb4 100644 (file)
@@ -1997,6 +1997,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef *disk,
             return -1;
         }
 
+        if (disk->copy_on_read == VIR_TRISTATE_SWITCH_ON) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("copy_on_read is not compatible with 'lun' disk '%s'"),
+                           disk->dst);
+            return -1;
+        }
+
         if (qemuDomainDefValidateDiskLunSource(disk->src) < 0)
             return -1;