mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
qemu: process: SEV: Assume libDir to be the directory to create files in
Since SEV operates on a per domain basis, it's very likely that all SEV launch-related data will be created under /var/lib/libvirt/qemu/<domain_name>. Therefore, when calling into qemuProcessSEVCreateFile we can assume @libDir as the directory prefix rather than passing it explicitly. Signed-off-by: Erik Skultety <eskultet@redhat.com> Acked-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
0c6ad476a8
commit
2c4c7de159
@ -6041,14 +6041,15 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
|
||||
|
||||
|
||||
static int
|
||||
qemuProcessSEVCreateFile(const char *configDir,
|
||||
qemuProcessSEVCreateFile(virDomainObjPtr vm,
|
||||
const char *name,
|
||||
const char *data)
|
||||
{
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
char *configFile;
|
||||
int ret = -1;
|
||||
|
||||
if (!(configFile = virFileBuildPath(configDir, name, ".base64")))
|
||||
if (!(configFile = virFileBuildPath(priv->libDir, name, ".base64")))
|
||||
return -1;
|
||||
|
||||
if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
|
||||
@ -6085,12 +6086,12 @@ qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
|
||||
}
|
||||
|
||||
if (sev->dh_cert) {
|
||||
if (qemuProcessSEVCreateFile(priv->libDir, "dh_cert", sev->dh_cert) < 0)
|
||||
if (qemuProcessSEVCreateFile(vm, "dh_cert", sev->dh_cert) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (sev->session) {
|
||||
if (qemuProcessSEVCreateFile(priv->libDir, "session", sev->session) < 0)
|
||||
if (qemuProcessSEVCreateFile(vm, "session", sev->session) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user