nfv/guest-agent/guest-scale-agent-2.0
SidneyAn 3d29430fa9 free memory and file handle when it is no longer in use
leaked_storage:
1. in function cpu_scale_down() and cpu_scale_up()
memory obtained from range_to_array() is done dynamically
using malloc().
it should be freed when it is no longer in use.
2. in function range_to_array() memory obtained
from malloc() do not free at lable 'error'

leaked_handle:
in function get_highest_online_cpu(), online_cpu(), offline_cpu()
function handle 'fd' do not close until the end of function.

test case:
1. one controller + one compute deploy success.
2. scaling instance's cpu up/down by nova for 200 times, with whom
"guest_scale_agent" and "guest_agent" is installed:
  With origin code:
    each time of cpu scale up/down, a new fd was created without
close. each time of cpu scale up, there were some bytes memory leak.
Though it can be detected after hundreds of times of scale up.
  With patch code:
    after 200 times of scale up and down, there is no fd or memory
 leak found

Steps to Reproduce:
1. make test images and flavor according to docs in
/guest-agent/guest-scale-agent-2.0/docs/README.txt
2. On controller, use nova command to scale cpu up/down
3. check release by cmd "ll /proc/<guest_scale_agent pid>/fd",
"ps aux |grep guest_scale_agent"

Closes-Bug: 1794898

Change-Id: I51674d5e3bf330441f473ebfe8fa2a6066a94dfa
Signed-off-by: SidneyAn <ran1.an@intel.com>
2018-11-15 13:40:50 +08:00
..
bin StarlingX open source release updates 2018-05-31 07:36:51 -07:00
docs StarlingX open source release updates 2018-05-31 07:36:51 -07:00
obj StarlingX open source release updates 2018-05-31 07:36:51 -07:00
scripts StarlingX open source release updates 2018-05-31 07:36:51 -07:00
guest_scale_agent.c free memory and file handle when it is no longer in use 2018-11-15 13:40:50 +08:00
guest_scale_helper.c StarlingX open source release updates 2018-05-31 07:36:51 -07:00
LICENSE StarlingX open source release updates 2018-05-31 07:36:51 -07:00
Makefile StarlingX open source release updates 2018-05-31 07:36:51 -07:00
Makefile.sdk StarlingX open source release updates 2018-05-31 07:36:51 -07:00
misc.h StarlingX open source release updates 2018-05-31 07:36:51 -07:00
parser_test.c StarlingX open source release updates 2018-05-31 07:36:51 -07:00
parser.c free memory and file handle when it is no longer in use 2018-11-15 13:40:50 +08:00