summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2009-05-29 14:12:50 +0000
committerCole Robinson <crobinso@redhat.com>2009-05-29 14:12:50 +0000
commit34497fdb37c6e77044a7202c9372997646b44ee1 (patch)
tree5c3b63f262ad90b492197e05b2da78227679ebf9
parentqemuDomainLookupByUUID: print correct UUID string on failed lookup. (diff)
downloadlibvirt-34497fdb37c6e77044a7202c9372997646b44ee1.tar.gz
libvirt-34497fdb37c6e77044a7202c9372997646b44ee1.tar.bz2
libvirt-34497fdb37c6e77044a7202c9372997646b44ee1.zip
qemu_driver: Fix another domain startup error reporting race.
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).
-rw-r--r--ChangeLog5
-rw-r--r--src/qemu_driver.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index fef723cd8..f7d24151a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 29 10:10:00 EDT 2009 Cole Robinson <crobinso@redhat.com>
+
+ * src/qemu_driver.c: qemu_driver: Fix another domain startup error
+ reporting race.
+
Fri May 29 10:01:19 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/qemu_driver.c : qemuDomainLookupByUUID: print correct UUID
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 9bd7d0328..5f23bfab8 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);
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--;