mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: Move encinfo from private disk to private disk src
Since the encryption information can also be disk source specific move it from qemuDomainDiskPrivate to qemuDomainStorageSourcePrivate Since the last allocated element from qemuDomainDiskPrivate is removed, that means we no longer need qemuDomainDiskPrivateDispose. Signed-off-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
ab0e32fbdf
commit
0e2e22485e
@ -1361,10 +1361,9 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
int actualType = virStorageSourceGetActualType(disk->src);
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
qemuDomainStorageSourcePrivatePtr srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
|
||||
qemuDomainSecretInfoPtr secinfo = srcpriv->secinfo;
|
||||
qemuDomainSecretInfoPtr encinfo = diskPriv->encinfo;
|
||||
qemuDomainSecretInfoPtr encinfo = srcpriv->encinfo;
|
||||
virJSONValuePtr srcprops = NULL;
|
||||
char *source = NULL;
|
||||
int ret = -1;
|
||||
@ -2239,10 +2238,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
|
||||
unsigned int bootindex = 0;
|
||||
bool driveBoot = false;
|
||||
virDomainDiskDefPtr disk = def->disks[i];
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
|
||||
qemuDomainSecretInfoPtr secinfo = srcPriv->secinfo;
|
||||
qemuDomainSecretInfoPtr encinfo = diskPriv->encinfo;
|
||||
qemuDomainSecretInfoPtr encinfo = srcPriv->encinfo;
|
||||
|
||||
if (disk->info.bootIndex) {
|
||||
bootindex = disk->info.bootIndex;
|
||||
|
@ -890,7 +890,6 @@ qemuDomainSecretInfoFree(qemuDomainSecretInfoPtr *secinfo)
|
||||
|
||||
|
||||
static virClassPtr qemuDomainDiskPrivateClass;
|
||||
static void qemuDomainDiskPrivateDispose(void *obj);
|
||||
|
||||
static int
|
||||
qemuDomainDiskPrivateOnceInit(void)
|
||||
@ -898,7 +897,7 @@ qemuDomainDiskPrivateOnceInit(void)
|
||||
qemuDomainDiskPrivateClass = virClassNew(virClassForObject(),
|
||||
"qemuDomainDiskPrivate",
|
||||
sizeof(qemuDomainDiskPrivate),
|
||||
qemuDomainDiskPrivateDispose);
|
||||
NULL);
|
||||
if (!qemuDomainDiskPrivateClass)
|
||||
return -1;
|
||||
else
|
||||
@ -922,15 +921,6 @@ qemuDomainDiskPrivateNew(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuDomainDiskPrivateDispose(void *obj)
|
||||
{
|
||||
qemuDomainDiskPrivatePtr priv = obj;
|
||||
|
||||
qemuDomainSecretInfoFree(&priv->encinfo);
|
||||
}
|
||||
|
||||
|
||||
static virClassPtr qemuDomainStorageSourcePrivateClass;
|
||||
static void qemuDomainStorageSourcePrivateDispose(void *obj);
|
||||
|
||||
@ -1342,14 +1332,13 @@ qemuDomainSecretInfoTLSNew(virConnectPtr conn,
|
||||
void
|
||||
qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
|
||||
{
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
|
||||
|
||||
if (srcPriv && srcPriv->secinfo)
|
||||
qemuDomainSecretInfoFree(&srcPriv->secinfo);
|
||||
|
||||
if (diskPriv && diskPriv->encinfo)
|
||||
qemuDomainSecretInfoFree(&diskPriv->encinfo);
|
||||
if (srcPriv && srcPriv->encinfo)
|
||||
qemuDomainSecretInfoFree(&srcPriv->encinfo);
|
||||
}
|
||||
|
||||
|
||||
@ -1394,7 +1383,6 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
||||
virDomainDiskDefPtr disk)
|
||||
{
|
||||
virStorageSourcePtr src = disk->src;
|
||||
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||
|
||||
if (!(disk->src->privateData = qemuDomainStorageSourcePrivateNew()))
|
||||
@ -1416,7 +1404,7 @@ qemuDomainSecretDiskPrepare(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (qemuDomainDiskHasEncryptionSecret(src)) {
|
||||
if (!(diskPriv->encinfo =
|
||||
if (!(srcPriv->encinfo =
|
||||
qemuDomainSecretInfoNew(conn, priv, disk->info.alias,
|
||||
VIR_SECRET_USAGE_TYPE_VOLUME, NULL,
|
||||
&src->encryption->secrets[0]->seclookupdef,
|
||||
|
@ -349,11 +349,6 @@ struct _qemuDomainDiskPrivate {
|
||||
|
||||
bool migrating; /* the disk is being migrated */
|
||||
|
||||
/* for storage devices using encryption/secret
|
||||
* Can have both <auth> and <encryption> for some disks
|
||||
* NB:*not* to be written to qemu domain object XML */
|
||||
qemuDomainSecretInfoPtr encinfo;
|
||||
|
||||
/* information about the device */
|
||||
bool tray; /* device has tray */
|
||||
bool removable; /* device media can be removed/changed */
|
||||
|
@ -370,7 +370,6 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn,
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
virJSONValuePtr secobjProps = NULL;
|
||||
virJSONValuePtr encobjProps = NULL;
|
||||
qemuDomainDiskPrivatePtr diskPriv;
|
||||
qemuDomainStorageSourcePrivatePtr srcPriv;
|
||||
qemuDomainSecretInfoPtr secinfo;
|
||||
qemuDomainSecretInfoPtr encinfo;
|
||||
@ -384,7 +383,6 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn,
|
||||
if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0)
|
||||
goto error;
|
||||
|
||||
diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
|
||||
srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(disk->src);
|
||||
secinfo = srcPriv->secinfo;
|
||||
if (secinfo && secinfo->type == VIR_DOMAIN_SECRET_INFO_TYPE_AES) {
|
||||
@ -392,7 +390,7 @@ qemuDomainAttachDiskGeneric(virConnectPtr conn,
|
||||
goto error;
|
||||
}
|
||||
|
||||
encinfo = diskPriv->encinfo;
|
||||
encinfo = srcPriv->encinfo;
|
||||
if (encinfo && qemuBuildSecretInfoProps(encinfo, &encobjProps) < 0)
|
||||
goto error;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user