mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +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,11 +459,11 @@ 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,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -473,10 +473,10 @@ 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)
|
||||||
return NULL;
|
return NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -548,10 +548,10 @@ 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));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -571,10 +571,10 @@ 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));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -628,10 +628,10 @@ 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)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!onlytarget &&
|
if (!onlytarget &&
|
||||||
@ -669,10 +669,10 @@ 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));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -694,9 +694,9 @@ 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;
|
||||||
|
|
||||||
if (src->nfs_uid != -1 &&
|
if (src->nfs_uid != -1 &&
|
||||||
@ -757,16 +757,16 @@ 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,
|
||||||
"T:sslverify", src->sslverify,
|
"T:sslverify", src->sslverify,
|
||||||
"S:cookie", cookiestr,
|
"S:cookie", cookiestr,
|
||||||
"S:cookie-secret", cookiealias,
|
"S:cookie-secret", cookiealias,
|
||||||
"P:timeout", src->timeout,
|
"P:timeout", src->timeout,
|
||||||
"P:readahead", src->readahead,
|
"P:readahead", src->readahead,
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -822,15 +822,15 @@ 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,
|
||||||
"s:transport", "tcp",
|
"s:transport", "tcp",
|
||||||
"S:user", username,
|
"S:user", username,
|
||||||
"S:password-secret", objalias,
|
"S:password-secret", objalias,
|
||||||
"S:initiator-name", src->initiator.iqn,
|
"S:initiator-name", src->initiator.iqn,
|
||||||
NULL));
|
NULL));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,11 +857,11 @@ 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,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -925,24 +925,24 @@ 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,
|
||||||
"S:conf", src->configFile,
|
"S:conf", src->configFile,
|
||||||
"A:server", &servers,
|
"A:server", &servers,
|
||||||
"A:encrypt", &encrypt,
|
"A:encrypt", &encrypt,
|
||||||
"S:user", username,
|
"S:user", username,
|
||||||
"A:auth-client-required", &authmodes,
|
"A:auth-client-required", &authmodes,
|
||||||
"S:key-secret", keysecret,
|
"S:key-secret", keysecret,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -967,10 +967,10 @@ 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)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1001,17 +1001,17 @@ 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,
|
||||||
"A:host-key-check", &host_key_check,
|
"A:host-key-check", &host_key_check,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1034,11 +1034,11 @@ 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,
|
||||||
NULL) < 0);
|
NULL) < 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,10 +1053,10 @@ 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)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!onlytarget &&
|
if (!onlytarget &&
|
||||||
@ -1077,11 +1077,11 @@ 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,
|
||||||
NULL));
|
NULL));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,10 +1100,10 @@ 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)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virJSONValueObjectAppend(props, "cache", &cacheobj) < 0)
|
if (virJSONValueObjectAppend(props, "cache", &cacheobj) < 0)
|
||||||
@ -1375,10 +1375,10 @@ 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,12 +1458,12 @@ 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,
|
||||||
"S:detect-zeroes", detectZeroes,
|
"S:detect-zeroes", detectZeroes,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0)
|
if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0)
|
||||||
@ -1612,15 +1612,15 @@ 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,
|
||||||
"U:size", src->sliceStorage->size,
|
"U:size", src->sliceStorage->size,
|
||||||
"s:file", src->nodestorage,
|
"s:file", src->nodestorage,
|
||||||
"b:auto-read-only", true,
|
"b:auto-read-only", true,
|
||||||
"s:discard", "unmap",
|
"s:discard", "unmap",
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0)
|
if (qemuBlockStorageSourceGetBlockdevGetCacheProps(src, props) < 0)
|
||||||
@ -2186,12 +2186,12 @@ 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,
|
||||||
"s:discard", "unmap",
|
"s:discard", "unmap",
|
||||||
NULL));
|
NULL));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -2270,12 +2270,12 @@ 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,
|
||||||
"a:file", &backingProps,
|
"a:file", &backingProps,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
props = sliceProps;
|
props = sliceProps;
|
||||||
@ -2329,11 +2329,11 @@ 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,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (backing &&
|
if (backing &&
|
||||||
@ -2358,9 +2358,9 @@ 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;
|
||||||
|
|
||||||
if (src->encryption) {
|
if (src->encryption) {
|
||||||
@ -2447,13 +2447,13 @@ 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,
|
||||||
"S:version", qcow2version,
|
"S:version", qcow2version,
|
||||||
"P:cluster-size", src->clusterSize,
|
"P:cluster-size", src->clusterSize,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBlockStorageSourceCreateAddBacking(backing, qcow2props, true) < 0 ||
|
if (qemuBlockStorageSourceCreateAddBacking(backing, qcow2props, true) < 0 ||
|
||||||
@ -2472,11 +2472,11 @@ 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,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBlockStorageSourceCreateAddBacking(backing, qcowprops, false) < 0 ||
|
if (qemuBlockStorageSourceCreateAddBacking(backing, qcowprops, false) < 0 ||
|
||||||
@ -2495,11 +2495,11 @@ 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,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuBlockStorageSourceCreateAddBacking(backing, qedprops, true) < 0)
|
if (qemuBlockStorageSourceCreateAddBacking(backing, qedprops, true) < 0)
|
||||||
@ -2675,12 +2675,12 @@ 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,
|
||||||
"U:size", src->physical,
|
"U:size", src->physical,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -3334,9 +3334,9 @@ 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;
|
||||||
|
|
||||||
if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
|
if (qemuMonitorBlockdevReopen(mon, &reopenprops) < 0)
|
||||||
@ -3554,14 +3554,14 @@ 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,
|
||||||
"b:writable", writable,
|
"b:writable", writable,
|
||||||
"s:name", exportname,
|
"s:name", exportname,
|
||||||
"A:bitmaps", &bitmapsarr,
|
"A:bitmaps", &bitmapsarr,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user