On Thu, May 28, 2009 at 01:16:23PM -0400, Cole Robinson wrote: > Parse the command line output a bit earlier so we have a better chance > of reporting the full error output on failure. > > I hit this when QEMU would try to boot an invalid kernel (virtinst bug). > > Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx> > --- > src/qemu_driver.c | 13 ++++++++----- > 1 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/src/qemu_driver.c b/src/qemu_driver.c > index 9bd7d03..f62a46b 100644 > --- a/src/qemu_driver.c > +++ b/src/qemu_driver.c > @@ -746,17 +746,21 @@ qemudReadLogOutput(virConnectPtr conn, > const char *what, > int timeout) > { > - int retries = timeout*10; > + int retries = (timeout*10)+1; Seems to be magical not really related to the problem ? > int got = 0; > buf[0] = '\0'; > > while (retries) { > - ssize_t ret; > + ssize_t func_ret, ret; > int isdead = 0; > > + func_ret = func(conn, vm, buf, fd); > + > if (kill(vm->pid, 0) == -1 && errno == ESRCH) > isdead = 1; > > + /* Any failures should be detected before we read the log, so we > + * always have something useful to report on failure. */ > ret = saferead(fd, buf+got, buflen-got-1); > if (ret < 0) { > virReportSystemError(conn, errno, > @@ -781,9 +785,8 @@ qemudReadLogOutput(virConnectPtr conn, > return -1; > } > > - ret = func(conn, vm, buf, fd); > - if (ret <= 0) > - return ret; > + if (func_ret <= 0) > + return func_ret; > > usleep(100*1000); > retries--; > -- ACK 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