[PATCH] qemu: reset migration source if restore fails

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

 



With the latest KVM I'm having some issues with save/restore, but I
think it's a kvm issue and not libvirt.  The problems did expose a
libvirt bug, though; patch below.

-jim

---

A failed restore of a configured VM would leave the migration source
set incorrectly, preventing the VM from being started normally.
Always clear migration source, then deal with failures.

 src/qemu_driver.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 87b66ad..bff17b0 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2083,6 +2083,7 @@ static int qemudDomainRestore(virConnectPtr conn,
     struct qemud_vm_def *def;
     struct qemud_vm *vm;
     int fd;
+    int ret;
     char *xml;
     struct qemud_save_header header;
 
@@ -2161,18 +2162,17 @@ static int qemudDomainRestore(virConnectPtr conn,
     /* Set the migration source and start it up. */
     snprintf(vm->migrateFrom, sizeof(vm->migrateFrom), "stdio");
     vm->stdin = fd;
-
-    if (qemudStartVMDaemon(conn, driver, vm) < 0) {
+    ret = qemudStartVMDaemon(conn, driver, vm);
+    close(fd);
+    vm->migrateFrom[0] = '\0';
+    vm->stdin = -1;
+    if (ret < 0) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
                          "failed to start VM");
         if (!vm->configFile[0])
             qemudRemoveInactiveVM(driver, vm);
-        close(fd);
         return -1;
     }
-    close(fd);
-    vm->migrateFrom[0] = '\0';
-    vm->stdin = -1;
 
     /* If it was running before, resume it now. */
     if (header.was_running) {
-- 
1.5.3.rc4

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