render / rpms / libvirt

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