mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: domain: Set up disk TLS alias when preparing TLS setup
Move the TLS object alias setup earlier. Also make sure that the alias is not overwritten on hotplug. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
da49ff2c01
commit
9083586b21
@ -791,9 +791,6 @@ qemuBuildDiskSrcTLSx509CommandLine(virCommandPtr cmd,
|
|||||||
/* other protocols may be added later */
|
/* other protocols may be added later */
|
||||||
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
|
if (src->protocol == VIR_STORAGE_NET_PROTOCOL_VXHS &&
|
||||||
src->haveTLS == VIR_TRISTATE_BOOL_YES) {
|
src->haveTLS == VIR_TRISTATE_BOOL_YES) {
|
||||||
if (!(src->tlsAlias = qemuAliasTLSObjFromSrcAlias(srcalias)))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return qemuBuildTLSx509CommandLine(cmd, src->tlsCertdir,
|
return qemuBuildTLSx509CommandLine(cmd, src->tlsCertdir,
|
||||||
false, src->tlsVerify,
|
false, src->tlsVerify,
|
||||||
false, srcalias, qemuCaps);
|
false, srcalias, qemuCaps);
|
||||||
|
@ -9957,6 +9957,7 @@ qemuProcessPrepareStorageSourceTLSVxhs(virStorageSourcePtr src,
|
|||||||
/* qemuProcessPrepareStorageSourceTLS:
|
/* qemuProcessPrepareStorageSourceTLS:
|
||||||
* @source: source for a disk
|
* @source: source for a disk
|
||||||
* @cfg: driver configuration
|
* @cfg: driver configuration
|
||||||
|
* @parentAlias: alias of the parent device
|
||||||
*
|
*
|
||||||
* Updates host interface TLS encryption setting based on qemu.conf
|
* Updates host interface TLS encryption setting based on qemu.conf
|
||||||
* for disk devices. This will be presented as "tls='yes|no'" in
|
* for disk devices. This will be presented as "tls='yes|no'" in
|
||||||
@ -9966,7 +9967,8 @@ qemuProcessPrepareStorageSourceTLSVxhs(virStorageSourcePtr src,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
|
qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
|
||||||
virQEMUDriverConfigPtr cfg)
|
virQEMUDriverConfigPtr cfg,
|
||||||
|
const char *parentAlias)
|
||||||
{
|
{
|
||||||
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
|
if (virStorageSourceGetActualType(src) != VIR_STORAGE_TYPE_NETWORK)
|
||||||
return 0;
|
return 0;
|
||||||
@ -10003,6 +10005,10 @@ qemuDomainPrepareStorageSourceTLS(virStorageSourcePtr src,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->haveTLS == VIR_TRISTATE_BOOL_YES &&
|
||||||
|
!(src->tlsAlias = qemuAliasTLSObjFromSrcAlias(parentAlias)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12516,6 +12522,9 @@ qemuDomainPrepareDiskSourceLegacy(virDomainDiskDefPtr disk,
|
|||||||
if (qemuDomainPrepareStorageSourcePR(disk->src, priv, disk->info.alias) < 0)
|
if (qemuDomainPrepareStorageSourcePR(disk->src, priv, disk->info.alias) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (qemuDomainPrepareStorageSourceTLS(disk->src, cfg, disk->info.alias) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12530,9 +12539,6 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk,
|
|||||||
if (qemuDomainPrepareDiskSourceLegacy(disk, priv, cfg) < 0)
|
if (qemuDomainPrepareDiskSourceLegacy(disk, priv, cfg) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (qemuDomainPrepareStorageSourceTLS(disk->src, cfg) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +156,7 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver,
|
|||||||
static int
|
static int
|
||||||
qemuDomainAddDiskSrcTLSObject(virQEMUDriverPtr driver,
|
qemuDomainAddDiskSrcTLSObject(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
virStorageSourcePtr src,
|
virStorageSourcePtr src)
|
||||||
const char *srcalias)
|
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
@ -167,7 +166,7 @@ qemuDomainAddDiskSrcTLSObject(virQEMUDriverPtr driver,
|
|||||||
src->tlsCertdir,
|
src->tlsCertdir,
|
||||||
false,
|
false,
|
||||||
src->tlsVerify,
|
src->tlsVerify,
|
||||||
srcalias, &tlsProps, &src->tlsAlias,
|
NULL, &tlsProps, NULL,
|
||||||
NULL, NULL) < 0)
|
NULL, NULL) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@ -471,8 +470,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver,
|
|||||||
prdStarted = true;
|
prdStarted = true;
|
||||||
|
|
||||||
if (disk->src->haveTLS &&
|
if (disk->src->haveTLS &&
|
||||||
qemuDomainAddDiskSrcTLSObject(driver, vm, disk->src,
|
qemuDomainAddDiskSrcTLSObject(driver, vm, disk->src) < 0)
|
||||||
disk->info.alias) < 0)
|
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps)))
|
if (!(drivestr = qemuBuildDriveStr(disk, false, priv->qemuCaps)))
|
||||||
|
Loading…
Reference in New Issue
Block a user