mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: block: Use proper accessors for image formatting/creation code
Use 'qemuBlockStorageSourceGetEffectiveStorageNodename' in all the JSON props formatters for setting up a 'blockdev-create' job of a format layer. In case of the blockjob name designator we're okay to use just the storage layer nodename as that serves only to find the appropriate entry. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
f22ede7017
commit
e7c7af19d0
@ -2078,7 +2078,7 @@ qemuBlockStorageSourceCreateGetFormatPropsGeneric(virStorageSource *src,
|
|||||||
|
|
||||||
if (virJSONValueObjectAdd(&props,
|
if (virJSONValueObjectAdd(&props,
|
||||||
"s:driver", driver,
|
"s:driver", driver,
|
||||||
"s:file", src->nodestorage,
|
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2143,7 +2143,7 @@ qemuBlockStorageSourceCreateGetFormatPropsLUKS(virStorageSource *src,
|
|||||||
|
|
||||||
if (virJSONValueObjectAdd(&luksprops,
|
if (virJSONValueObjectAdd(&luksprops,
|
||||||
"s:driver", "luks",
|
"s:driver", "luks",
|
||||||
"s:file", src->nodestorage,
|
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2200,7 +2200,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSource *src,
|
|||||||
|
|
||||||
if (virJSONValueObjectAdd(&qcow2props,
|
if (virJSONValueObjectAdd(&qcow2props,
|
||||||
"s:driver", "qcow2",
|
"s:driver", "qcow2",
|
||||||
"s:file", src->nodestorage,
|
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
"S:version", qcow2version,
|
"S:version", qcow2version,
|
||||||
"P:cluster-size", src->clusterSize,
|
"P:cluster-size", src->clusterSize,
|
||||||
@ -2226,7 +2226,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow(virStorageSource *src,
|
|||||||
|
|
||||||
if (virJSONValueObjectAdd(&qcowprops,
|
if (virJSONValueObjectAdd(&qcowprops,
|
||||||
"s:driver", "qcow",
|
"s:driver", "qcow",
|
||||||
"s:file", src->nodestorage,
|
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2249,7 +2249,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQed(virStorageSource *src,
|
|||||||
|
|
||||||
if (virJSONValueObjectAdd(&qedprops,
|
if (virJSONValueObjectAdd(&qedprops,
|
||||||
"s:driver", "qed",
|
"s:driver", "qed",
|
||||||
"s:file", src->nodestorage,
|
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
|
||||||
"U:size", src->capacity,
|
"U:size", src->capacity,
|
||||||
NULL) < 0)
|
NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -312,7 +312,7 @@ qemuBlockJobNewCreate(virDomainObj *vm,
|
|||||||
const char *nodename = src->nodeformat;
|
const char *nodename = src->nodeformat;
|
||||||
|
|
||||||
if (storage)
|
if (storage)
|
||||||
nodename = src->nodestorage;
|
nodename = qemuBlockStorageSourceGetStorageNodename(src);
|
||||||
|
|
||||||
jobname = g_strdup_printf("create-%s", nodename);
|
jobname = g_strdup_printf("create-%s", nodename);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user