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:
Peter Krempa 2023-09-25 16:24:07 +02:00
parent f22ede7017
commit e7c7af19d0
2 changed files with 6 additions and 6 deletions

View File

@ -2078,7 +2078,7 @@ qemuBlockStorageSourceCreateGetFormatPropsGeneric(virStorageSource *src,
if (virJSONValueObjectAdd(&props,
"s:driver", driver,
"s:file", src->nodestorage,
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
"U:size", src->capacity,
NULL) < 0)
return -1;
@ -2143,7 +2143,7 @@ qemuBlockStorageSourceCreateGetFormatPropsLUKS(virStorageSource *src,
if (virJSONValueObjectAdd(&luksprops,
"s:driver", "luks",
"s:file", src->nodestorage,
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
"U:size", src->capacity,
NULL) < 0)
return -1;
@ -2200,7 +2200,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow2(virStorageSource *src,
if (virJSONValueObjectAdd(&qcow2props,
"s:driver", "qcow2",
"s:file", src->nodestorage,
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
"U:size", src->capacity,
"S:version", qcow2version,
"P:cluster-size", src->clusterSize,
@ -2226,7 +2226,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQcow(virStorageSource *src,
if (virJSONValueObjectAdd(&qcowprops,
"s:driver", "qcow",
"s:file", src->nodestorage,
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
"U:size", src->capacity,
NULL) < 0)
return -1;
@ -2249,7 +2249,7 @@ qemuBlockStorageSourceCreateGetFormatPropsQed(virStorageSource *src,
if (virJSONValueObjectAdd(&qedprops,
"s:driver", "qed",
"s:file", src->nodestorage,
"s:file", qemuBlockStorageSourceGetEffectiveStorageNodename(src),
"U:size", src->capacity,
NULL) < 0)
return -1;

View File

@ -312,7 +312,7 @@ qemuBlockJobNewCreate(virDomainObj *vm,
const char *nodename = src->nodeformat;
if (storage)
nodename = src->nodestorage;
nodename = qemuBlockStorageSourceGetStorageNodename(src);
jobname = g_strdup_printf("create-%s", nodename);