yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 34974722fc54eb326f5af4153dfa7f73dd7f4d70 Mon Sep 17 00:00:00 2001
0a122b
From: Orit Wasserman <owasserm@redhat.com>
0a122b
Date: Tue, 11 Feb 2014 15:32:35 +0100
0a122b
Subject: [PATCH 14/28] XBZRLE cache size should not be larger than guest memory size
0a122b
0a122b
RH-Author: Orit Wasserman <owasserm@redhat.com>
0a122b
Message-id: <1392132757-18587-2-git-send-email-owasserm@redhat.com>
0a122b
Patchwork-id: 57209
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 1/3] XBZRLE cache size should not be larger than guest memory size
0a122b
Bugzilla: 1047448
0a122b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
0a122b
RH-Acked-by: Juan Quintela <quintela@redhat.com>
0a122b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
0a122b
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
0a122b
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
0a122b
Signed-off-by: Juan Quintela <quintela@redhat.com>
0a122b
(cherry picked from commit a5615b14a66e86f620e90c8f4b3537c28bb328d4)
0a122b
---
0a122b
 migration.c | 7 +++++++
0a122b
 1 file changed, 7 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 migration.c |    7 +++++++
0a122b
 1 files changed, 7 insertions(+), 0 deletions(-)
0a122b
0a122b
diff --git a/migration.c b/migration.c
0a122b
index 6487fe2..b6de990 100644
0a122b
--- a/migration.c
0a122b
+++ b/migration.c
0a122b
@@ -483,6 +483,13 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
0a122b
         return;
0a122b
     }
0a122b
 
0a122b
+    /* Cache should not be larger than guest ram size */
0a122b
+    if (value > ram_bytes_total()) {
0a122b
+        error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
0a122b
+                  "exceeds guest ram size ");
0a122b
+        return;
0a122b
+    }
0a122b
+
0a122b
     new_size = xbzrle_cache_resize(value);
0a122b
     if (new_size < 0) {
0a122b
         error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
0a122b
-- 
0a122b
1.7.1
0a122b