diff mbox

[5/8] XBZRLE cache size should not be larger than guest memory size

Message ID 1391527185-28349-6-git-send-email-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Feb. 4, 2014, 3:19 p.m. UTC
From: Orit Wasserman <owasserm@redhat.com>

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eric Blake Feb. 4, 2014, 4:26 p.m. UTC | #1
On 02/04/2014 08:19 AM, Juan Quintela wrote:
> From: Orit Wasserman <owasserm@redhat.com>
> 
> Signed-off-by: Orit Wasserman <owasserm@redhat.com>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/migration.c b/migration.c
> index 46a7305..25add6f 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 ");

Trailing space in the error message.
Orit Wasserman Feb. 4, 2014, 4:29 p.m. UTC | #2
On 02/04/2014 06:26 PM, Eric Blake wrote:
> On 02/04/2014 08:19 AM, Juan Quintela wrote:
>> From: Orit Wasserman <owasserm@redhat.com>
>>
>> Signed-off-by: Orit Wasserman <owasserm@redhat.com>
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>   migration.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/migration.c b/migration.c
>> index 46a7305..25add6f 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 ");
>
> Trailing space in the error message.
>

I will send a separate patch to fix this.

Orit
diff mbox

Patch

diff --git a/migration.c b/migration.c
index 46a7305..25add6f 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",