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