提交 f512026e 编写于 作者: L Li Jin

Balloon check:Modify ballon min_size calculation formula

1. When windows guest mem is small(e.g.1024M), calculated mem
min_size will be larger than ori_mem if ratio=0.5, which will
lead balloon cases fail.
2. When do balloon operation in linux guest, we should consider
crashkernel value as well,leaving enough memory for guest to
avoid guest OOM.

So modify the formula and leave a balloon buffer(300M in default)
for guest min_sz.
Signed-off-by: NLi Jin <lijin@redhat.com>
上级 97edb72c
...@@ -20,7 +20,6 @@ class BallooningTest(MemoryBaseTest): ...@@ -20,7 +20,6 @@ class BallooningTest(MemoryBaseTest):
def __init__(self, test, params, env): def __init__(self, test, params, env):
self.test_round = 0 self.test_round = 0
self.ratio = float(params.get("ratio", 0.1))
super(BallooningTest, self).__init__(test, params, env) super(BallooningTest, self).__init__(test, params, env)
self.vm = env.get_vm(params["main_vm"]) self.vm = env.get_vm(params["main_vm"])
...@@ -183,19 +182,20 @@ class BallooningTest(MemoryBaseTest): ...@@ -183,19 +182,20 @@ class BallooningTest(MemoryBaseTest):
max_size = self.ori_mem max_size = self.ori_mem
min_size = self.params.get("minmem", "512M") min_size = self.params.get("minmem", "512M")
min_size = int(float(utils_misc.normalize_data_size(min_size))) min_size = int(float(utils_misc.normalize_data_size(min_size)))
balloon_buffer = self.params.get("balloon_buffer", 300)
if self.params.get('os_type') == 'windows': if self.params.get('os_type') == 'windows':
logging.info("Get windows miminum balloon value:") logging.info("Get windows miminum balloon value:")
self.vm.balloon(1) self.vm.balloon(1)
balloon_timeout = self.params.get("balloon_timeout", 900) balloon_timeout = self.params.get("balloon_timeout", 900)
self.wait_for_balloon_complete(balloon_timeout) self.wait_for_balloon_complete(balloon_timeout)
used_size = int(self.get_ballooned_memory() + self.ratio * self.ori_mem) used_size = min((self.get_ballooned_memory() + balloon_buffer), max_size)
self.vm.balloon(max_size) self.vm.balloon(max_size)
self.wait_for_balloon_complete(balloon_timeout) self.wait_for_balloon_complete(balloon_timeout)
self.ori_gmem = self.get_memory_status() self.ori_gmem = self.get_memory_status()
else: else:
vm_total = self.get_memory_status() vm_total = self.get_memory_status()
vm_mem_free = self.get_free_mem() vm_mem_free = self.get_free_mem()
used_size = vm_total - vm_mem_free + 16 used_size = min((self.ori_mem - vm_mem_free + balloon_buffer), max_size)
if balloon_type == "enlarge": if balloon_type == "enlarge":
min_size = self.current_mmem min_size = self.current_mmem
elif balloon_type == "evict": elif balloon_type == "evict":
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
balloon_dev_add_bus = yes balloon_dev_add_bus = yes
iterations = 5 iterations = 5
free_mem_cmd = cat /proc/meminfo |grep MemFree free_mem_cmd = cat /proc/meminfo |grep MemFree
Linux:
ratio = 1
Windows:
ratio = 0.5
variants: variants:
- balloon_base: - balloon_base:
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
free_mem_cmd = cat /proc/meminfo |grep MemFree free_mem_cmd = cat /proc/meminfo |grep MemFree
reboot_method = shell reboot_method = shell
shutdown_method = shell shutdown_method = shell
Linux:
ratio = 1
Windows:
ratio = 0.5
run_sub_test_after_balloon = no run_sub_test_after_balloon = no
test_tags = "evict enlarge" test_tags = "evict enlarge"
balloon_type_evict = evict balloon_type_evict = evict
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
balloon_dev_devid = balloon0 balloon_dev_devid = balloon0
balloon_dev_add_bus = yes balloon_dev_add_bus = yes
free_mem_cmd = cat /proc/meminfo | grep MemFree free_mem_cmd = cat /proc/meminfo | grep MemFree
Linux:
ratio = 1
Windows:
ratio = 0.5
illegal_value_check = yes illegal_value_check = yes
test_tags = "evict enlarge" test_tags = "evict enlarge"
balloon_type_evict = evict balloon_type_evict = evict
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
balloon_dev_devid = balloon0 balloon_dev_devid = balloon0
balloon_dev_add_bus = yes balloon_dev_add_bus = yes
repeat_times = 5 repeat_times = 5
ratio = 0.5
wait_bg_time = 720 wait_bg_time = 720
time_for_video = 600 time_for_video = 600
start_vm = yes start_vm = yes
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
set_balloon_property = "guest-stats-polling-interval" set_balloon_property = "guest-stats-polling-interval"
get_balloon_property = "guest-stats" get_balloon_property = "guest-stats"
polling_sleep_time = 20 polling_sleep_time = 20
ratio = 0.1
run_sub_test_after_balloon = no run_sub_test_after_balloon = no
test_tags = "evict enlarge" test_tags = "evict enlarge"
balloon_type_evict = evict balloon_type_evict = evict
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
play_video_cmd = '"%s" "%s" /play /fullscreen' play_video_cmd = '"%s" "%s" /play /fullscreen'
time_for_video = 1200 time_for_video = 1200
guest_alias = "Win2008-sp2-32:2k8\x86,Win2008-sp2-64:2k8\amd64,Win2008-r2-64:2k8\amd64,Win2012-64:2k12\amd64,Win2012-64r2:2k12\amd64" guest_alias = "Win2008-sp2-32:2k8\x86,Win2008-sp2-64:2k8\amd64,Win2008-r2-64:2k8\amd64,Win2012-64:2k12\amd64,Win2012-64r2:2k12\amd64"
ratio = 0.5
Linux: Linux:
# Use a low stress to make sure guest can response during stress # Use a low stress to make sure guest can response during stress
stress_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M" stress_args = "--cpu 4 --io 4 --vm 2 --vm-bytes 256M"
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
run_bgstress = balloon_check run_bgstress = balloon_check
virtio_balloon_pause = 10.0 virtio_balloon_pause = 10.0
free_mem_cmd = cat /proc/meminfo |grep MemFree free_mem_cmd = cat /proc/meminfo |grep MemFree
ratio = 0.5
run_sub_test_after_balloon = no run_sub_test_after_balloon = no
test_tags = "evict enlarge" test_tags = "evict enlarge"
balloon_type_evict = evict balloon_type_evict = evict
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册