]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
exec: file_ram_alloc(): print error when prealloc fails
authorLuiz Capitulino <lcapitulino@redhat.com>
Mon, 8 Sep 2014 17:50:05 +0000 (13:50 -0400)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 24 Dec 2014 21:43:39 +0000 (15:43 -0600)
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>
(cherry picked from commit e4d9df4fb16861f413374b69fcdb12c8c7a4a17e)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
exec.c

diff --git a/exec.c b/exec.c
index 307bc2484daf3df5024a666d551ce8b54fff1217..a7d7daa659c3664a8b06a793987c403267578f6e 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -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;