[PATCH] qemu: save status xml after generating taint message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We didn't always save status xml after generating new taint
message, which resulted in it being deleted in case of a libvirtd
restart.  Some taint messages were preserved thanks to saving
status xml separately at the end of the calling functions (which
makes sense, because qemuDomainObjTaint was usually called there
multiple times).  But for special cases (e.g. When only few taint
messages are generated) we need a separate function for
generating them and saving status xml explicitly.

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

Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 11 +++++++++++
 src/qemu/qemu_domain.h |  5 +++++
 src/qemu/qemu_driver.c |  4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ac1d8ef151..4b9e717c16 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6468,6 +6468,17 @@ void qemuDomainObjTaint(virQEMUDriver *driver,
     qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL);
 }
 
+void qemuDomainObjTaintAndSave(virQEMUDriver *driver,
+                               virDomainObj *obj,
+                               virDomainTaintFlags taint,
+                               qemuDomainLogContext *logCtxt)
+{
+    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+
+    qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL);
+    ignore_value(virDomainObjSave(obj, driver->xmlopt, cfg->stateDir));
+}
+
 void qemuDomainObjTaintMsg(virQEMUDriver *driver,
                            virDomainObj *obj,
                            virDomainTaintFlags taint,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index acf6ca5ab6..9bd711cbd4 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -568,6 +568,11 @@ void qemuDomainObjTaint(virQEMUDriver *driver,
                         virDomainTaintFlags taint,
                         qemuDomainLogContext *logCtxt);
 
+void qemuDomainObjTaintAndSave(virQEMUDriver *driver,
+                               virDomainObj *obj,
+                               virDomainTaintFlags taint,
+                               qemuDomainLogContext *logCtxt);
+
 void qemuDomainObjTaintMsg(virQEMUDriver *driver,
                            virDomainObj *obj,
                            virDomainTaintFlags taint,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 521063d438..8652bdc3d8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14010,7 +14010,7 @@ static int qemuDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
 
     priv = vm->privateData;
 
-    qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_MONITOR, NULL);
+    qemuDomainObjTaintAndSave(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_MONITOR, NULL);
 
     hmp = !!(flags & VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP);
 
@@ -16877,7 +16877,7 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
     if (!qemuDomainAgentAvailable(vm, true))
         goto endjob;
 
-    qemuDomainObjTaint(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, NULL);
+    qemuDomainObjTaintAndSave(driver, vm, VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, NULL);
 
     agent = qemuDomainObjEnterAgent(vm);
     ret = qemuAgentArbitraryCommand(agent, cmd, &result, timeout);
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux