[PATCH 63/68] qemu: Properly avoid cancelling memory-only dump

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

 



migrate_cancel QMP command cannot be used for cancelling memory-only
dumps and priv->job.dump_memory_only is used for reporting an error if
someone calls virDomainAbortJob when memory-only dump job is running.

Since commit 150930e3098 the dump_memory_only flag is set only
dump-guest-memory command was called without the detach parameter. This
would incorrectly allow libvirt to send migrate_cancel while the
detached memory-only dump is running.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e15eb49a5c..b9927b727b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3794,12 +3794,12 @@ qemuDumpToFd(virQEMUDriverPtr driver,
     if (qemuSecuritySetImageFDLabel(driver->securityManager, vm->def, fd) < 0)
         return -1;
 
-    if (detach) {
+    priv->job.dump_memory_only = true;
+
+    if (detach)
         priv->job.current->statsType = QEMU_DOMAIN_JOB_STATS_TYPE_MEMDUMP;
-    } else {
+    else
         VIR_FREE(priv->job.current);
-        priv->job.dump_memory_only = true;
-    }
 
     if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
         return -1;
@@ -13472,7 +13472,7 @@ static int qemuDomainAbortJob(virDomainPtr dom)
 
     priv = vm->privateData;
 
-    if (!priv->job.asyncJob || priv->job.dump_memory_only) {
+    if (!priv->job.asyncJob) {
         virReportError(VIR_ERR_OPERATION_INVALID,
                        "%s", _("no job is active on the domain"));
         goto endjob;
@@ -13485,6 +13485,13 @@ static int qemuDomainAbortJob(virDomainPtr dom)
         goto endjob;
     }
 
+    if (priv->job.asyncJob == QEMU_ASYNC_JOB_DUMP &&
+        priv->job.dump_memory_only) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("cannot abort memory-only dump"));
+        goto endjob;
+    }
+
     if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_OUT &&
         (priv->job.current->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY ||
          (virDomainObjGetState(vm, &reason) == VIR_DOMAIN_PAUSED &&
-- 
2.17.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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