-
Notifications
You must be signed in to change notification settings - Fork 170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add case for period config of memballoon #5206
add case for period config of memballoon #5206
Conversation
07b51e8
to
27b0b7c
Compare
time.sleep(5) | ||
else: | ||
usable_mem = re.findall(r'usable (\d+)', res)[0] | ||
last_update = re.findall(r'last_update (\d+)', res)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider wait_for()? Something like:
def func():
res = virsh.dommemstat(vm_name, ignore_status=False,
debug=True).stdout_text
return re.findall(r'usable (\d+)', res) is not None
if not utils_misc.wait_for(func, 25, 5):
return
usable_mem = re.findall(r'usable (\d+)', res)[0]
last_update = re.findall(r'last_update (\d+)', res)[0]
disk_caches = re.findall(r'disk_caches (\d+)', res)[0]
return xxxx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what happened when we couldn't get the value we expect after 25s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks haijiao ,Sorry for late updating ,Updated as you said.
check_same_value(last_update_new, last_update, "last update") | ||
check_same_value(disk_caches_new, disk_caches, "disk caches") | ||
|
||
elif period_config.isdigit() and period_config.isdigit() != "0": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
period_config != "0"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks haijiao , Updated
vmxml.del_device('memballoon', by_tag=True) | ||
mem_balloon = memballoon.Memballoon() | ||
mem_balloon.setup_attrs(**device_dict) | ||
vmxml.devices = vmxml.devices.append(mem_balloon) | ||
|
||
vmxml.setup_attrs(**mem_attrs) | ||
vmxml.sync() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about after removing memballoon device, we use libvirt_vmxml.modify_vm_device()
to add new memballoon device, and maybe move vmxml.setup_attrs(**mem_attrs)
to the front to avoid sync failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks haijiao , Updated :D
27b0b7c
to
57d60fb
Compare
57d60fb
to
8336071
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others LGTM
test.log.info("TEST_STEP5: Do memory operation and check dommemstat") | ||
session = vm.wait_for_login() | ||
status, stdout = session.cmd_status_output(mem_operation) | ||
session.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to repeat vm.wait_for_login() and session.close() ? Could we reuse a vm session in line 104?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks dzheng, Done
usable_mem_3, last_update_3, disk_caches_3 = get_memory_statistics() | ||
session = vm.wait_for_login() | ||
status, stdout = session.cmd_status_output(mem_operation) | ||
session.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks dzheng, Done
Define and start guest | ||
Check memTotal and memory allocation | ||
""" | ||
test.log.info("TEST_STEP1: Define guest") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not accuate.
test.log.info("TEST_STEP6: Change the period setting") | ||
virsh.dommemstat(vm_name, period_cmd, ignore_status=False, debug=True) | ||
|
||
test.log.info("TEST_STEP7: Repeat consume mem and check memory " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this log correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks dzheng, Done
8336071
to
11231e6
Compare
usable_mem_1, last_update_1, disk_caches_1 = get_memory_statistics() | ||
|
||
test.log.info("TEST_STEP5: Do memory operation and check dommemstat") | ||
session = vm.wait_for_login() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we reuse the session in line 104?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks dzheng, updated, :D
test.log.info("TEST_STEP6: Change the period setting") | ||
virsh.dommemstat(vm_name, period_cmd, ignore_status=False, debug=True) | ||
|
||
test.log.info("TEST_STEP7: Repeat TEST_STEP3-5") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For below repeating steps 3-5, please wrap up the steps into another function instead of duplicating many codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks dzheng, updated, :D
VIRT-299028: Period config of memory balloon Signed-off-by: nanli <[email protected]>
11231e6
to
f10246a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: nanli [email protected]
avocado-framework/avocado-vt#3768
RHE9 & RHEL8+x86
RHE9+Aarch64