Blob Blame History Raw
From d901bf4a3f8da16ab50ddf2dc955e6d40cbe451f Mon Sep 17 00:00:00 2001
Message-Id: <d901bf4a3f8da16ab50ddf2dc955e6d40cbe451f@dist-git>
From: Laine Stump <laine@laine.org>
Date: Sun, 14 Dec 2014 23:44:50 -0500
Subject: [PATCH] qemu: always call qemuInterfaceStartDevices() when starting
 CPUs

The patch that added qemuInterfaceStartDevices() (upstream commit
82977058f5b1d143a355079900029e9cbfee2fe4) had an extra conditional to
prevent calling it if the reason for starting the CPUs was
VIR_DOMAIN_RUNNING_UNPAUSED or VIR_DOMAIN_RUNNING_SAVE_CANCELED.  This
was put in by the author as the result of a reviewer asking if it was
necessary to ifup the interfaces in *all* occasions (because these
were the two cases where the CPU would have already been started (and
stopped) once, so the interface would already be ifup'ed).

It turns out that, as long as there is no corresponding
qemuInterfaceStopDevices() to ifdown the interfaces anytime the CPUs
are stopped, neglecting to ifup when reason is RUNNING_UNPAUSED or
RUNNING_SAVE_CANCELED doesn't cause any problems (because it just
happens that the interface will have already been ifup'ed by a prior
call when the CPU was previously started for some other reason).

However, it also doesn't *help*, and there will soon be a
qemuInterfaceStopDevices() function which *will* ifdown these
interfaces when the guest CPUs are stopped, and once that is done, the
interfaces will be left down in some cases when they should be up (for
example, if a domain is paused and then unpaused).

So, this patch is removing the condition in favor of always calling
qemuInterfaeStartDevices() when the guest CPUs are started.

This patch (and the aforementioned patch) resolve:

  https://bugzilla.redhat.com/show_bug.cgi?id=1081461

(cherry picked from commit 879c13d6cc92b6c3d97168e822201e5d00c4a1bc)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_process.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index dd74432..627755d 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3114,9 +3114,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
     virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
 
     /* Bring up netdevs before starting CPUs */
-    if (reason != VIR_DOMAIN_RUNNING_UNPAUSED &&
-        reason != VIR_DOMAIN_RUNNING_SAVE_CANCELED &&
-        qemuInterfaceStartDevices(vm->def) < 0)
+    if (qemuInterfaceStartDevices(vm->def) < 0)
        goto cleanup;
 
     VIR_DEBUG("Using lock state '%s'", NULLSTR(priv->lockState));
-- 
2.2.0