qemu: domain: Don't delete aliases of secret objects associated with disks

We need to reference the secret objects by name when hot-unplugging
disks. Don't remove the alias so that it does not need to be
recalculated.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-05-28 15:31:42 +02:00
parent 02b031a475
commit 04c890cc8b

View File

@ -1440,31 +1440,23 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
}
static void
qemuDomainSecretStorageSourceDestroy(virStorageSourcePtr src)
{
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
if (srcPriv && srcPriv->secinfo)
qemuDomainSecretInfoFree(&srcPriv->secinfo);
if (srcPriv && srcPriv->encinfo)
qemuDomainSecretInfoFree(&srcPriv->encinfo);
}
/* qemuDomainSecretDiskDestroy:
* @disk: Pointer to a disk definition
*
* Clear and destroy memory associated with the secret
* Clears unnecessary data associated with disk secret objects.
*/
void
qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
{
virStorageSourcePtr next;
qemuDomainStorageSourcePrivatePtr srcPriv;
virStorageSourcePtr n;
for (next = disk->src; virStorageSourceIsBacking(next); next = next->backingStore)
qemuDomainSecretStorageSourceDestroy(next);
for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
if ((srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(n))) {
qemuDomainSecretInfoDestroy(srcPriv->secinfo);
qemuDomainSecretInfoDestroy(srcPriv->encinfo);
}
}
}
@ -1698,8 +1690,7 @@ qemuDomainSecretChardevPrepare(virQEMUDriverConfigPtr cfg,
/* qemuDomainSecretDestroy:
* @vm: Domain object
*
* Once completed with the generation of the command line it is
* expect to remove the secrets
* Removes all unnecessary data which was needed to generate 'secret' objects.
*/
void
qemuDomainSecretDestroy(virDomainObjPtr vm)