[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] vl: transform QemuOpts device to JSON syntax device
From: |
Kevin Wolf |
Subject: |
Re: [PATCH] vl: transform QemuOpts device to JSON syntax device |
Date: |
Thu, 24 Feb 2022 12:31:21 +0100 |
Am 24.02.2022 um 07:06 hat Zhenzhong Duan geschrieben:
> While there are mixed use of traditional -device option and JSON
> syntax option, QEMU reports conflict, e.x:
>
> /usr/libexec/qemu-kvm -nodefaults \
> -device
> '{"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x02.0"}' \
> -device virtio-scsi-pci,id=scsi1,bus=pci.0
>
> It breaks with:
>
> qemu-kvm: -device
> {"driver":"virtio-scsi-pci","id":"scsi0","bus":"pci.0","addr":"0x02.0"}: PCI:
> slot 2 function 0 not available for virtio-scsi-pci, in use by virtio-scsi-pci
>
> But if we reformat first -device same as the second, so only same kind
> of option for all the devices, it succeeds, vice versa. e.x:
>
> /usr/libexec/qemu-kvm -nodefaults \
> -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=02.0 \
> -device virtio-scsi-pci,id=scsi1,bus=pci.0
>
> Succeed!
>
> Because both kind of options are inserted into their own list and
> break the order in QEMU command line during BDF auto assign. Fix it
> by transform QemuOpts into JSON syntax and insert in JSON device
> list, so the order in QEMU command line kept.
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
This patch is incorrect and breaks several cases, which are the reason
why the QemuOpts path hasn't been changed yet.
For example, after this patch, help doesn't work any more:
$ build/qemu-system-x86_64 -device help
qemu-system-x86_64: -device help: 'help' is not a valid device model name
Any non-string property doesn't work any more in non-JSON syntax:
$ $ build/qemu-system-x86_64 -blockdev null-co,node-name=disk -device
virtio-blk,drive=disk,physical_block_size=4096
qemu-system-x86_64: -device virtio-blk,drive=disk,physical_block_size=4096:
Parameter 'physical_block_size' expects uint64
There may be more cases that are broken with this patch.
Kevin