Skip to content

Commit

Permalink
exec: file_ram_alloc(): print error when prealloc fails
Browse files Browse the repository at this point in the history
If memory allocation fails when using the -mem-prealloc command-line
option, QEMU exits without printing any error information to
the user:

 # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
 # echo $?
 1

This commit adds an error message, so that we print instead:

 # qemu [...] -m 1G -mem-prealloc -mem-path /dev/hugepages
 qemu: unable to map backing store for hugepages: Cannot allocate memory

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
  • Loading branch information
Luiz Capitulino committed Sep 12, 2014
1 parent 5fb9b5b commit e4d9df4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions exec.c
Expand Up @@ -1130,6 +1130,7 @@ static void *file_ram_alloc(RAMBlock *block,

error:
if (mem_prealloc) {
error_report("%s\n", error_get_pretty(*errp));
exit(1);
}
return NULL;
Expand Down

0 comments on commit e4d9df4

Please sign in to comment.