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

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

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/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Wed, Oct 10, 2007 at 04:06:59AM -0400, Daniel Veillard wrote:
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,
Yep, clearly needed. I've committed this to CVS. Regards, Dan -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Paris