[libvirt] [PATCH v2 3/8] qemu: Move qemuDomainSecretPrepare to qemuProcessPrepareDomain

John Ferlan jferlan at redhat.com
Mon May 2 21:51:10 UTC 2016


Commit id '40d8e2ba3' added the function to qemuProcessStart because
in order to set up some secrets in the future we will need the master
key. However, since the previous patch split the master key creation
into two parts (create just the key and create the file), we can now
call qemuDomainSecretPrepare from qemuProcessPrepareDomain since the
file is not necessary.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_process.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 2a0362c..baabb31 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5111,6 +5111,10 @@ qemuProcessPrepareDomain(virConnectPtr conn,
     if (qemuDomainMasterKeyCreate(vm) < 0)
         goto cleanup;
 
+    VIR_DEBUG("Add secrets to disks and hostdevs");
+    if (qemuDomainSecretPrepare(conn, vm) < 0)
+        goto cleanup;
+
     if (VIR_ALLOC(priv->monConfig) < 0)
         goto cleanup;
 
@@ -5671,9 +5675,6 @@ qemuProcessStart(virConnectPtr conn,
     if (qemuProcessPrepareHost(driver, vm, !!incoming) < 0)
         goto stop;
 
-    if (qemuDomainSecretPrepare(conn, vm) < 0)
-        goto cleanup;
-
     if ((rv = qemuProcessLaunch(conn, driver, vm, asyncJob, incoming,
                                 snapshot, vmop, flags)) < 0) {
         if (rv == -2)
@@ -5745,9 +5746,6 @@ qemuProcessCreatePretendCmd(virConnectPtr conn,
     if (qemuProcessPrepareDomain(conn, driver, vm, flags) < 0)
         goto cleanup;
 
-    if (qemuDomainSecretPrepare(conn, vm) < 0)
-        goto cleanup;
-
     VIR_DEBUG("Building emulator command line");
     cmd = qemuBuildCommandLine(driver,
                                NULL,
-- 
2.5.5




More information about the libvir-list mailing list