fix qemu exit on memory hotplug when allocation fails at prealloc time
authorIgor Mammedov <imammedo@redhat.com>
Wed, 20 Jul 2016 09:54:03 +0000 (11:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 Aug 2016 10:03:58 +0000 (12:03 +0200)
commit056b68af773b31fa98fe4538f6424c0079b61415
tree2915a5d9bb46cde5af57ef14bc348ddedc6721ab
parent0b21757124d200ff86100a3bc7bb5f81521b42c4
fix qemu exit on memory hotplug when allocation fails at prealloc time

When adding hostmem backend at runtime, QEMU might exit with error:
  "os_mem_prealloc: Insufficient free host memory pages available to allocate guest RAM"

It happens due to os_mem_prealloc() not handling errors gracefully.

Fix it by passing errp argument so that os_mem_prealloc() could
report error to callers and undo performed allocation when
os_mem_prealloc() fails.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Message-Id: <1469008443-72059-1-git-send-email-imammedo@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
backends/hostmem.c
exec.c
include/qemu/osdep.h
util/oslib-posix.c
util/oslib-win32.c