async: aio_context_new(): Handle event_notifier_init failure

On a system with a low limit of open files the initialization
of the event notifier could fail and QEMU exits without printing any
error information to the user.

The problem can be easily reproduced by enforcing a low limit of open
files and start QEMU with enough I/O threads to hit this limit.

The same problem raises, without the creation of I/O threads, while
QEMU initializes the main event loop by enforcing an even lower limit of
open files.

This commit adds an error message on failure:

 # qemu [...] -object iothread,id=iothread0 -object iothread,id=iothread1
 qemu: Failed to initialize event notifier: Too many open files in system

Signed-off-by: Chrysostomos Nanakos <cnanakos@grnet.gr>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Chrysostomos Nanakos 2014-09-18 14:30:49 +03:00 committed by Stefan Hajnoczi
parent e91a8b2fef
commit 2f78e491d7
12 changed files with 78 additions and 18 deletions

View file

@ -379,6 +379,7 @@ int main(int argc, char **argv)
int c;
int opt_index = 0;
int flags = BDRV_O_UNMAP;
Error *local_error = NULL;
#ifdef CONFIG_POSIX
signal(SIGPIPE, SIG_IGN);
@ -444,7 +445,11 @@ int main(int argc, char **argv)
exit(1);
}
qemu_init_main_loop();
if (qemu_init_main_loop(&local_error)) {
error_report("%s", error_get_pretty(local_error));
error_free(local_error);
exit(1);
}
bdrv_init();
/* initialize commands */