From e9bfac2ed7631cca625d18f0a4a4a2644e2f14c6 Mon Sep 17 00:00:00 2001
From: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
Date: Wed, 30 Nov 2022 18:13:37 +0800
Subject: [PATCH 18/24] qemu_command: remove redundant scsi option in
 vhost-user-blk

There is no scsi property for qemu vhost-user-blk device, so we disable
formatting scsi property for vhost-user-blk device, and leave the property for
vhost-blk device as is.

Signed-off-by: Luo Yifan <luoyifan_yewu@cmss.chinamobile.com>
---
 src/qemu/qemu_command.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4b12be6ede..1e44291a8a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2173,7 +2173,8 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
             virBufferAsprintf(&opt, ",event_idx=%s",
                               virTristateSwitchTypeToString(disk->event_idx));
         }
-        if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
+        if (virStorageSourceGetActualType(disk->src) != VIR_STORAGE_TYPE_VHOST_USER &&
+            virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
             /* if sg_io is true but the scsi option isn't supported,
              * that means it's just always on in this version of qemu.
              */
-- 
2.27.0

