aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-11-17 17:55:43 +0200
committerMichael S. Tsirkin <mst@redhat.com>2015-01-08 13:17:54 +0200
commitb0cc3f839751bd83bdfcc480097c981c7aa1f3ec (patch)
treef275739fa60677887ac2a1d365079eec14e9390e /arch_init.c
parent62be4e3a5041e84304aa23637da623a205c53ecc (diff)
arch_init: support resizing on incoming migration
If block used_length does not match, try to resize it. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/arch_init.c b/arch_init.c
index 106f46e623..cfedbf08af 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -1086,11 +1086,14 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (!strncmp(id, block->idstr, sizeof(id))) {
- if (block->used_length != length) {
- error_report("Length mismatch: %s: 0x" RAM_ADDR_FMT
- " in != 0x" RAM_ADDR_FMT, id, length,
- block->used_length);
- ret = -EINVAL;
+ if (length != block->used_length) {
+ Error *local_err = NULL;
+
+ ret = qemu_ram_resize(block->offset, length, &local_err);
+ if (local_err) {
+ error_report("%s", error_get_pretty(local_err));
+ error_free(local_err);
+ }
}
break;
}