mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: block: 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:
parent
bd74e0d995
commit
7552031f57
@ -459,7 +459,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host,
|
|||||||
|
|
||||||
port = g_strdup_printf("%u", host->port);
|
port = g_strdup_printf("%u", host->port);
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&server,
|
if (virJSONValueObjectAdd(&server,
|
||||||
"s:type", transport,
|
"s:type", transport,
|
||||||
"s:host", host->name,
|
"s:host", host->name,
|
||||||
"s:port", port,
|
"s:port", port,
|
||||||
@ -473,7 +473,7 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDef *host,
|
|||||||
else
|
else
|
||||||
field = "s:path";
|
field = "s:path";
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&server,
|
if (virJSONValueObjectAdd(&server,
|
||||||
"s:type", "unix",
|
"s:type", "unix",
|
||||||
field, host->socket,
|
field, host->socket,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
@ -548,7 +548,7 @@ qemuBlockStorageSourceBuildJSONInetSocketAddress(virStorageNetHostDef *host)
|
|||||||
|
|
||||||
port = g_strdup_printf("%u", host->port);
|
port = g_strdup_printf("%u", host->port);
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:host", host->name,
|
"s:host", host->name,
|
||||||
"s:port", port,
|
"s:port", port,
|
||||||
NULL));
|
NULL));
|
||||||
@ -571,7 +571,7 @@ qemuBlockStorageSourceBuildJSONNFSServer(virStorageNetHostDef *host)
|
|||||||
{
|
{
|
||||||
virJSONValue *ret = NULL;
|
virJSONValue *ret = NULL;
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:host", host->name,
|
"s:host", host->name,
|
||||||
"s:type", "inet",
|
"s:type", "inet",
|
||||||
NULL));
|
NULL));
|
||||||
@ -628,7 +628,7 @@ qemuBlockStorageSourceGetGlusterProps(virStorageSource *src,
|
|||||||
* server :[{type:"tcp", host:"1.2.3.4", port:24007},
|
* server :[{type:"tcp", host:"1.2.3.4", port:24007},
|
||||||
* {type:"unix", socket:"/tmp/glusterd.socket"}, ...]}
|
* {type:"unix", socket:"/tmp/glusterd.socket"}, ...]}
|
||||||
*/
|
*/
|
||||||
if (virJSONValueObjectCreate(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:volume", src->volume,
|
"s:volume", src->volume,
|
||||||
"s:path", src->path,
|
"s:path", src->path,
|
||||||
"a:server", &servers, NULL) < 0)
|
"a:server", &servers, NULL) < 0)
|
||||||
@ -669,7 +669,7 @@ qemuBlockStorageSourceGetVxHSProps(virStorageSource *src,
|
|||||||
* vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
|
* vdisk-id:"eb90327c-8302-4725-4e85ed4dc251",
|
||||||
* server:{type:"tcp", host:"1.2.3.4", port:9999}}
|
* server:{type:"tcp", host:"1.2.3.4", port:9999}}
|
||||||
*/
|
*/
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"S:tls-creds", tlsAlias,
|
"S:tls-creds", tlsAlias,
|
||||||
"s:vdisk-id", src->path,
|
"s:vdisk-id", src->path,
|
||||||
"a:server", &server, NULL));
|
"a:server", &server, NULL));
|
||||||
@ -694,7 +694,7 @@ qemuBlockStorageSourceGetNFSProps(virStorageSource *src)
|
|||||||
* path: "/foo/bar/baz",
|
* path: "/foo/bar/baz",
|
||||||
* server: {type:"tcp", host:"1.2.3.4"}}
|
* server: {type:"tcp", host:"1.2.3.4"}}
|
||||||
*/
|
*/
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"a:server", &server,
|
"a:server", &server,
|
||||||
"S:path", src->path, NULL) < 0)
|
"S:path", src->path, NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -757,7 +757,7 @@ qemuBlockStorageSourceGetCURLProps(virStorageSource *src,
|
|||||||
cookiestr = qemuBlockStorageSourceGetCookieString(src);
|
cookiestr = qemuBlockStorageSourceGetCookieString(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:url", uristr,
|
"s:url", uristr,
|
||||||
"S:username", username,
|
"S:username", username,
|
||||||
"S:password-secret", passwordalias,
|
"S:password-secret", passwordalias,
|
||||||
@ -822,7 +822,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSource *src,
|
|||||||
objalias = srcPriv->secinfo->alias;
|
objalias = srcPriv->secinfo->alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:portal", portal,
|
"s:portal", portal,
|
||||||
"s:target", target,
|
"s:target", target,
|
||||||
"u:lun", lun,
|
"u:lun", lun,
|
||||||
@ -857,7 +857,7 @@ qemuBlockStorageSourceGetNBDProps(virStorageSource *src,
|
|||||||
if (onlytarget)
|
if (onlytarget)
|
||||||
tlsAlias = NULL;
|
tlsAlias = NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"a:server", &serverprops,
|
"a:server", &serverprops,
|
||||||
"S:export", src->path,
|
"S:export", src->path,
|
||||||
"S:tls-creds", tlsAlias,
|
"S:tls-creds", tlsAlias,
|
||||||
@ -925,14 +925,14 @@ qemuBlockStorageSourceGetRBDProps(virStorageSource *src,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&encrypt,
|
if (virJSONValueObjectAdd(&encrypt,
|
||||||
"s:format", encformat,
|
"s:format", encformat,
|
||||||
"s:key-secret", srcPriv->encinfo->alias,
|
"s:key-secret", srcPriv->encinfo->alias,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"s:pool", src->volume,
|
"s:pool", src->volume,
|
||||||
"s:image", src->path,
|
"s:image", src->path,
|
||||||
"S:snapshot", src->snapshot,
|
"S:snapshot", src->snapshot,
|
||||||
@ -967,7 +967,7 @@ qemuBlockStorageSourceGetSheepdogProps(virStorageSource *src)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* libvirt does not support the 'snap-id' and 'tag' properties */
|
/* libvirt does not support the 'snap-id' and 'tag' properties */
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"a:server", &serverprops,
|
"a:server", &serverprops,
|
||||||
"s:vdi", src->path,
|
"s:vdi", src->path,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
@ -1001,12 +1001,12 @@ qemuBlockStorageSourceGetSshProps(virStorageSource *src)
|
|||||||
username = src->ssh_user;
|
username = src->ssh_user;
|
||||||
|
|
||||||
if (src->ssh_host_key_check_disabled &&
|
if (src->ssh_host_key_check_disabled &&
|
||||||
virJSONValueObjectCreate(&host_key_check,
|
virJSONValueObjectAdd(&host_key_check,
|
||||||
"s:mode", "none",
|
"s:mode", "none",
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"s:path", src->path,
|
"s:path", src->path,
|
||||||
"a:server", &serverprops,
|
"a:server", &serverprops,
|
||||||
"S:user", username,
|
"S:user", username,
|
||||||
@ -1034,7 +1034,7 @@ qemuBlockStorageSourceGetFileProps(virStorageSource *src,
|
|||||||
iomode = virDomainDiskIoTypeToString(src->iomode);
|
iomode = virDomainDiskIoTypeToString(src->iomode);
|
||||||
}
|
}
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:filename", src->path,
|
"s:filename", src->path,
|
||||||
"S:aio", iomode,
|
"S:aio", iomode,
|
||||||
"S:pr-manager", prManagerAlias,
|
"S:pr-manager", prManagerAlias,
|
||||||
@ -1053,7 +1053,7 @@ qemuBlockStorageSourceGetVvfatProps(virStorageSource *src,
|
|||||||
* '*fat-type': 'int'
|
* '*fat-type': 'int'
|
||||||
* '*label': 'str'
|
* '*label': 'str'
|
||||||
*/
|
*/
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"s:driver", "vvfat",
|
"s:driver", "vvfat",
|
||||||
"s:dir", src->path,
|
"s:dir", src->path,
|
||||||
"b:floppy", src->floppyimg, NULL) < 0)
|
"b:floppy", src->floppyimg, NULL) < 0)
|
||||||
@ -1077,7 +1077,7 @@ qemuBlockStorageSourceGetNVMeProps(virStorageSource *src)
|
|||||||
if (!(pciAddr = virPCIDeviceAddressAsString(&nvme->pciAddr)))
|
if (!(pciAddr = virPCIDeviceAddressAsString(&nvme->pciAddr)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:driver", "nvme",
|
"s:driver", "nvme",
|
||||||
"s:device", pciAddr,
|
"s:device", pciAddr,
|
||||||
"U:namespace", nvme->namespc,
|
"U:namespace", nvme->namespc,
|
||||||
@ -1100,7 +1100,7 @@ qemuBlockStorageSourceGetBlockdevGetCacheProps(virStorageSource *src,
|
|||||||
if (qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflush) < 0)
|
if (qemuDomainDiskCachemodeFlags(src->cachemode, NULL, &direct, &noflush) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&cacheobj,
|
if (virJSONValueObjectAdd(&cacheobj,
|
||||||
"b:direct", direct,
|
"b:direct", direct,
|
||||||
"b:no-flush", noflush,
|
"b:no-flush", noflush,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
@ -1375,7 +1375,7 @@ qemuBlockStorageSourceGetCryptoProps(virStorageSource *src,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return virJSONValueObjectCreate(encprops,
|
return virJSONValueObjectAdd(encprops,
|
||||||
"s:format", encformat,
|
"s:format", encformat,
|
||||||
"s:key-secret", srcpriv->encinfo->alias,
|
"s:key-secret", srcpriv->encinfo->alias,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1458,7 +1458,7 @@ qemuBlockStorageSourceGetBlockdevFormatCommonProps(virStorageSource *src)
|
|||||||
* '*force-share': 'bool'
|
* '*force-share': 'bool'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:node-name", src->nodeformat,
|
"s:node-name", src->nodeformat,
|
||||||
"b:read-only", src->readonly,
|
"b:read-only", src->readonly,
|
||||||
"S:discard", discard,
|
"S:discard", discard,
|
||||||
@ -1612,7 +1612,7 @@ qemuBlockStorageSourceGetBlockdevStorageSliceProps(virStorageSource *src)
|
|||||||
if (qemuBlockNodeNameValidate(src->sliceStorage->nodename) < 0)
|
if (qemuBlockNodeNameValidate(src->sliceStorage->nodename) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:driver", "raw",
|
"s:driver", "raw",
|
||||||
"s:node-name", src->sliceStorage->nodename,
|
"s:node-name", src->sliceStorage->nodename,
|
||||||
"U:offset", src->sliceStorage->offset,
|
"U:offset", src->sliceStorage->offset,
|
||||||
@ -2186,7 +2186,7 @@ qemuBlockStorageGetCopyOnReadProps(virDomainDiskDef *disk)
|
|||||||
qemuDomainDiskPrivate *priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
qemuDomainDiskPrivate *priv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||||
virJSONValue *ret = NULL;
|
virJSONValue *ret = NULL;
|
||||||
|
|
||||||
ignore_value(virJSONValueObjectCreate(&ret,
|
ignore_value(virJSONValueObjectAdd(&ret,
|
||||||
"s:driver", "copy-on-read",
|
"s:driver", "copy-on-read",
|
||||||
"s:node-name", priv->nodeCopyOnRead,
|
"s:node-name", priv->nodeCopyOnRead,
|
||||||
"s:file", disk->src->nodeformat,
|
"s:file", disk->src->nodeformat,
|
||||||
@ -2270,7 +2270,7 @@ qemuBlockGetBackingStoreString(virStorageSource *src,
|
|||||||
props = backingProps;
|
props = backingProps;
|
||||||
|
|
||||||
if (src->sliceStorage) {
|
if (src->sliceStorage) {
|
||||||
if (virJSONValueObjectCreate(&sliceProps,
|
if (virJSONValueObjectAdd(&sliceProps,
|
||||||
"s:driver", "raw",
|
"s:driver", "raw",
|
||||||
"U:offset", src->sliceStorage->offset,
|
"U:offset", src->sliceStorage->offset,
|
||||||
"U:size", src->sliceStorage->size,
|
"U:size", src->sliceStorage->size,
|
||||||
@ -2329,7 +2329,7 @@ qemuBlockStorageSourceCreateGetFormatPropsGeneric(virStorageSource *src,
|
|||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) props = NULL;
|
g_autoptr(virJSONValue) props = NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:driver", driver,
|
"s:driver", driver,
|
||||||
"s:file", src->nodestorage,
|
"s:file", src->nodestorage,
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
@ -2358,7 +2358,7 @@ qemuBlockStorageSourceCreateGetEncryptionLUKS(virStorageSource *src,
|
|||||||
srcpriv->encinfo)
|
srcpriv->encinfo)
|
||||||
keysecret = srcpriv->encinfo->alias;
|
keysecret = srcpriv->encinfo->alias;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:key-secret", keysecret,
|
"s:key-secret", keysecret,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2447,7 +2447,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSource *src,
|
|||||||
else if (STREQ_NULLABLE(src->compat, "1.1"))
|
else if (STREQ_NULLABLE(src->compat, "1.1"))
|
||||||
qcow2version = "v3";
|
qcow2version = "v3";
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&qcow2props,
|
if (virJSONValueObjectAdd(&qcow2props,
|
||||||
"s:driver", "qcow2",
|
"s:driver", "qcow2",
|
||||||
"s:file", src->nodestorage,
|
"s:file", src->nodestorage,
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
@ -2472,7 +2472,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow(virStorageSource *src,
|
|||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) qcowprops = NULL;
|
g_autoptr(virJSONValue) qcowprops = NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&qcowprops,
|
if (virJSONValueObjectAdd(&qcowprops,
|
||||||
"s:driver", "qcow",
|
"s:driver", "qcow",
|
||||||
"s:file", src->nodestorage,
|
"s:file", src->nodestorage,
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
@ -2495,7 +2495,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQed(virStorageSource *src,
|
|||||||
{
|
{
|
||||||
g_autoptr(virJSONValue) qedprops = NULL;
|
g_autoptr(virJSONValue) qedprops = NULL;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&qedprops,
|
if (virJSONValueObjectAdd(&qedprops,
|
||||||
"s:driver", "qed",
|
"s:driver", "qed",
|
||||||
"s:file", src->nodestorage,
|
"s:file", src->nodestorage,
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
@ -2675,7 +2675,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorageSource *src,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(props,
|
if (virJSONValueObjectAdd(props,
|
||||||
"s:driver", driver,
|
"s:driver", driver,
|
||||||
"S:filename", filename,
|
"S:filename", filename,
|
||||||
"A:location", &location,
|
"A:location", &location,
|
||||||
@ -3334,7 +3334,7 @@ qemuBlockReopenFormatMon(qemuMonitor *mon,
|
|||||||
if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
|
if (virJSONValueArrayAppend(reopenoptions, &srcprops) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&reopenprops,
|
if (virJSONValueObjectAdd(&reopenprops,
|
||||||
"a:options", &reopenoptions,
|
"a:options", &reopenoptions,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -3554,7 +3554,7 @@ qemuBlockExportGetNBDProps(const char *nodename,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virJSONValueObjectCreate(&ret,
|
if (virJSONValueObjectAdd(&ret,
|
||||||
"s:type", "nbd",
|
"s:type", "nbd",
|
||||||
"s:id", exportid,
|
"s:id", exportid,
|
||||||
"s:node-name", nodename,
|
"s:node-name", nodename,
|
||||||
|
Loading…
Reference in New Issue
Block a user