render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
9119d9
From 8e7c6d9bb776c793c352d94952079e96aedf9599 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <8e7c6d9bb776c793c352d94952079e96aedf9599@dist-git>
9119d9
From: Michal Privoznik <mprivozn@redhat.com>
9119d9
Date: Tue, 18 Nov 2014 13:33:38 +0100
9119d9
Subject: [PATCH] qemu: Update fsfreeze status on domain state transitions
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1160084
9119d9
9119d9
As of b6d4dad1 (1.2.5) libvirt keeps track if domain disks have been
9119d9
frozen. However, this falls into that set of information which don't
9119d9
survive domain restart. Therefore, we need to clear the flag upon some
9119d9
state transitions. Moreover, once we clear the flag we must update the
9119d9
status file too.
9119d9
9119d9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9119d9
(cherry picked from commit 6ea54769ba1816b382698c4311588d7d1a9cd095)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_driver.c  | 10 +++++-----
9119d9
 src/qemu/qemu_process.c | 10 ++++++++++
9119d9
 2 files changed, 15 insertions(+), 5 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
9119d9
index 6ed830c..ea45d89 100644
9119d9
--- a/src/qemu/qemu_driver.c
9119d9
+++ b/src/qemu/qemu_driver.c
9119d9
@@ -4041,11 +4041,6 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
9119d9
         VIR_WARN("Unable to release lease on %s", vm->def->name);
9119d9
     VIR_DEBUG("Preserving lock state '%s'", NULLSTR(priv->lockState));
9119d9
 
9119d9
-    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
9119d9
-        VIR_WARN("Unable to save status on vm %s after state change",
9119d9
-                 vm->def->name);
9119d9
-     }
9119d9
-
9119d9
     switch (action) {
9119d9
     case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY:
9119d9
         if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0) {
9119d9
@@ -4103,6 +4098,11 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
9119d9
     }
9119d9
 
9119d9
  cleanup:
9119d9
+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0) {
9119d9
+        VIR_WARN("Unable to save status on vm %s after state change",
9119d9
+                 vm->def->name);
9119d9
+     }
9119d9
+
9119d9
     virObjectUnref(cfg);
9119d9
 }
9119d9
 
9119d9
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
9119d9
index 9c640f0..3eb1036 100644
9119d9
--- a/src/qemu/qemu_process.c
9119d9
+++ b/src/qemu/qemu_process.c
9119d9
@@ -529,6 +529,7 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
9119d9
     virQEMUDriverPtr driver = opaque;
9119d9
     virObjectEventPtr event;
9119d9
     qemuDomainObjPrivatePtr priv;
9119d9
+    virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
9119d9
 
9119d9
     virObjectLock(vm);
9119d9
 
9119d9
@@ -536,12 +537,20 @@ qemuProcessHandleReset(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
9119d9
     priv = vm->privateData;
9119d9
     if (priv->agent)
9119d9
         qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET);
9119d9
+    /* Clear some domain runtime information. For instance,
9119d9
+     * fsfreeze won't survive domain reset. This, however,
9119d9
+     * required the domain status file to be rewritten onto disk. */
9119d9
+    priv->quiesced = false;
9119d9
+
9119d9
+    if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
9119d9
+        VIR_WARN("Failed to save status on vm %s", vm->def->name);
9119d9
 
9119d9
     virObjectUnlock(vm);
9119d9
 
9119d9
     if (event)
9119d9
         qemuDomainEventQueue(driver, event);
9119d9
 
9119d9
+    virObjectUnref(cfg);
9119d9
     return 0;
9119d9
 }
9119d9
 
9119d9
@@ -4844,6 +4853,7 @@ void qemuProcessStop(virQEMUDriverPtr driver,
9119d9
 
9119d9
     virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
9119d9
     priv->nbdPort = 0;
9119d9
+    priv->quiesced = false;
9119d9
 
9119d9
     if (priv->agent) {
9119d9
         qemuAgentClose(priv->agent);
9119d9
-- 
9119d9
2.1.3
9119d9