On Sun, Jan 18, 2009 at 08:28:59PM +0100, Guido G?nther wrote: > connect back to running vms. > > changes: > * don't use proc > * don't bother about stdin > * don't use global qemu_driver directly > Cheer, > -- Guido > > +static int > +qemudReconnectVMs(struct qemud_driver *driver) > +{ > + int i; > + > + for (i = 0 ; i < driver->domains.count ; i++) { > + virDomainObjPtr vm = driver->domains.objs[i]; > + qemudDomainStatusPtr status = NULL; > + char *config = NULL; > + int rc; > + > + virDomainObjLock(vm); > + if ((rc = virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) == 0) > + DEBUG("Found pid %d for '%s'", vm->pid, vm->def->name); > + else > + goto next; > + > + if ((config = virDomainConfigFile(NULL, > + driver->stateDir, > + vm->def->name)) == NULL) { > + qemudLog(QEMUD_ERR, _("Failed to read domain status for %s\n"), > + vm->def->name); > + goto next_error; > + } > + > + status = qemudDomainStatusParseFile(NULL, driver->caps, config, 0); > + if (status) { > + vm->newDef = vm->def; > + vm->def = status->def; > + } else { > + qemudLog(QEMUD_ERR, _("Failed to parse domain status for %s\n"), > + vm->def->name); > + goto next_error; > + } > + > + if ((rc = qemudOpenMonitor(NULL, driver, vm, status->monitorpath, 1)) != 0) { > + qemudLog(QEMUD_ERR, _("Failed to reconnect monitor for %s: %d\n"), > + vm->def->name, rc); > + goto next_error; > + } else > + vm->monitorpath = status->monitorpath; > + > + if((vm->logfile = qemudLogFD(NULL, driver->logDir, vm->def->name)) < 0) > + return -1; > + > + vm->stdout_fd = vm->stderr_fd = vm->logfile; If nothing is actaully using the stdout/err FDs anymore we can just leave them at -1. Aside from that, ACK to this patch. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list