]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainShutdownFlags: Set fakeReboot more frequently
authorzhang bo <oscar.zhangbo@huawei.com>
Fri, 17 Apr 2015 00:43:58 +0000 (08:43 +0800)
committerCole Robinson <crobinso@redhat.com>
Tue, 28 Apr 2015 15:26:07 +0000 (11:26 -0400)
When a qemu domain is to be rebooted, from outside, at libvirt
level it looks like regular shutdown. To really restart the
domain, libvirt needs to issue reset command on the monitor once
SHUTDOWN event appeared. So, in order to differentiate bare
shutdown and reboot libvirt uses a variable within domain private
data. It's called fakeReboot. When the reboot API is called, the
variable is set, but when the shutdown API is called it must be
cleared out. But it was not for every possible case. So if user
called virDomainReboot(), and there was no ACPI daemon running
inside the guest (so guest didn't initiated shutdown sequence)
and then virDomainShutdown(mode=agent) was called bad thing
happened. We remembered the fakeReboot and instead of shutting
the domain down, we just rebooted it.

Signed-off-by: Zhang Bo <oscar.zhangbo@huawei.com>
Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8be502fd908c26b5e33c9cc7b65d8db32f5d19f9)

src/qemu/qemu_driver.c

index c848f797e3597919a0faaad06b826831f8ae9c67..fd946d6bdabbcfcd7f45691d08c2e5a70e7ec995 100644 (file)
@@ -2004,6 +2004,8 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
         goto endjob;
     }
 
+    qemuDomainSetFakeReboot(driver, vm, isReboot);
+
     if (useAgent) {
         qemuDomainObjEnterAgent(vm);
         ret = qemuAgentShutdown(priv->agent, agentFlag);
@@ -2015,7 +2017,6 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
      */
     if (!useAgent ||
         (ret < 0 && (acpiRequested || !flags))) {
-        qemuDomainSetFakeReboot(driver, vm, isReboot);
 
         /* Even if agent failed, we have to check if guest went away
          * by itself while our locks were down.  */