Hello

Context : oVirt Engine Version: 3.3.0-4.el6
              Hypervisor VDSM : vdsm.x86_64 - 4.12.1-2.el6

A vm :
- Memory Size : 1024 Mo
- Physical Memory Guaranteed : 128 Mo ;)
- Memory balloon device enabled
the vm is running with nearly no activity to have a constant memory used


Testcase
1 : Initial run No change to the balloon 

Total Memory = Balloon 1024 Mo
Data from vdsClient getVmStats

   balloonInfo = {'balloon_max': '1048576', 'balloon_min': '131072', 'balloon_target': '1048576', 'balloon_cur': '1048576'}
   memoryStats = {'swap_out': '0', 'majflt': '0', 'mem_free': '920308', 'swap_in': '0', 'pageflt': '7', 'mem_total': '1020576', 'mem_unused': '863500'}
 
   Here : mem_total - mem_unused = 157076 correct

Data get from api (REST or Python : statistics.'memory.used') 
Memory used 128849018.0  = 123 Mo

--------------------------------------------------------------
If i modify the balloon by the command vdsClient setBalloonTarget 524288 (512*1024)
i got
  vds
  balloonInfo = {'balloon_max': '1048576', 'balloon_min': '131072', 'balloon_target': '524288', 'balloon_cur': '524288'}
  memoryStats = {'swap_out': '0', 'majflt': '0', 'mem_free': '396044', 'swap_in': '0', 'pageflt': '7', 'mem_total': '496288', 'mem_unused': '339228'}
  
   mem_total - mem_unused = 157076 correct value


  API.statistics
Memory used = 665719930.0 = 635 Mo ==> (512+123)

--------------------------------------------------------------

Setting a balloon to 262144 (256*1024)

balloonInfo = {'balloon_max': '1048576', 'balloon_min': '131072', 'balloon_target': '262144', 'balloon_cur': '262144'}
memoryStats = {'swap_out': '0', 'majflt': '0', 'mem_free': '133916', 'swap_in': '0', 'pageflt': '6', 'mem_total': '234144', 'mem_unused': '76224'}

        mem_total - mem_unused = correct value

API.statistics:
Memory used = 934155386.0 = 891 Mo (768+123)

To get the correct value from the api i need to fdo [ (Memory Used/1024)- (Balloon Max - Balloon Current) ] / 1024


-------------

Of course display in manager is also wrong

No Balloon parameter modified

http://screencast.com/t/rGhKJgeB2ol

Balloon 512

http://screencast.com/t/L7geTfnI

Balloon 256

http://screencast.com/t/8jBllKXtGt7




Should we consider this as a bug ?
Do you plan to change the formula to compupte the memory used ?



Regards

Hervé Leclerc
CTO
Alter Way
1, rue royale
9 ème étage
92210 St Cloud
+33 1 78152407
+33 6 83979598