-
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
memory: add case for hugepage mount path #4984
memory: add case for hugepage mount path #4984
Conversation
b90d766
to
7a95e76
Compare
7a95e76
to
4177644
Compare
modular_redesign |
4177644
to
b96985d
Compare
b96985d
to
ee6dc4b
Compare
virsh.destroy(vm_name, ignore_status=False) | ||
|
||
test.log.info("TEST_STEP13: Restart service") | ||
process.run("systemctl restart %s" % libvirtd.service_name, shell=True) |
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 restarting a service, usually we do not use process.run(). Have you tried utils_libvirtd.Libvirtd() ?
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, same as #4984 (comment) ,Could check ,thank you
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.
See 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.
Please see my reply #4984 (comment)
test.log.info("TEST_STEP11: Check mem") | ||
session = vm.wait_for_login() | ||
mem_free = utils_memory.freememtotal(session) | ||
status, stdout = session.cmd_status_output("swapoff -a; memhog %s" % ( |
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.
Could you try libvirt_memory.consume_vm_freememory()
?
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 , def consume_vm_freememory
has a hard code and for memhog %10000k
, so I make a enhance by avocado-framework/avocado-vt#3767
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
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
return | ||
|
||
test.log.info("TEST_STEP7: Stop services") | ||
utils_libvirtd.libvirtd_stop() |
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 function is already with deprecation warning. Please use utils_libvirtd.libvirtd().stop() instead.
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 ,done
process.run("ps -ef | grep qemu | grep prealloc > %s" % out_file, | ||
shell=True) | ||
for item in check_qemu: | ||
libvirt.check_logfile(item, out_file) |
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.
Line 83 - 86, for checking qemu command line, there is libvirt.check_qemu_cmd_line(), but it only supports to search one pattern a time. Could you consider to reuse it? Or if you could enhance that function to support checking a list of patterns, that will be appreciated.
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, enhance by avocado-framework/avocado-vt#3767
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
if case == "disabled": | ||
return | ||
|
||
test.log.info("TEST_STEP3: Start guest 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.
Remove one '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.
Done
|
||
test.log.info("TEST_STEP2: Restart libvirt service") | ||
libvirtd = utils_libvirtd.Libvirtd() | ||
process.run("systemctl restart %s" % libvirtd.service_name, shell=True) |
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.
Could you explain the reason you do not use libvirtd.restart() ?
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, becausedef libvirtd.restart()
has invoked result.append(self._wait_for_start())
, it is always checking the virsh list
for until service active , however the TEST_STEP1
has modified by the huge page mount path invalid config for some scenarios , which makes the virsh list does not work
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.
Ok, I understand.
But I think it is a good time to enhance this function.
For example, we add a new option to disable the checking. When we do not care about the result with wait_for_start=False, it will always return True. And then users need to check the service status using xxx.is_running() by themselves. How about?
def restart(self, reset_failed=True, wait_for_start=True):
result = []
for daem_item in self.daemons:
if reset_failed:
daem_item.reset_failed()
if not daem_item.restart():
return False
if wait_for_start:
result.append(self._wait_for_start())
return all(result)
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.
@Yingshun @chloerh @chunfuwen What's your opinion?
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.
@dzhengfy
The restart function expect to work in very simple way since we hope it can return as soon as possible.
Moreover, the return result expect simple as much as we can,otherwise it need upstream code(caller) to handle different return type.
Another alternatives is to override another function if we really find it is more of common use cases
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 all, Done
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.
@dzhengfy The restart function expect to work in very simple way since we hope it can return as soon as possible. Moreover, the return result expect simple as much as we can,otherwise it need upstream code(caller) to handle different return type. Another alternatives is to override another function if we really find it is more of common use cases
I checked in tp-libvirt for the usage of restart(), and I did not find any caller to use the return value of this function. So I am wondering if we really need this return. Then I value this different return type as low risk. We can add docstring or comment to make the users be aware of this difference when they use this new parameter.
if case != "default": | ||
qemu_obj = libvirt.customize_libvirt_config( | ||
{"hugetlbfs_mount": '"%s"' % hugetlbfs_mount}, "qemu", | ||
restart_libvirt=False) |
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.
Could you explain the reason you do not use restart_libvirt=True
in this function to restart libvirtd daemon?
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, because we need to restart libvirt as a obvious step in Step2
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_name) | ||
vmxml.setup_attrs(**vm_attrs) | ||
virsh.define(vmxml.xml, debug=True, ignore_status=False) | ||
test.log.debug("Define xml by :\n%s " % vmxml) |
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.
'%' -> ','
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.
Done
|
||
hp_cfg = test_setup.HugePageConfig(params) | ||
hp_cfg.cleanup() | ||
process.run("mount -t hugetlbfs hugetlbfs %s" % default_path, |
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.
Could you use
hp_cfg.hugepage_path = default_path
hp_cfg.mount_hugepage_fs()
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.
Done
c24702c
to
848336c
Compare
|
||
test.log.info("TEST_STEP4: Check the qemu cmd line") | ||
for item in check_qemu: | ||
# libvirt.check_logfile(item, out_file) |
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.
Remove this line, thanks
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.
DONE
test.log.info("TEST_STEP4: Check the qemu cmd line") | ||
for item in check_qemu: | ||
# libvirt.check_logfile(item, out_file) | ||
libvirt.check_qemu_cmd_line(item) |
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.
With avocado-framework/avocado-vt#3767, we should invoke this function by libvirt.check_qemu_cmd_line(check_qemu) directly because list is supported, right?
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 your reminder,Done
848336c
to
c45bab7
Compare
VIRT-297104: Huge page mount path Signed-off-by: nanli <[email protected]>
c45bab7
to
cf7da46
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
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
VIRT-297104: Huge page mount path
Signed-off-by: nanli [email protected]
Depend on