[PATCH] qemu:Fix snapshot creating with vm xml persistent

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

 



it is a bug when the vm is undefined after started.
blockcommit interface also has the bug with above.

Signed-off-by: Bobo Du <dubobo@xxxxxxxxxxxxxxx
---
 src/qemu/qemu_blockjob.c | 2 +-
 src/qemu/qemu_driver.c   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 0f52996..90af797 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -204,7 +204,7 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
     if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
         VIR_WARN("Unable to save status on vm %s after block job", vm->def->name);
 
-    if (status == VIR_DOMAIN_BLOCK_JOB_COMPLETED && vm->newDef) {
+    if (status == VIR_DOMAIN_BLOCK_JOB_COMPLETED && vm->newDef && vm->persistent) {
         if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->newDef) < 0)
             VIR_WARN("Unable to update persistent definition on vm %s "
                      "after block job", vm->def->name);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fb0d4a8..202c1ba 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15055,7 +15055,8 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
 
     if (ret == 0 || !do_transaction) {
         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
-            (persist && virDomainSaveConfig(cfg->configDir, driver->caps,
+                (vm->persistent && persist && virDomainSaveConfig(cfg->configDir,
+                                            driver->caps,
                                             vm->newDef) < 0))
             ret = -1;
     }
-- 
1.8.3.1

--
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