[Kimchi-devel] [PATCH][Kimchi] Fix memory value return when hotplug memory devs

Aline Manera alinefm at linux.vnet.ibm.com
Wed Mar 23 21:37:41 UTC 2016


Some tests cases are failing with this patch:
Could you, please, fix it and resend?


======================================================================
FAIL: test_image_based_template (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 265, in test_image_based_template
     self.assertEquals('finished', inst.task_lookup(task_id)['status'])
AssertionError: 'finished' != u'failed'

======================================================================
FAIL: test_vm_info (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 116, in test_vm_info
     self.assertEquals(2048, info['memory']['current'])
AssertionError: 2048 != 8192L

======================================================================
FAIL: test_vm_lifecycle (test_model.ModelTests)
----------------------------------------------------------------------
Traceback (most recent call last):
   File "test_model.py", line 137, in test_vm_lifecycle
     self.assertEquals('finished', task['status'])
AssertionError: 'finished' != u'failed'


On 03/23/2016 05:53 PM, Rodrigo Trujillo wrote:
> There is an issue when Kimchi returns the value of memory. It is
> returning the current memory value, instead of the total memory, which
> includes the value of the memory devices added.
> This patch fix this problem returning the total value from "dom.info".
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   model/vms.py | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/model/vms.py b/model/vms.py
> index e3bc266..396758d 100644
> --- a/model/vms.py
> +++ b/model/vms.py
> @@ -1228,7 +1228,17 @@ class VMModel(object):
>                   unit = 'KiB'
>               memory = convert_data_size(val, unit, 'MiB')
>           else:
> -            memory = info[2] >> 10
> +            # If guest is running we need information in real time, in order
> +            # to get real value if memory devices were added:
> +            #
> +            #   Class Libvirt::Domain::Info
> +            #     cpu_time[R]
> +            #     max_mem[R]  -> current memory plus  memory devs (use it)
> +            #     memory[R]   -> current memory only, does not include mem devs
> +            #     nr_virt_cpu[R]
> +            #     state[R]
> +            #
> +            memory = info[1] >> 10
>
>           # assure there is no zombie process left
>           for proc in self._serial_procs[:]:




More information about the Kimchi-devel mailing list