Re: [Libvir] [PATCH] qemu: reset migration source if restore fails

2007-10-10 Thread Daniel Veillard
On Wed, Oct 10, 2007 at 12:16:33AM -0400, Jim Paris wrote:
 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.

  Makes sense to me, 

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


[Libvir] [PATCH] qemu: reset migration source if restore fails

2007-10-09 Thread Jim Paris
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list