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>
This commit is contained in:
Orit Wasserman 2014-01-30 20:08:36 +02:00 committed by Juan Quintela
parent 905f26f222
commit a5615b14a6

View File

@ -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",