mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
qemu: process: Setup disk secrets when preparing disks
Setup everything related to disks in one place rather than calling in from various places. The change to ordering of the setup steps is necessary since secrets need the master key to be present.
This commit is contained in:
parent
2c82fddca9
commit
acc15025ed
@ -1647,10 +1647,7 @@ qemuDomainSecretPrepare(virConnectPtr conn,
|
||||
size_t i;
|
||||
int ret = -1;
|
||||
|
||||
for (i = 0; i < vm->def->ndisks; i++) {
|
||||
if (qemuDomainSecretDiskPrepare(conn, priv, vm->def->disks[i]) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
/* disk secrets are prepared when preparing disks */
|
||||
|
||||
for (i = 0; i < vm->def->nhostdevs; i++) {
|
||||
if (qemuDomainSecretHostdevPrepare(conn, priv,
|
||||
|
@ -5343,6 +5343,7 @@ static int
|
||||
qemuProcessPrepareDomainStorage(virConnectPtr conn,
|
||||
virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainObjPrivatePtr priv,
|
||||
virQEMUDriverConfigPtr cfg,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -5363,6 +5364,9 @@ qemuProcessPrepareDomainStorage(virConnectPtr conn,
|
||||
|
||||
if (qemuDomainPrepareDiskSourceTLS(disk->src, cfg) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuDomainSecretDiskPrepare(conn, priv, disk) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -5467,18 +5471,18 @@ qemuProcessPrepareDomain(virConnectPtr conn,
|
||||
if (qemuProcessSetupGraphics(driver, vm, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Setting up storage");
|
||||
if (qemuProcessPrepareDomainStorage(conn, driver, vm, cfg, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Create domain masterKey");
|
||||
if (qemuDomainMasterKeyCreate(vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Setting up storage");
|
||||
if (qemuProcessPrepareDomainStorage(conn, driver, vm, priv, cfg, flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DEBUG("Prepare chardev source backends for TLS");
|
||||
qemuDomainPrepareChardevSource(vm->def, cfg);
|
||||
|
||||
VIR_DEBUG("Add secrets to disks, hostdevs, and chardevs");
|
||||
VIR_DEBUG("Add secrets to hostdevs and chardevs");
|
||||
if (qemuDomainSecretPrepare(conn, driver, vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user