Blame SOURCES/libvirt-qemu-process-SEV-Assume-libDir-to-be-the-directory-to-create-files-in.patch

c313de
From 0e97054a08adcd9648d006a8b03effa7f7cf2e94 Mon Sep 17 00:00:00 2001
c313de
Message-Id: <0e97054a08adcd9648d006a8b03effa7f7cf2e94@dist-git>
c313de
From: Erik Skultety <eskultet@redhat.com>
c313de
Date: Thu, 3 Jan 2019 10:03:45 +0100
c313de
Subject: [PATCH] qemu: process: SEV: Assume libDir to be the directory to
c313de
 create files in
c313de
c313de
Since SEV operates on a per domain basis, it's very likely that all
c313de
SEV launch-related data will be created under
c313de
/var/lib/libvirt/qemu/<domain_name>. Therefore, when calling into
c313de
qemuProcessSEVCreateFile we can assume @libDir as the directory prefix
c313de
rather than passing it explicitly.
c313de
c313de
Signed-off-by: Erik Skultety <eskultet@redhat.com>
c313de
Acked-by: Michal Privoznik <mprivozn@redhat.com>
c313de
(cherry picked from commit 2c4c7de1595330a828015dd750b5ef3874f289d1)
c313de
c313de
https://bugzilla.redhat.com/show_bug.cgi?id=1658112
c313de
c313de
Signed-off-by: Erik Skultety <eskultet@redhat.com>
c313de
Message-Id: <0f59cc4873d5faab4339e79714377da9f889703c.1546506016.git.eskultet@redhat.com>
c313de
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c313de
---
c313de
 src/qemu/qemu_process.c | 9 +++++----
c313de
 1 file changed, 5 insertions(+), 4 deletions(-)
c313de
c313de
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
c313de
index c0f95dd5f1..757e2d33a4 100644
c313de
--- a/src/qemu/qemu_process.c
c313de
+++ b/src/qemu/qemu_process.c
c313de
@@ -5985,14 +5985,15 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
c313de
 
c313de
 
c313de
 static int
c313de
-qemuProcessSEVCreateFile(const char *configDir,
c313de
+qemuProcessSEVCreateFile(virDomainObjPtr vm,
c313de
                          const char *name,
c313de
                          const char *data)
c313de
 {
c313de
+    qemuDomainObjPrivatePtr priv = vm->privateData;
c313de
     char *configFile;
c313de
     int ret = -1;
c313de
 
c313de
-    if (!(configFile = virFileBuildPath(configDir, name, ".base64")))
c313de
+    if (!(configFile = virFileBuildPath(priv->libDir, name, ".base64")))
c313de
         return -1;
c313de
 
c313de
     if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
c313de
@@ -6029,12 +6030,12 @@ qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
c313de
     }
c313de
 
c313de
     if (sev->dh_cert) {
c313de
-        if (qemuProcessSEVCreateFile(priv->libDir, "dh_cert", sev->dh_cert) < 0)
c313de
+        if (qemuProcessSEVCreateFile(vm, "dh_cert", sev->dh_cert) < 0)
c313de
             return -1;
c313de
     }
c313de
 
c313de
     if (sev->session) {
c313de
-        if (qemuProcessSEVCreateFile(priv->libDir, "session", sev->session) < 0)
c313de
+        if (qemuProcessSEVCreateFile(vm, "session", sev->session) < 0)
c313de
             return -1;
c313de
     }
c313de
 
c313de
-- 
c313de
2.22.0
c313de