
Ok, thanks. On Sat, Jan 22, 2022 at 4:24 PM Peter Krempa <pkrempa@redhat.com> wrote:
On Sat, Jan 22, 2022 at 12:10:35 +0800, yshxxsjt715@gmail.com wrote:
From: shenjiatong <yshxxsjt715@gmail.com>
When trying to attach vhost-user-blk device to virtual machine using libvirt 7.8 and qemu 4.2. Libvirt mistakenly add a scsi=off parameter which is not supported by Qemu
Signed-off-by: shenjiatong <yshxxsjt715@gmail.com> --- src/qemu/qemu_command.c | 6 +++++- .../qemuxml2argvdata/disk-vhostuser-numa.x86_64-4.2.0.args | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 662d15e28e..cdf89fc74c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2253,11 +2253,15 @@ qemuBuildDiskDeviceProps(const virDomainDef *def, "S:iothread", iothread, "T:ioeventfd", disk->ioeventfd, "T:event_idx", disk->event_idx, - "T:scsi", scsi,
Rather than moving this line out of the formatter,
"p:num-queues", disk->queues, "p:queue-size", disk->queue_size, NULL) < 0) return NULL; + + if (virStorageSourceGetActualType(disk->src) !=
VIR_STORAGE_TYPE_VHOST_USER) {
+ if (virJSONValueObjectAdd(&props, "T:scsi", scsi, NULL) < 0)
you can simply skip the code that assigns VIR_TRISTATE_SWITCH_ON/OFF to the 'scsi' value. By default the formatter doesn't print anything for the _ABSENT case.
If you don't mind I can do that before pushing so you don't have to send another round.
-- Best Regards, Jiatong Shen