提交 2c4c7de1 编写于 作者: E Erik Skultety

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: NErik Skultety <eskultet@redhat.com>
Acked-by: NMichal Privoznik <mprivozn@redhat.com>
上级 0c6ad476
...@@ -6041,14 +6041,15 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, ...@@ -6041,14 +6041,15 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
static int static int
qemuProcessSEVCreateFile(const char *configDir, qemuProcessSEVCreateFile(virDomainObjPtr vm,
const char *name, const char *name,
const char *data) const char *data)
{ {
qemuDomainObjPrivatePtr priv = vm->privateData;
char *configFile; char *configFile;
int ret = -1; int ret = -1;
if (!(configFile = virFileBuildPath(configDir, name, ".base64"))) if (!(configFile = virFileBuildPath(priv->libDir, name, ".base64")))
return -1; return -1;
if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) { if (virFileRewriteStr(configFile, S_IRUSR | S_IWUSR, data) < 0) {
...@@ -6085,12 +6086,12 @@ qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm) ...@@ -6085,12 +6086,12 @@ qemuProcessPrepareSEVGuestInput(virDomainObjPtr vm)
} }
if (sev->dh_cert) { 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; return -1;
} }
if (sev->session) { if (sev->session) {
if (qemuProcessSEVCreateFile(priv->libDir, "session", sev->session) < 0) if (qemuProcessSEVCreateFile(vm, "session", sev->session) < 0)
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册