qemu: command: Replace virJSONValueObjectCreate by virJSONValueObjectAdd

virJSONValueObjectAdd now works identically to virJSONValueObjectCreate
when used with a NULL argument. Replace all callers.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-11-08 17:24:50 +01:00
parent fdda016bce
commit acf6b4e83c

View File

@ -1114,7 +1114,7 @@ qemuBuildVirtioDevProps(virDomainDeviceType devtype,
&disableLegacy, &disableModern) < 0) &disableLegacy, &disableModern) < 0)
return NULL; return NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", model, "s:driver", model,
"S:disable-legacy", qemuOnOffAuto(disableLegacy), "S:disable-legacy", qemuOnOffAuto(disableLegacy),
"T:disable-modern", disableModern, "T:disable-modern", disableModern,
@ -1622,7 +1622,7 @@ qemuDiskSourceGetProps(virStorageSource *src)
QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY))) QEMU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_LEGACY)))
return NULL; return NULL;
if (virJSONValueObjectCreate(&ret, "a:file", &props, NULL) < 0) if (virJSONValueObjectAdd(&ret, "a:file", &props, NULL) < 0)
return NULL; return NULL;
return ret; return ret;
@ -2016,7 +2016,7 @@ qemuBuildDiskDeviceProps(const virDomainDef *def,
} }
if (driver) { if (driver) {
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", driver, "s:driver", driver,
NULL) < 0) NULL) < 0)
return NULL; return NULL;
@ -2123,7 +2123,7 @@ qemuBuildZPCIDevProps(virDomainDeviceInfo *dev)
virJSONValue *props = NULL; virJSONValue *props = NULL;
g_autofree char *alias = g_strdup_printf("zpci%u", dev->addr.pci.zpci.uid.value); g_autofree char *alias = g_strdup_printf("zpci%u", dev->addr.pci.zpci.uid.value);
virJSONValueObjectCreate(&props, virJSONValueObjectAdd(&props,
"s:driver", "zpci", "s:driver", "zpci",
"u:uid", dev->addr.pci.zpci.uid.value, "u:uid", dev->addr.pci.zpci.uid.value,
"u:fid", dev->addr.pci.zpci.fid.value, "u:fid", dev->addr.pci.zpci.fid.value,
@ -2198,7 +2198,7 @@ qemuBuildFloppyCommandLineControllerOptionsExplicit(virCommand *cmd,
{ {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "isa-fdc", "s:driver", "isa-fdc",
"S:driveA", backendA, "S:driveA", backendA,
"p:bootindexA", bootindexA, "p:bootindexA", bootindexA,
@ -2757,7 +2757,7 @@ qemuBuildUSBControllerDevProps(const virDomainDef *domainDef,
if (qemuValidateDomainDeviceDefControllerUSB(def, qemuCaps) < 0) if (qemuValidateDomainDeviceDefControllerUSB(def, qemuCaps) < 0)
return NULL; return NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", qemuControllerModelUSBTypeToString(def->model), "s:driver", qemuControllerModelUSBTypeToString(def->model),
"k:p2", def->opts.usbopts.ports, "k:p2", def->opts.usbopts.ports,
"k:p3", def->opts.usbopts.ports, "k:p3", def->opts.usbopts.ports,
@ -2859,7 +2859,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def,
} }
if (driver) { if (driver) {
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", driver, "s:driver", driver,
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
@ -2896,7 +2896,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
switch ((virDomainControllerModelPCI) def->model) { switch ((virDomainControllerModelPCI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:chassis_nr", pciopts->chassisNr, "i:chassis_nr", pciopts->chassisNr,
"s:id", def->info.alias, "s:id", def->info.alias,
@ -2907,7 +2907,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:bus_nr", pciopts->busNr, "i:bus_nr", pciopts->busNr,
"s:id", def->info.alias, "s:id", def->info.alias,
@ -2923,7 +2923,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_TO_PCI_BRIDGE:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
@ -2933,7 +2933,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:port", pciopts->port, "i:port", pciopts->port,
"i:chassis", pciopts->chassis, "i:chassis", pciopts->chassis,
@ -2944,7 +2944,7 @@ qemuBuildControllerPCIDevProps(virDomainControllerDef *def,
break; break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", modelName, "s:driver", modelName,
"i:index", pciopts->targetIndex, "i:index", pciopts->targetIndex,
"s:id", def->info.alias, "s:id", def->info.alias,
@ -3025,7 +3025,7 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
break; break;
case VIR_DOMAIN_CONTROLLER_TYPE_CCID: case VIR_DOMAIN_CONTROLLER_TYPE_CCID:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "usb-ccid", "s:driver", "usb-ccid",
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
@ -3034,7 +3034,7 @@ qemuBuildControllerDevProps(const virDomainDef *domainDef,
break; break;
case VIR_DOMAIN_CONTROLLER_TYPE_SATA: case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "ahci", "s:driver", "ahci",
"s:id", def->info.alias, "s:id", def->info.alias,
NULL) < 0) NULL) < 0)
@ -3788,7 +3788,7 @@ qemuBuildMemoryDeviceProps(const virDomainDef *def,
virUUIDFormat(mem->uuid, uuidstr); virUUIDFormat(mem->uuid, uuidstr);
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", device, "s:driver", device,
"k:node", mem->targetNode, "k:node", mem->targetNode,
"P:label-size", mem->labelsize * 1024, "P:label-size", mem->labelsize * 1024,
@ -3909,7 +3909,7 @@ qemuBuildNicDevProps(virDomainDef *def,
NULL) < 0) NULL) < 0)
return NULL; return NULL;
} else { } else {
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", virDomainNetGetModelString(net), "s:driver", virDomainNetGetModelString(net),
NULL) < 0) NULL) < 0)
return NULL; return NULL;
@ -3967,7 +3967,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_ETHERNET:
if (virJSONValueObjectCreate(&netprops, "s:type", "tap", NULL) < 0) if (virJSONValueObjectAdd(&netprops, "s:type", "tap", NULL) < 0)
return NULL; return NULL;
/* for one tapfd 'fd=' shall be used, /* for one tapfd 'fd=' shall be used,
@ -3993,7 +3993,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
break; break;
case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_CLIENT:
if (virJSONValueObjectCreate(&netprops, "s:type", "socket", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0 ||
virJSONValueObjectAppendStringPrintf(netprops, "connect", "%s:%d", virJSONValueObjectAppendStringPrintf(netprops, "connect", "%s:%d",
net->data.socket.address, net->data.socket.address,
net->data.socket.port) < 0) net->data.socket.port) < 0)
@ -4001,7 +4001,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
break; break;
case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_SERVER:
if (virJSONValueObjectCreate(&netprops, "s:type", "socket", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0 ||
virJSONValueObjectAppendStringPrintf(netprops, "listen", "%s:%d", virJSONValueObjectAppendStringPrintf(netprops, "listen", "%s:%d",
NULLSTR_EMPTY(net->data.socket.address), NULLSTR_EMPTY(net->data.socket.address),
net->data.socket.port) < 0) net->data.socket.port) < 0)
@ -4009,7 +4009,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
break; break;
case VIR_DOMAIN_NET_TYPE_MCAST: case VIR_DOMAIN_NET_TYPE_MCAST:
if (virJSONValueObjectCreate(&netprops, "s:type", "socket", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0 ||
virJSONValueObjectAppendStringPrintf(netprops, "mcast", "%s:%d", virJSONValueObjectAppendStringPrintf(netprops, "mcast", "%s:%d",
net->data.socket.address, net->data.socket.address,
net->data.socket.port) < 0) net->data.socket.port) < 0)
@ -4017,7 +4017,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
break; break;
case VIR_DOMAIN_NET_TYPE_UDP: case VIR_DOMAIN_NET_TYPE_UDP:
if (virJSONValueObjectCreate(&netprops, "s:type", "socket", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0 ||
virJSONValueObjectAppendStringPrintf(netprops, "udp", "%s:%d", virJSONValueObjectAppendStringPrintf(netprops, "udp", "%s:%d",
net->data.socket.address, net->data.socket.address,
net->data.socket.port) < 0 || net->data.socket.port) < 0 ||
@ -4029,11 +4029,11 @@ qemuBuildHostNetStr(virDomainNetDef *net,
case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_USER:
if (slirpfd) { if (slirpfd) {
if (virJSONValueObjectCreate(&netprops, "s:type", "socket", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "socket", NULL) < 0 ||
virJSONValueObjectAppendString(netprops, "fd", slirpfd) < 0) virJSONValueObjectAppendString(netprops, "fd", slirpfd) < 0)
return NULL; return NULL;
} else { } else {
if (virJSONValueObjectCreate(&netprops, "s:type", "user", NULL) < 0) if (virJSONValueObjectAdd(&netprops, "s:type", "user", NULL) < 0)
return NULL; return NULL;
for (i = 0; i < net->guestIP.nips; i++) { for (i = 0; i < net->guestIP.nips; i++) {
@ -4066,12 +4066,12 @@ qemuBuildHostNetStr(virDomainNetDef *net,
break; break;
case VIR_DOMAIN_NET_TYPE_INTERNAL: case VIR_DOMAIN_NET_TYPE_INTERNAL:
if (virJSONValueObjectCreate(&netprops, "s:type", "user", NULL) < 0) if (virJSONValueObjectAdd(&netprops, "s:type", "user", NULL) < 0)
return NULL; return NULL;
break; break;
case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
if (virJSONValueObjectCreate(&netprops, "s:type", "vhost-user", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "vhost-user", NULL) < 0 ||
virJSONValueObjectAppendStringPrintf(netprops, "chardev", "char%s", net->info.alias) < 0) virJSONValueObjectAppendStringPrintf(netprops, "chardev", "char%s", net->info.alias) < 0)
return NULL; return NULL;
@ -4082,7 +4082,7 @@ qemuBuildHostNetStr(virDomainNetDef *net,
case VIR_DOMAIN_NET_TYPE_VDPA: case VIR_DOMAIN_NET_TYPE_VDPA:
/* Caller will pass the fd to qemu with add-fd */ /* Caller will pass the fd to qemu with add-fd */
if (virJSONValueObjectCreate(&netprops, "s:type", "vhost-vdpa", NULL) < 0 || if (virJSONValueObjectAdd(&netprops, "s:type", "vhost-vdpa", NULL) < 0 ||
virJSONValueObjectAppendString(netprops, "vhostdev", vdpadev) < 0) virJSONValueObjectAppendString(netprops, "vhostdev", vdpadev) < 0)
return NULL; return NULL;
break; break;
@ -4134,7 +4134,7 @@ qemuBuildWatchdogDevProps(const virDomainDef *def,
{ {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", virDomainWatchdogModelTypeToString(dev->model), "s:driver", virDomainWatchdogModelTypeToString(dev->model),
"s:id", dev->info.alias, "s:id", dev->info.alias,
NULL) < 0) NULL) < 0)
@ -4313,7 +4313,7 @@ qemuBuildInputUSBDevProps(const virDomainDef *def,
break; break;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", driver, "s:driver", driver,
"s:id", dev->info.alias, "s:id", dev->info.alias,
NULL) < 0) NULL) < 0)
@ -4455,7 +4455,7 @@ qemuBuildSoundDevCmd(virCommand *cmd,
return -1; return -1;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", model, "s:driver", model,
"s:id", sound->info.alias, "s:id", sound->info.alias,
"S:audiodev", audioid, "S:audiodev", audioid,
@ -4489,7 +4489,7 @@ qemuBuildSoundCodecCmd(virCommand *cmd,
return -1; return -1;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", qemuSoundCodecTypeToString(codec->type), "s:driver", qemuSoundCodecTypeToString(codec->type),
"s:id", alias, "s:id", alias,
"s:bus", bus, "s:bus", bus,
@ -4566,7 +4566,7 @@ qemuBuildDeviceVideoCmd(virCommand *cmd,
if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_VIDEO, video, qemuCaps))) if (!(props = qemuBuildVirtioDevProps(VIR_DOMAIN_DEVICE_VIDEO, video, qemuCaps)))
return -1; return -1;
} else { } else {
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", model, "s:driver", model,
NULL) < 0) NULL) < 0)
return -1; return -1;
@ -4764,7 +4764,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
teaming->persistent) teaming->persistent)
failover_pair_id = teaming->persistent; failover_pair_id = teaming->persistent;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "vfio-pci", "s:driver", "vfio-pci",
"s:host", host, "s:host", host,
"s:id", dev->info->alias, "s:id", dev->info->alias,
@ -4810,7 +4810,7 @@ qemuBuildUSBHostdevDevProps(const virDomainDef *def,
} }
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "usb-host", "s:driver", "usb-host",
"S:hostdevice", hostdevice, "S:hostdevice", hostdevice,
"p:hostbus", hostbus, "p:hostbus", hostbus,
@ -4835,7 +4835,7 @@ qemuBuildHubDevCmd(virCommand *cmd,
{ {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "usb-hub", "s:driver", "usb-hub",
"s:id", dev->info.alias, "s:id", dev->info.alias,
NULL) < 0) NULL) < 0)
@ -4947,7 +4947,7 @@ qemuBuildSCSIHostdevDevProps(const virDomainDef *def,
{ {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "scsi-generic", "s:driver", "scsi-generic",
"s:drive", backendAlias, "s:drive", backendAlias,
"s:id", dev->info->alias, "s:id", dev->info->alias,
@ -5332,7 +5332,7 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def,
mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr); mdevPath = virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr);
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", qemuBuildHostdevMdevModelTypeString(mdevsrc), "s:driver", qemuBuildHostdevMdevModelTypeString(mdevsrc),
"s:id", dev->info->alias, "s:id", dev->info->alias,
"s:sysfsdev", mdevPath, "s:sysfsdev", mdevPath,
@ -5645,7 +5645,7 @@ qemuBuildVirtioSerialPortDevProps(const virDomainDef *def,
return NULL; return NULL;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", driver, "s:driver", driver,
NULL) < 0) NULL) < 0)
return NULL; return NULL;
@ -5697,7 +5697,7 @@ qemuBuildSclpDevProps(virDomainChrDef *dev)
return NULL; return NULL;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", driver, "s:driver", driver,
"s:chardev", chardev, "s:chardev", chardev,
"s:id", dev->info.alias, "s:id", dev->info.alias,
@ -6204,7 +6204,7 @@ qemuBuildVMGenIDCommandLine(virCommand *cmd,
virUUIDFormat(def->genid, guid); virUUIDFormat(def->genid, guid);
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "vmgenid", "s:driver", "vmgenid",
"s:guid", guid, "s:guid", guid,
"s:id", "vmgenid0", "s:id", "vmgenid0",
@ -6528,7 +6528,7 @@ qemuBuildIOMMUCommandLine(virCommand *cmd,
case VIR_DOMAIN_IOMMU_MODEL_INTEL: { case VIR_DOMAIN_IOMMU_MODEL_INTEL: {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "intel-iommu", "s:driver", "intel-iommu",
"S:intremap", qemuOnOffAuto(iommu->intremap), "S:intremap", qemuOnOffAuto(iommu->intremap),
"T:caching-mode", iommu->caching_mode, "T:caching-mode", iommu->caching_mode,
@ -9085,7 +9085,7 @@ qemuBuildSmartcardCommandLine(virLogManager *logManager,
switch (smartcard->type) { switch (smartcard->type) {
case VIR_DOMAIN_SMARTCARD_TYPE_HOST: case VIR_DOMAIN_SMARTCARD_TYPE_HOST:
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "ccid-card-emulated", "s:driver", "ccid-card-emulated",
"s:backend", "nss-emulated", "s:backend", "nss-emulated",
NULL) < 0) NULL) < 0)
@ -9099,7 +9099,7 @@ qemuBuildSmartcardCommandLine(virLogManager *logManager,
if (smartcard->data.cert.database) if (smartcard->data.cert.database)
database = smartcard->data.cert.database; database = smartcard->data.cert.database;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "ccid-card-emulated", "s:driver", "ccid-card-emulated",
"s:backend", "certificates", "s:backend", "certificates",
"s:cert1", smartcard->data.cert.file[0], "s:cert1", smartcard->data.cert.file[0],
@ -9129,7 +9129,7 @@ qemuBuildSmartcardCommandLine(virLogManager *logManager,
virCommandAddArgList(cmd, "-chardev", chardevstr, NULL); virCommandAddArgList(cmd, "-chardev", chardevstr, NULL);
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "ccid-card-passthru", "s:driver", "ccid-card-passthru",
"s:chardev", chardevalias, "s:chardev", chardevalias,
NULL) < 0) NULL) < 0)
@ -9182,7 +9182,7 @@ qemuBuildShmemDevLegacyProps(virDomainDef *def,
else else
shm = shmem->name; shm = shmem->name;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "ivshmem", "s:driver", "ivshmem",
"s:id", shmem->info.alias, "s:id", shmem->info.alias,
"s:size", size, "s:size", size,
@ -9228,7 +9228,7 @@ qemuBuildShmemDevProps(virDomainDef *def,
} }
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", virDomainShmemModelTypeToString(shmem->model), "s:driver", virDomainShmemModelTypeToString(shmem->model),
"s:id", shmem->info.alias, "s:id", shmem->info.alias,
"S:chardev", chardev, "S:chardev", chardev,
@ -9717,7 +9717,7 @@ qemuBuildRedirdevDevProps(const virDomainDef *def,
filter = virBufferContentAndReset(&buf); filter = virBufferContentAndReset(&buf);
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "usb-redir", "s:driver", "usb-redir",
"s:chardev", chardev, "s:chardev", chardev,
"s:id", dev->info.alias, "s:id", dev->info.alias,
@ -9860,7 +9860,7 @@ qemuBuildTPMDevCmd(virCommand *cmd,
if (tpm->model == VIR_DOMAIN_TPM_MODEL_TIS && def->os.arch == VIR_ARCH_AARCH64) if (tpm->model == VIR_DOMAIN_TPM_MODEL_TIS && def->os.arch == VIR_ARCH_AARCH64)
model = "tpm-tis-device"; model = "tpm-tis-device";
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", model, "s:driver", model,
"s:tpmdev", tpmdev, "s:tpmdev", tpmdev,
"s:id", tpm->info.alias, "s:id", tpm->info.alias,
@ -10014,7 +10014,7 @@ qemuBuildTPMProxyCommandLine(virCommand *cmd,
{ {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", virDomainTPMModelTypeToString(tpm->model), "s:driver", virDomainTPMModelTypeToString(tpm->model),
"s:id", tpm->info.alias, "s:id", tpm->info.alias,
"s:host-path", tpm->data.passthrough.source.data.file.path, "s:host-path", tpm->data.passthrough.source.data.file.path,
@ -10134,7 +10134,7 @@ qemuBuildVMCoreInfoCommandLine(virCommand *cmd,
if (def->features[VIR_DOMAIN_FEATURE_VMCOREINFO] != VIR_TRISTATE_SWITCH_ON) if (def->features[VIR_DOMAIN_FEATURE_VMCOREINFO] != VIR_TRISTATE_SWITCH_ON)
return 0; return 0;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "vmcoreinfo", "s:driver", "vmcoreinfo",
NULL) < 0) NULL) < 0)
return -1; return -1;
@ -10158,7 +10158,7 @@ qemuBuildPanicCommandLine(virCommand *cmd,
case VIR_DOMAIN_PANIC_MODEL_ISA: { case VIR_DOMAIN_PANIC_MODEL_ISA: {
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "pvpanic", "s:driver", "pvpanic",
NULL) < 0) NULL) < 0)
return -1; return -1;
@ -10907,7 +10907,7 @@ qemuBuildSerialChrDeviceProps(const virDomainDef *def,
return NULL; return NULL;
} }
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", virDomainChrSerialTargetModelTypeToString(serial->targetModel), "s:driver", virDomainChrSerialTargetModelTypeToString(serial->targetModel),
"s:chardev", chardev, "s:chardev", chardev,
"s:id", serial->info.alias, "s:id", serial->info.alias,
@ -10927,7 +10927,7 @@ qemuBuildParallelChrDeviceProps(virDomainChrDef *chr)
g_autoptr(virJSONValue) props = NULL; g_autoptr(virJSONValue) props = NULL;
g_autofree char *chardev = g_strdup_printf("char%s", chr->info.alias); g_autofree char *chardev = g_strdup_printf("char%s", chr->info.alias);
if (virJSONValueObjectCreate(&props, if (virJSONValueObjectAdd(&props,
"s:driver", "isa-parallel", "s:driver", "isa-parallel",
"s:chardev", chardev, "s:chardev", chardev,
"s:id", chr->info.alias, "s:id", chr->info.alias,
@ -10962,7 +10962,7 @@ qemuBuildChannelGuestfwdNetdevProps(virDomainChrDef *chr)
if (virJSONValueArrayAppend(guestfwdarr, &guestfwdstrobj) < 0) if (virJSONValueArrayAppend(guestfwdarr, &guestfwdstrobj) < 0)
return NULL; return NULL;
if (virJSONValueObjectCreate(&ret, if (virJSONValueObjectAdd(&ret,
"s:type", "user", "s:type", "user",
"a:guestfwd", &guestfwdarr, "a:guestfwd", &guestfwdarr,
"s:id", chr->info.alias, "s:id", chr->info.alias,