[pve-devel] [PATCH qemu-server] only use scsi-block with explicit opt-in

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jan 19 15:25:39 CET 2017


since it can cause I/O errors and data corruption in low
memory or highly fragmented memory situations since Qemu 2.7

use scsi-hd by default instead

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
note: at least until this is fixed in Qemu

 PVE/QemuServer.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 07c0c05..a77bd3d 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -820,6 +820,14 @@ my %queues_fmt = (
     }
 );
 
+my %scsiblock_fmt = (
+    scsiblock => {
+	type => 'boolean',
+	description => "whether to use scsi-block for full passthrough of host block device\n\nWARNING: can lead to I/O errors in combination with low memory or high memory fragmentation on host",
+	optional => 1,
+    },
+);
+
 my $add_throttle_desc = sub {
     my ($key, $type, $what, $unit, $longunit, $minimum) = @_;
     my $d = {
@@ -876,6 +884,7 @@ my $scsi_fmt = {
     %drivedesc_base,
     %iothread_fmt,
     %queues_fmt,
+    %scsiblock_fmt,
 };
 my $scsidesc = {
     optional => 1,
@@ -913,6 +922,7 @@ my $alldrive_fmt = {
     %iothread_fmt,
     %model_fmt,
     %queues_fmt,
+    %scsiblock_fmt,
 };
 
 my $efidisk_fmt = {
@@ -1493,7 +1503,7 @@ sub print_drivedevice_full {
 	    if ($drive->{file} =~ m|^/|) {
 		$path = $drive->{file};
 		if (my $info = path_is_scsi($path)) {
-		    if ($info->{type} == 0) {
+		    if ($info->{type} == 0 && $drive->{scsiblock}) {
 			$devicetype = 'block';
 		    } elsif ($info->{type} == 1) { # tape
 			$devicetype = 'generic';
-- 
2.1.4





More information about the pve-devel mailing list