mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemuDomainPrepareStorageSourceBlockdevNodename: Restructure code to allow missing 'format' layer
Similarly to other bits of code, we don't need to setup the format layer if it will not be formatted. Add logic which uses qemuBlockStorageSourceNeedsFormatLayer to see whether the setup of the format node is needed. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
813ccd553b
commit
6ab5ee9a9a
@ -11108,11 +11108,21 @@ qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk,
|
||||
virQEMUDriverConfig *cfg)
|
||||
{
|
||||
char *nodestorage = g_strdup_printf("%s-storage", nodenameprefix);
|
||||
char *nodeformat = g_strdup_printf("%s-format", nodenameprefix);
|
||||
const char *encryptionAlias = nodestorage;
|
||||
|
||||
/* qemuBlockStorageSourceSetStorageNodename steals 'nodestorage' */
|
||||
qemuBlockStorageSourceSetStorageNodename(src, nodestorage);
|
||||
qemuBlockStorageSourceSetFormatNodename(src, nodeformat);
|
||||
|
||||
if (qemuBlockStorageSourceNeedsFormatLayer(src)) {
|
||||
char *nodeformat = g_strdup_printf("%s-format", nodenameprefix);
|
||||
|
||||
qemuBlockStorageSourceSetFormatNodename(src, nodeformat);
|
||||
|
||||
encryptionAlias = nodeformat;
|
||||
}
|
||||
|
||||
if (qemuDomainSecretStorageSourcePrepareEncryption(priv, src, encryptionAlias) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuBlockStorageSourceNeedsStorageSliceLayer(src))
|
||||
src->sliceStorage->nodename = g_strdup_printf("libvirt-%u-slice-sto", src->id);
|
||||
@ -11126,9 +11136,6 @@ qemuDomainPrepareStorageSourceBlockdevNodename(virDomainDiskDef *disk,
|
||||
qemuDomainPrepareStorageSourceConfig(src, cfg);
|
||||
qemuDomainPrepareDiskSourceData(disk, src);
|
||||
|
||||
if (qemuDomainSecretStorageSourcePrepareEncryption(priv, src, nodeformat) < 0)
|
||||
return -1;
|
||||
|
||||
if (!qemuDomainPrepareStorageSourceNbdkit(src, cfg, nodestorage, priv)) {
|
||||
/* If we're using nbdkit to serve the storage source, we don't pass
|
||||
* authentication secrets to qemu, but will pass them to nbdkit instead */
|
||||
|
Loading…
Reference in New Issue
Block a user