aboutsummaryrefslogtreecommitdiff
path: root/migration.c
diff options
context:
space:
mode:
authorOrit Wasserman <owasserm@redhat.com>2014-01-30 20:08:36 +0200
committerJuan Quintela <quintela@redhat.com>2014-02-04 16:49:28 +0100
commita5615b14a66e86f620e90c8f4b3537c28bb328d4 (patch)
tree6e7c97d4af51888121a78b4dcc9547fee8093251 /migration.c
parent905f26f2221e139ac0e7317ddac158c50f5cf876 (diff)
XBZRLE cache size should not be larger than guest memory size
Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration.c')
-rw-r--r--migration.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/migration.c b/migration.c
index 46a7305395..25add6f9e2 100644
--- a/migration.c
+++ b/migration.c
@@ -479,6 +479,13 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
return;
}
+ /* Cache should not be larger than guest ram size */
+ if (value > ram_bytes_total()) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
+ "exceeds guest ram size ");
+ return;
+ }
+
new_size = xbzrle_cache_resize(value);
if (new_size < 0) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",