0a7476
From ccd5133d42ea5f02d3c5bc730c3aec534b96b8d5 Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <ccd5133d42ea5f02d3c5bc730c3aec534b96b8d5@dist-git>
0a7476
From: Michal Privoznik <mprivozn@redhat.com>
0a7476
Date: Wed, 3 Apr 2019 15:33:36 +0200
0a7476
Subject: [PATCH] qemu: Put format=raw onto cmd line for SCSI passthrough
0a7476
MIME-Version: 1.0
0a7476
Content-Type: text/plain; charset=UTF-8
0a7476
Content-Transfer-Encoding: 8bit
0a7476
0a7476
https://bugzilla.redhat.com/show_bug.cgi?id=1632833
0a7476
0a7476
When doing a SCSI passthrough we don't put format= onto the
0a7476
command line. This causes qemu to probe the format automatically
0a7476
which ends up in a warning in the domain log and possible qemu
0a7476
disabling writes to the first block (according to the warning
0a7476
message).
0a7476
0a7476
Based-on-work-of: Paolo Bonzini <pbonzini@redhat.com>
0a7476
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
0a7476
(cherry picked from commit 641a95c9b64e74dccb55ebae8f00da3f10c1feae)
0a7476
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
0a7476
Conflicts: tests/qemuxml2argvdata/hostdev-scsi-lsi.args:
0a7476
  tests/qemuxml2argvdata/hostdev-scsi-readonly.args:
0a7476
  tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args:
0a7476
    - Context, since v4.7.0-rc1~268 is not backported
0a7476
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
Message-Id: <6c743591aaf31e4313ab12dec9171716d55fdb43.1554298414.git.mprivozn@redhat.com>
0a7476
Reviewed-by: Erik Skultety <eskultet@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_command.c                              | 2 +-
0a7476
 tests/qemuxml2argvdata/hostdev-scsi-lsi.args         | 2 +-
0a7476
 tests/qemuxml2argvdata/hostdev-scsi-readonly.args    | 2 +-
0a7476
 tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args | 2 +-
0a7476
 4 files changed, 4 insertions(+), 4 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
0a7476
index 98b554627e..d372b1bd79 100644
0a7476
--- a/src/qemu/qemu_command.c
0a7476
+++ b/src/qemu/qemu_command.c
0a7476
@@ -4740,7 +4740,7 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
0a7476
     } else {
0a7476
         if (!(source = qemuBuildSCSIHostHostdevDrvStr(dev)))
0a7476
             goto error;
0a7476
-        virBufferAsprintf(&buf, "file=/dev/%s,if=none", source);
0a7476
+        virBufferAsprintf(&buf, "file=/dev/%s,if=none,format=raw", source);
0a7476
     }
0a7476
     VIR_FREE(source);
0a7476
 
0a7476
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.args b/tests/qemuxml2argvdata/hostdev-scsi-lsi.args
0a7476
index ffb4cc1eaa..c37a269e45 100644
0a7476
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.args
0a7476
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.args
0a7476
@@ -25,6 +25,6 @@ server,nowait \
0a7476
 -usb \
0a7476
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
0a7476
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
0a7476
--drive file=/dev/sg0,if=none,id=drive-hostdev0 \
0a7476
+-drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev0 \
0a7476
 -device scsi-generic,bus=scsi0.0,scsi-id=7,drive=drive-hostdev0,id=hostdev0 \
0a7476
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
0a7476
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-readonly.args b/tests/qemuxml2argvdata/hostdev-scsi-readonly.args
0a7476
index 938ba3bf3f..061c6c1e9f 100644
0a7476
--- a/tests/qemuxml2argvdata/hostdev-scsi-readonly.args
0a7476
+++ b/tests/qemuxml2argvdata/hostdev-scsi-readonly.args
0a7476
@@ -25,7 +25,7 @@ server,nowait \
0a7476
 -usb \
0a7476
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
0a7476
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
0a7476
--drive file=/dev/sg0,if=none,id=drive-hostdev0,readonly=on \
0a7476
+-drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev0,readonly=on \
0a7476
 -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,\
0a7476
 drive=drive-hostdev0,id=hostdev0 \
0a7476
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
0a7476
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args
0a7476
index 18543e24f1..304f11446c 100644
0a7476
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args
0a7476
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.args
0a7476
@@ -25,7 +25,7 @@ server,nowait \
0a7476
 -usb \
0a7476
 -drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
0a7476
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
0a7476
--drive file=/dev/sg0,if=none,id=drive-hostdev0 \
0a7476
+-drive file=/dev/sg0,if=none,format=raw,id=drive-hostdev0 \
0a7476
 -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=4,lun=8,\
0a7476
 drive=drive-hostdev0,id=hostdev0 \
0a7476
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
0a7476
-- 
0a7476
2.21.0
0a7476