[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/2] 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>
---
 src/qemu/qemu_process.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2f8e19d29d..db3c095f09 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6040,14 +6040,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) {
@@ -6084,12 +6085,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;
     }
 
-- 
2.19.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]