This series converts our generation of -device to JSON. This allows to use proper types when talking on QMP which will become mandatory in qemu soon (for now we coverted _everything_ to strings) and also use JSON on the commandline which will be the only "stable" interface. Part 1 consists of cleanups and conversion of all devices which can be hotplugged and most others. There are few other missing along with preparation for schema validation which will come in part 2. The patches can be fetched at: git fetch https://gitlab.com/pipo.sk/libvirt.git jsonify-refactors-2 Peter Krempa (103): virJSONValueObjectAddVArgs: Add 'k' convertor for formatting non-negative integers virJSONValueObjectAddVArgs: Add check for presence of the ':' separator virJSONValueObjectAddVArgs: Add new convertors for allocated strings qemuBuildMemoryCellBackendStr: Return JSON props instead of a buffer qemuBuildInputDevStr: Don't mix generators for -object and -device qemuBuildObjectCommandlineFromJSON: Format directly into the virCommand qemu: capabilities: Rename QEMU_CAPS_OBJECT_QAPIFIED to QEMU_CAPS_OBJECT_JSON qemu: capabilities: Introduce QEMU_CAPS_NETDEV_JSON qemuBuildObjectCommandlineFromJSON: Remove checks for 'type' and 'alias' testCompareXMLToArgvValidateSchema: Base -netdev validation on JSON qemu: command: Format netdev as JSON when QEMU_CAPS_NETDEV_JSON is present virQEMUBuildNetdevCommandlineFromJSON: Remove unused formatter qemu: Remove 'qemuBuildCommandLineFlags' and associated code virQEMUBuildDriveCommandlineFromJSON: Open-code in callers qemuxml2argvtest: Refactor QAPI schema validation code virCommandGetArgList: Remove 'nargs' argument qemu: capabilities: Introduce QEMU_CAPS_CHARDEV_JSON qemu: capabilities: Introduce QEMU_CAPS_DEVICE_JSON tests: qemuxml2argv: Convert watchdog tests on x86_64 to DO_TEST_CAPS_LATEST tests: qemuxml2argv: Test also the i6300esb watchdog qemuxml2argvtest: Convert 'panic' test cases to DO_TEST_CAPS_LATEST qemuxml2xmltest: Remove 'panic-isa' case qemu: Move watchdog model validation into the validation code qemuDomainHotplugAddVcpu: Refactor cleanup qemu: Rename 'qemuMonitorAddDeviceArgs' to 'qemuMonitorAddDeviceProps' qemuMonitorJSONAddDeviceProps: Refactor cleanup virQEMUBuildCommandLineJSONIterate: Simplify logic virQEMUBuildCommandLineJSONRecurse: Error out when array conversion function is not provided qemuBlockStorageSourceAttachRollback: Sanitize warning messages qemuBuildDeviceAddressSt: Split out formatting of PCI address qemuBuildDeviceAddressPCIStr: Make error messages easier to find qemuBuildDeviceAddressPCIStr: Extract PCI bus name lookup qemu: command: Introduce JSON equivalent of qemuBuildDeviceAddressStr qemuBuildVirtioDevStr: Don't return early qemuBuildVirtioDevStr: Extract code for determining device model qemuBuildVirtioDevGetConfig: Split out per device type code qemuDeviceVideoGetModel: Clarify 'virtio' argument qemuDeviceVideoGetModel: Move to the beginning qemuBuildVirtioDevGetConfig: Split up formatting of bus suffix qemuBuildVirtioDevGetConfigDev: Provide more information qemuBuildVirtioDevStr: Remove 'baseName' argument qemuBuildVirtioDevStr: Format also virtioOptions qemuBuildVirtioOptionsStr: Remove empty function qemuBuildDeviceVideoStr: Properly format virtio options for 'virtio-vga' conf: Introduce 'effectiveBootIndex' into 'virDomainDeviceInfo' qemu: process: Make qemuProcessPrepareDomainDiskBootorder more universal qemu: Use 'effectiveBootIndex' to handle <os><boot dev='network'> qemu: Clean up after old-style passing of 'bootIndex' to network devices virDomainDeviceGetInfo: Make argument const qemuValidateDomainDeviceDef: Optimize virDomainDeviceInfo validation qemuValidateDomainDeviceDef: Avoid unneded variable and 'break' statements qemu: validate: Move validation of device rom qemu: command: Introduce JSON variant of qemuBuildVirtioDevStr qemu: command: Introduce helper for building JSON props of -device into commandline qemu: command: Introduce JSON variant of qemuBuildRomProps qemuBuildPanicCommandLine: Generate via JSON qemuBuildWatchdogCommandLine: Generate via JSON qemuBuildMemoryDeviceCommandLine: Generate via JSON qemuBuildShmemCommandLine: Generate via JSON qemuBuildMemballoonCommandLine: Generate via JSON qemuBuildMemballoonCommandLine: Reorder properties qemuBuildRNGCommandLine: Generate via JSON qemuBuildHostdevCommandLine: Build mediated device commandline via JSON qemuBuildHostdevMediatedDevProps: Move 'ramfb' and 'bootindex' before the address qemuBuildHostdevMediatedDevProps: Format USB host devices via JSON qemuBuildRedirdevCommandLine: Generate via JSON qemuBuildInputCommandLine: Generate via JSON qemuCommandAddExtDevice: Generate via JSON qemuBuildHostdevCommandLine: Format PCI host devices via JSON qemuBuildPCIHostdevDevProps: Move 'failover_pair_id' property before address qemuBuildDeviceAddressProps: Format also 'drive' addresses qemu: validate: Move disk address validation code qemuBuildHostdevSCSICommandLine: Generate via JSON qemuBuildSCSIHostdevDevProps: Reorder 'drive','id' and 'bootindex' after address qemuBuildIoEventFdStr: Always assume support for QEMU_CAPS_VIRTIO_IOEVENTFD qemu: capabilities: Retire QEMU_CAPS_VIRTIO_IOEVENTFD qemu: Always assume presence of QEMU_CAPS_VIRTIO_(BLK|NET)_EVENT_IDX qemu: capabilities: Retire QEMU_CAPS_VIRTIO_(BLK|NET)_EVENT_IDX qemuBuildDiskFrontendAttributeErrorPolicy: Extract logic qemuBuildDiskCommandLine: Generate via JSON qemuBuildInterfaceCommandLine: Generate via JSON qemuBuildNicDevProps: Move formatting of bootindex qemu: command: Remove unused qemuBuildRomStr qemuBuildControllerDevStr: Split out formatting of SCSI controller qemuBuildControllerDevStr: Split out formatting of PCI controller qemuBuildControllerSCSIDevStr: Format via JSON properties qemuBuildControllerPCIDevStr: Format via JSON properties qemuBuildUSBControllerDevStr: Split out validation of USB controller qemuBuildUSBControllerDevStr: Format via JSON properties. qemuBuildControllersByTypeCommandLine: Generate via JSON qemuBuildChrDeviceCommandLine: Generate via JSON qemuBuildHostdevCommandLine: Generate via JSON qemuBuildVsockCommandLine: Generate via JSON qemu: monitor: Remove legacy 'device_add' infrastrcture qemuBuildVHostUserFsCommandLine: Generate via JSON qemuBuildFSDevCommandLine: Generate via JSON qemuBuildVideoCommandLine: Generate via JSON qemu: Command remove unused 'qemuBuildVirtioDevStr' qemuBuildSoundCommandLine: Generate via JSON qemuBuildSoundCommandLine: Generate codecs via JSON qemuBuildHubCommandLine: Generate via JSON qemuBuildTPMCommandLine: Generate via JSON qemu: command: Remove unused 'qemuBuildDeviceAddressStr' src/conf/device_conf.h | 7 + src/conf/domain_conf.c | 8 +- src/conf/domain_conf.h | 2 +- src/libvirt_private.syms | 3 +- src/qemu/qemu_block.c | 6 +- src/qemu/qemu_capabilities.c | 20 +- src/qemu/qemu_capabilities.h | 13 +- src/qemu/qemu_command.c | 3981 +++++++++-------- src/qemu/qemu_command.h | 151 +- src/qemu/qemu_domain.h | 4 - src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_hotplug.c | 235 +- src/qemu/qemu_monitor.c | 49 +- src/qemu/qemu_monitor.h | 11 +- src/qemu/qemu_monitor_json.c | 175 +- src/qemu/qemu_monitor_json.h | 6 +- src/qemu/qemu_process.c | 61 +- src/qemu/qemu_process.h | 3 +- src/qemu/qemu_validate.c | 367 +- src/util/vircommand.c | 4 +- src/util/vircommand.h | 2 +- src/util/virjson.c | 93 +- src/util/virqemu.c | 71 +- src/util/virqemu.h | 10 +- .../caps_2.11.0.s390x.xml | 3 - .../caps_2.11.0.x86_64.xml | 3 - .../caps_2.12.0.aarch64.xml | 3 - .../caps_2.12.0.ppc64.xml | 3 - .../caps_2.12.0.s390x.xml | 3 - .../caps_2.12.0.x86_64.xml | 3 - .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 3 - .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 3 - .../caps_3.0.0.x86_64.xml | 3 - .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 3 - .../caps_3.1.0.x86_64.xml | 3 - .../caps_4.0.0.aarch64.xml | 3 - .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 3 - .../caps_4.0.0.riscv32.xml | 3 - .../caps_4.0.0.riscv64.xml | 3 - .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 3 - .../caps_4.0.0.x86_64.xml | 3 - .../caps_4.1.0.x86_64.xml | 3 - .../caps_4.2.0.aarch64.xml | 3 - .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 3 - .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 3 - .../caps_4.2.0.x86_64.xml | 3 - .../caps_5.0.0.aarch64.xml | 3 - .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 3 - .../caps_5.0.0.riscv64.xml | 3 - .../caps_5.0.0.x86_64.xml | 3 - .../caps_5.1.0.x86_64.xml | 3 - .../caps_5.2.0.aarch64.xml | 3 - .../qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 3 - .../caps_5.2.0.riscv64.xml | 3 - .../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 3 - .../caps_5.2.0.x86_64.xml | 3 - .../caps_6.0.0.aarch64.xml | 3 - .../qemucapabilitiesdata/caps_6.0.0.s390x.xml | 3 - .../caps_6.0.0.x86_64.xml | 3 - .../caps_6.1.0.x86_64.xml | 3 - tests/qemumonitorjsontest.c | 2 - ...fault-cpu-kvm-virt-4.2.aarch64-latest.args | 4 +- ...fault-cpu-tcg-virt-4.2.aarch64-latest.args | 4 +- .../qemuxml2argvdata/aarch64-pci-serial.args | 2 +- .../aarch64-traditional-pci.args | 4 +- .../aarch64-video-default.args | 2 +- .../aarch64-video-virtio-gpu-pci.args | 6 +- .../aarch64-virt-2.6-virtio-pci-default.args | 2 +- .../aarch64-virt-graphics.aarch64-latest.args | 16 +- .../aarch64-virt-headless.aarch64-latest.args | 14 +- .../aarch64-virtio-pci-default.args | 12 +- tests/qemuxml2argvdata/autoindex.args | 22 +- .../qemuxml2argvdata/balloon-ccw-deflate.args | 2 +- .../balloon-device-deflate-off.args | 2 +- .../balloon-device-deflate.args | 2 +- tests/qemuxml2argvdata/bios-nvram-secure.args | 2 +- tests/qemuxml2argvdata/boot-complex.args | 2 +- tests/qemuxml2argvdata/boot-order.args | 2 +- tests/qemuxml2argvdata/controller-order.args | 2 +- tests/qemuxml2argvdata/cpu-host-model.args | 2 +- .../cpu-host-model.x86_64-2.11.0.args | 6 +- .../cpu-host-model.x86_64-2.12.0.args | 6 +- .../cpu-host-model.x86_64-3.0.0.args | 6 +- .../cpu-host-model.x86_64-3.1.0.args | 6 +- .../cpu-host-model.x86_64-4.0.0.args | 6 +- .../cpu-host-model.x86_64-4.1.0.args | 6 +- .../cpu-host-model.x86_64-4.2.0.args | 6 +- .../cpu-host-model.x86_64-5.0.0.args | 6 +- .../cpu-host-model.x86_64-5.1.0.args | 6 +- .../cpu-host-model.x86_64-5.2.0.args | 6 +- .../cpu-host-model.x86_64-6.0.0.args | 6 +- .../cpu-host-model.x86_64-6.1.0.args | 6 +- .../cpu-host-model.x86_64-latest.args | 6 +- ...ult-video-type-aarch64.aarch64-latest.args | 4 +- ...ult-video-type-riscv64.riscv64-latest.args | 4 +- .../disk-floppy-q35-2_11.x86_64-2.12.0.args | 4 +- .../disk-floppy-q35-2_11.x86_64-latest.args | 4 +- .../disk-floppy-q35-2_9.x86_64-2.12.0.args | 4 +- .../disk-floppy-q35-2_9.x86_64-latest.args | 4 +- .../disk-ide-wwn.x86_64-latest.args | 2 +- .../disk-scsi-disk-wwn.x86_64-latest.args | 4 +- .../disk-scsi.x86_64-latest.args | 4 +- ...tdev-mdev-display-ramfb.x86_64-latest.args | 2 +- .../hostdev-scsi-lsi.x86_64-4.1.0.args | 12 +- .../hostdev-scsi-lsi.x86_64-latest.args | 12 +- .../hostdev-scsi-vhost-scsi-pcie.args | 4 +- ...hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 14 +- ...ostdev-scsi-virtio-scsi.x86_64-latest.args | 14 +- ...ubsys-mdev-vfio-ccw-boot.s390x-latest.args | 2 +- .../mach-virt-serial-pci.args | 2 +- .../mach-virt-serial-usb.args | 4 +- ...ine-loadparm-multiple-disks-nets-s390.args | 2 +- .../machine-loadparm-net-s390.args | 2 +- tests/qemuxml2argvdata/machine-smm-opt.args | 2 +- tests/qemuxml2argvdata/name-escape.args | 2 +- .../net-virtio-teaming-hostdev.args | 4 +- .../qemuxml2argvdata/net-virtio-teaming.args | 4 +- .../os-firmware-bios.x86_64-latest.args | 2 +- ...re-efi-no-enrolled-keys.x86_64-latest.args | 4 +- ...os-firmware-efi-secboot.x86_64-latest.args | 2 +- .../os-firmware-efi.x86_64-latest.args | 2 +- ...e.args => panic-double.x86_64-latest.args} | 16 +- tests/qemuxml2argvdata/panic-isa.xml | 33 - tests/qemuxml2argvdata/panic-no-address.args | 33 - .../panic-no-address.x86_64-latest.args | 37 + tests/qemuxml2argvdata/panic.args | 33 - .../qemuxml2argvdata/panic.x86_64-latest.args | 37 + tests/qemuxml2argvdata/pcie-expander-bus.args | 66 +- .../pcie-root-port-model-generic.args | 6 +- .../pcie-root-port-model-ioh3420.args | 4 +- ...cie-root-port-nohotplug.x86_64-latest.args | 14 +- tests/qemuxml2argvdata/pcie-root-port.args | 4 +- .../pcie-switch-downstream-port.args | 16 +- .../pcie-switch-upstream-port.args | 4 +- ...ault-cpu-kvm-pseries-2.7.ppc64-latest.args | 2 +- ...ault-cpu-kvm-pseries-3.1.ppc64-latest.args | 2 +- ...ault-cpu-kvm-pseries-4.2.ppc64-latest.args | 2 +- ...ault-cpu-tcg-pseries-2.7.ppc64-latest.args | 2 +- ...ault-cpu-tcg-pseries-3.1.ppc64-latest.args | 2 +- ...ault-cpu-tcg-pseries-4.2.ppc64-latest.args | 2 +- .../ppc64-pseries-graphics.ppc64-latest.args | 2 +- .../ppc64-pseries-headless.ppc64-latest.args | 2 +- .../ppc64-tpmproxy-with-tpm.ppc64-latest.args | 2 +- tests/qemuxml2argvdata/pseries-basic.args | 2 +- .../pseries-cpu-compat-power9.args | 2 +- .../qemuxml2argvdata/pseries-cpu-compat.args | 2 +- tests/qemuxml2argvdata/pseries-cpu-exact.args | 2 +- tests/qemuxml2argvdata/pseries-cpu-le.args | 2 +- .../pseries-panic-missing.args | 2 +- .../pseries-panic-no-address.args | 2 +- .../pseries-serial-native.args | 2 +- .../qemuxml2argvdata/pseries-usb-default.args | 2 +- tests/qemuxml2argvdata/pseries-usb-kbd.args | 2 +- tests/qemuxml2argvdata/pseries-usb-multi.args | 2 +- .../pseries-vio-user-assigned.args | 8 +- tests/qemuxml2argvdata/pseries-vio.args | 8 +- .../q35-default-devices-only.args | 6 +- tests/qemuxml2argvdata/q35-multifunction.args | 36 +- .../q35-pci-force-address.args | 2 +- tests/qemuxml2argvdata/q35-pcie-autoadd.args | 28 +- tests/qemuxml2argvdata/q35-pcie.args | 26 +- .../q35-pm-disable-fallback.args | 2 +- tests/qemuxml2argvdata/q35-pm-disable.args | 2 +- .../q35-virt-manager-basic.args | 12 +- tests/qemuxml2argvdata/q35-virtio-pci.args | 26 +- .../riscv64-virt-graphics.riscv64-latest.args | 16 +- .../riscv64-virt-headless.riscv64-latest.args | 14 +- .../qemuxml2argvdata/s390-panic-missing.args | 2 +- .../serial-dev-chardev-iobase.args | 2 +- .../tpm-emulator-spapr.ppc64-latest.args | 10 +- .../tseg-explicit-size.x86_64-latest.args | 6 +- ...sb-controller-explicit-unavailable-q35.err | 2 +- .../usb-controller-qemu-xhci-unavailable.err | 2 +- ...vhost-user-fs-hugepages.x86_64-latest.args | 8 +- .../vhost-vsock-ccw-iommu.s390x-latest.args | 2 +- ...eo-bochs-display-device.x86_64-latest.args | 2 +- .../virtio-non-transitional.x86_64-3.1.0.args | 22 +- ...virtio-non-transitional.x86_64-latest.args | 22 +- ...-options-controller-ats.x86_64-latest.args | 4 +- ...ptions-controller-iommu.x86_64-latest.args | 4 +- ...tions-controller-packed.x86_64-latest.args | 4 +- .../virtio-options-fs-ats.x86_64-latest.args | 4 +- ...virtio-options-fs-iommu.x86_64-latest.args | 4 +- ...irtio-options-fs-packed.x86_64-latest.args | 4 +- ...irtio-options-input-ats.x86_64-latest.args | 4 +- ...tio-options-input-iommu.x86_64-latest.args | 4 +- ...io-options-input-packed.x86_64-latest.args | 4 +- ...-options-memballoon-ats.x86_64-latest.args | 2 +- ...loon-freepage-reporting.x86_64-latest.args | 2 +- ...ptions-memballoon-iommu.x86_64-latest.args | 2 +- ...tions-memballoon-packed.x86_64-latest.args | 2 +- .../virtio-options-net-ats.x86_64-latest.args | 4 +- ...irtio-options-net-iommu.x86_64-latest.args | 4 +- ...rtio-options-net-packed.x86_64-latest.args | 4 +- .../virtio-options-rng-ats.x86_64-latest.args | 4 +- ...irtio-options-rng-iommu.x86_64-latest.args | 4 +- ...rtio-options-rng-packed.x86_64-latest.args | 4 +- ...irtio-options-video-ats.x86_64-latest.args | 4 +- ...tio-options-video-iommu.x86_64-latest.args | 4 +- ...io-options-video-packed.x86_64-latest.args | 4 +- .../virtio-options.x86_64-latest.args | 22 +- .../virtio-transitional.x86_64-3.1.0.args | 4 +- .../virtio-transitional.x86_64-latest.args | 4 +- tests/qemuxml2argvdata/watchdog-device.args | 34 - .../watchdog-device.x86_64-latest.args | 38 + tests/qemuxml2argvdata/watchdog-device.xml | 2 +- tests/qemuxml2argvdata/watchdog-dump.args | 34 - .../watchdog-dump.x86_64-latest.args | 38 + .../qemuxml2argvdata/watchdog-injectnmi.args | 34 - .../watchdog-injectnmi.x86_64-latest.args | 38 + tests/qemuxml2argvdata/watchdog.args | 33 - .../watchdog.x86_64-latest.args | 37 + ...default-cpu-kvm-q35-4.2.x86_64-latest.args | 8 +- ...default-cpu-tcg-q35-4.2.x86_64-latest.args | 8 +- .../x86_64-q35-graphics.x86_64-latest.args | 14 +- .../x86_64-q35-headless.x86_64-latest.args | 14 +- tests/qemuxml2argvtest.c | 155 +- tests/qemuxml2xmltest.c | 1 - 218 files changed, 3425 insertions(+), 3484 deletions(-) rename tests/qemuxml2argvdata/{panic-double.args => panic-double.x86_64-latest.args} (52%) delete mode 100644 tests/qemuxml2argvdata/panic-isa.xml delete mode 100644 tests/qemuxml2argvdata/panic-no-address.args create mode 100644 tests/qemuxml2argvdata/panic-no-address.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/panic.args create mode 100644 tests/qemuxml2argvdata/panic.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/watchdog-device.args create mode 100644 tests/qemuxml2argvdata/watchdog-device.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/watchdog-dump.args create mode 100644 tests/qemuxml2argvdata/watchdog-dump.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/watchdog-injectnmi.args create mode 100644 tests/qemuxml2argvdata/watchdog-injectnmi.x86_64-latest.args delete mode 100644 tests/qemuxml2argvdata/watchdog.args create mode 100644 tests/qemuxml2argvdata/watchdog.x86_64-latest.args -- 2.31.1