Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pylintrc_utils
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension-pkg-whitelist=netifaces
# TO BE REMOVED:
# utils_scheduling.py (will be deleted from codebase)
#
ignore=CVS,accessors.py,address.py,aexpect.py,ah_ipv6.py,ah.py,all_ipv6.py,all.py,arch.py,arp.py,asset.py,audio.py,backup_xml.py,base_installer.py,base.py,block.py,block_volume.py,bootstrap.py,boottool.py,bridge.py,build_helper.py,capability_xml.py,cartesian_config.py,cb.py,ceph.py,channel.py,character.py,check_cpu_flag.py,checkpoint_xml.py,cmd_runner.py,compat.py,console.py,controller.py,core.py,cpu.py,curl.py,data_dir.py,dd.py,defaults.py,dir_pool.py,dir_volume.py,disk.py,domcapability_xml.py,drive.py,duplicate_pages.py,emulator.py,env_process.py,error_context.py,error_event.py,esp_ipv6.py,esp.py,filesystem.py,file_volume.py,filterref.py,funcatexit.py,gcov.py,gluster.py,graphical_console.py,graphics.py,guest_agent.py,hostdev.py,http_server.py,hub.py,icmp.py,icmpv6.py,idmap_xml.py,igmp.py,__init__.py,input.py,installer.py,interface.py,interrupted_thread.py,iommu.py,ip.py,ip_sniffing.py,ipv6.py,iscsi.py,kernelinstall.py,kernel_interface.py,kernel.py,key_event_form.py,ksm_overcommit_guest.py,lease.py,libguestfs.py,librarian.py,libvirt_bios.py,libvirt_ceph_utils.py,libvirt_cgroup.py,libvirt_config.py,libvirt_cpu.py,libvirtd_decorator.py,libvirt_device_utils.py,libvirt_disk.py,libvirt_domjobinfo.py,libvirt_embedded_qemu.py,libvirt_filesystem.py,libvirt_installer.py,libvirt_keywrap.py,libvirt_memory.py,libvirt_misc.py,libvirt_monitor.py,libvirt_nested.py,libvirt_network.py,libvirt_numa.py,libvirt_nwfilter.py,libvirt_pcicontr.py,libvirt.py,libvirt_remote.py,libvirt_secret.py,libvirt_service.py,libvirt_setup.py,libvirt_storage.py,libvirt_unprivileged.py,libvirt_usb.py,libvirt_version.py,libvirt_vfio.py,libvirt_virtio.py,libvirt_vm.py,libvirt_vmxml.py,logger.py,logging_manager.py,lvm.py,lvsb_base.py,lvsb.py,lvsbs.py,lv_utils.py,mac.py,macvtap.py,memballoon.py,memory.py,messenger.py,migration.py,migration_template.py,mock.py,multicast_guest.py,nbd.py,netperf_agent.py,net_volume.py,networking.py,network_xml.py,nfs_pool.py,nfs.py,nfs_volume.py,nodedev_xml.py,node_properties.py,node.py,nvme.py,nvram.py,nwfilter_binding.py,nwfilter_xml.py,openvswitch.py,os_posix.py,ovirt.py,ovs.py,ovs_utils.py,panic.py,parallel.py,pci_utils.py,pmsocat36.py,png_utils.py,pool.py,pool_selector.py,pool_xml.py,port_resource.py,postprocess_iozone.py,ppc.py,ppm_utils.py,propcan.py,proxy.py,pstore.py,qcontainer.py,qdevice_format.py,qdevices.py,qemu_capabilities.py,qemu_installer.py,qemu_io.py,qemu_migration.py,qemu_monitor.py,qemu_qtree.py,qemu_storage.py,qemu_utils.py,qemu_virtio_port.py,qemu_vm.py,rarp.py,redirdev.py,redirfilter.py,remote_build.py,remote_interface.py,remote_master.py,remote.py,remote_runner.py,requirement_checks.py,resource_manager.py,resource.py,RFBDes.py,rng_egd.py,rng.py,scan_autotest_results.py,scheduler.py,sctp_ipv6.py,sctp.py,seclabel.py,secret_xml.py,selector.py,serial_host_send_receive.py,serial.py,service.py,set_win_promisc.py,sev.py,shmem.py,smartcard.py,snapshot_xml.py,sound.py,ssh_key.py,standalone_test.py,step_editor.py,storage.py,storage_ssh.py,stp.py,syslog_server.py,system.py,sys_time.py,tap_network.py,tap_port.py,tap.py,tcp_ipv6.py,tcp.py,telnet.py,test_controller_xml.py,test_interface_xml.py,test_memory_xml.py,test_network_xml.py,test_utils_kernel_module.py,test_utils_misc.py,test_utils_test__init__.py,test_utils_zchannels.py,test_utils_zcrypt.py,test_vm_xml.py,tool.py,tpm.py,udp_ipv6.py,udplite_ipv6.py,udplite.py,udp.py,unattended_install.py,utils_backup.py,utils_cgroup.py,utils_config.py,utils_conn.py,utils_cpi.py,utils_disk.py,utils_env.py,utils_gdb.py,utils_hotplug.py,utils_ids.py,utils_iptables.py,utils_kernel_module.py,utils_koji.py,utils_libguestfs.py,utils_libvirtd.py,utils_linux_modules.py,utils_logfile.py,utils_memory.py,utils_misc.py,utils_nbd.py,utils_netperf.py,utils_net.py,utils_npiv.py,utils_numeric.py,utils_package.py,utils_params.py,utils.py,utils_pyvmomi.py,utils_qemu.py,utils_sasl.py,utils_scheduling.py,utils_selinux.py,utils_spice.py,utils_split_daemons.py,utils_sriov.py,utils_stress.py,utils_switchdev.py,utils_sys.py,utils_time.py,utils_v2v.py,utils_vdpa.py,utils_version.py,utils_virtio_port.py,utils_vsock.py,utils_zchannels.py,utils_zcrypt.py,vdpa_blk.py,verify.py,versionable_class.py,version.py,vhost_user_blk.py,video_maker.py,video.py,virsh.py,virt_admin.py,VirtIoChannel_guest_send_receive.py,virtio_console_guest.py,virtio_win.py,virt_vm.py,vlan.py,vms.py,vm_xml.py,volume.py,vol_xml.py,vsock.py,vt_console.py,vt_iothread.py,wait_for_quit.py,watchdog.py,windows_support.py,wmic.py,_wrappers.py,xcepts.py,xml_utils.py,yumrepo.py
ignore=CVS,accessors.py,address.py,aexpect.py,ah_ipv6.py,ah.py,all_ipv6.py,all.py,arch.py,arp.py,asset.py,audio.py,backup_xml.py,base_installer.py,base.py,block.py,block_volume.py,bootstrap.py,boottool.py,bridge.py,build_helper.py,capability_xml.py,cartesian_config.py,cb.py,ceph.py,channel.py,character.py,check_cpu_flag.py,checkpoint_xml.py,cmd_runner.py,compat.py,console.py,controller.py,core.py,cpu.py,curl.py,data_dir.py,dd.py,defaults.py,dir_pool.py,dir_volume.py,disk.py,domcapability_xml.py,drive.py,duplicate_pages.py,emulator.py,env_process.py,error_context.py,error_event.py,esp_ipv6.py,esp.py,filesystem.py,file_volume.py,filterref.py,funcatexit.py,gcov.py,gluster.py,graphical_console.py,graphics.py,guest_agent.py,hostdev.py,http_server.py,hub.py,icmp.py,icmpv6.py,idmap_xml.py,igmp.py,__init__.py,input.py,installer.py,interface.py,interrupted_thread.py,iommu.py,ip.py,ip_sniffing.py,ipv6.py,iscsi.py,kernelinstall.py,kernel_interface.py,kernel.py,key_event_form.py,ksm_overcommit_guest.py,lease.py,libguestfs.py,librarian.py,libvirt_bios.py,libvirt_ceph_utils.py,libvirt_cgroup.py,libvirt_config.py,libvirt_cpu.py,libvirtd_decorator.py,libvirt_device_utils.py,libvirt_disk.py,libvirt_domjobinfo.py,libvirt_embedded_qemu.py,libvirt_filesystem.py,libvirt_installer.py,libvirt_keywrap.py,libvirt_memory.py,libvirt_misc.py,libvirt_monitor.py,libvirt_nested.py,libvirt_network.py,libvirt_numa.py,libvirt_nwfilter.py,libvirt_pcicontr.py,libvirt.py,libvirt_remote.py,libvirt_secret.py,libvirt_service.py,libvirt_setup.py,libvirt_storage.py,libvirt_unprivileged.py,libvirt_usb.py,libvirt_version.py,libvirt_vfio.py,libvirt_virtio.py,libvirt_vm.py,libvirt_vmxml.py,logger.py,logging_manager.py,lvm.py,lvsb_base.py,lvsb.py,lvsbs.py,lv_utils.py,mac.py,macvtap.py,memballoon.py,memory.py,messenger.py,migration.py,migration_template.py,mock.py,multicast_guest.py,nbd.py,netperf_agent.py,net_volume.py,networking.py,network_xml.py,nfs_pool.py,nfs.py,nfs_volume.py,nodedev_xml.py,node_properties.py,node.py,nvme.py,nvram.py,nwfilter_binding.py,nwfilter_xml.py,openvswitch.py,os_posix.py,ovirt.py,ovs.py,ovs_utils.py,panic.py,parallel.py,pci_utils.py,pmsocat36.py,png_utils.py,pool.py,pool_selector.py,pool_xml.py,port_resource.py,postprocess_iozone.py,ppc.py,ppm_utils.py,propcan.py,proxy.py,pstore.py,qcontainer.py,qdevice_format.py,qdevices.py,qemu_capabilities.py,qemu_installer.py,qemu_io.py,qemu_migration.py,qemu_monitor.py,qemu_qtree.py,qemu_storage.py,qemu_utils.py,qemu_virtio_port.py,qemu_vm.py,rarp.py,redirdev.py,redirfilter.py,remote_build.py,remote_interface.py,remote_master.py,remote.py,remote_runner.py,requirement_checks.py,resource_manager.py,resource.py,RFBDes.py,rng_egd.py,rng.py,scan_autotest_results.py,scheduler.py,sctp_ipv6.py,sctp.py,seclabel.py,secret_xml.py,selector.py,serial_host_send_receive.py,serial.py,service.py,set_win_promisc.py,sev.py,shmem.py,smartcard.py,snapshot_xml.py,sound.py,ssh_key.py,standalone_test.py,step_editor.py,storage.py,storage_ssh.py,stp.py,syslog_server.py,system.py,sys_time.py,tap_network.py,tap_port.py,tap.py,tcp_ipv6.py,tcp.py,telnet.py,test_controller_xml.py,test_interface_xml.py,test_memory_xml.py,test_network_xml.py,test_utils_kernel_module.py,test_utils_misc.py,test_utils_test__init__.py,test_utils_zchannels.py,test_utils_zcrypt.py,test_vm_xml.py,tool.py,tpm.py,udp_ipv6.py,udplite_ipv6.py,udplite.py,udp.py,unattended_install.py,utils_backup.py,utils_cgroup.py,utils_config.py,utils_conn.py,utils_cpi.py,utils_disk.py,utils_env.py,utils_gdb.py,utils_hotplug.py,utils_ids.py,utils_iptables.py,utils_kernel_module.py,utils_koji.py,utils_libguestfs.py,utils_libvirtd.py,utils_linux_modules.py,utils_logfile.py,utils_memory.py,utils_misc.py,utils_nbd.py,utils_netperf.py,utils_net.py,utils_npiv.py,utils_numeric.py,utils_package.py,utils_params.py,utils.py,utils_pyvmomi.py,utils_qemu.py,utils_sasl.py,utils_scheduling.py,utils_selinux.py,utils_spice.py,utils_split_daemons.py,utils_sriov.py,utils_stress.py,utils_switchdev.py,utils_sys.py,utils_time.py,utils_v2v.py,utils_vdpa.py,utils_version.py,utils_virtio_port.py,utils_vsock.py,utils_zchannels.py,utils_zcrypt.py,vdpa_blk.py,verify.py,versionable_class.py,version.py,vhost_user_blk.py,video_maker.py,video.py,virsh.py,virt_admin.py,VirtIoChannel_guest_send_receive.py,virtio_console_guest.py,virtio_win.py,virt_vm.py,vlan.py,vms.py,vm_xml.py,volume.py,vol_xml.py,vsock.py,vt_console.py,vt_iothread.py,wait_for_quit.py,watchdog.py,windows_support.py,wmic.py,_wrappers.py,xcepts.py,xml_utils.py,yumrepo.py,dump_file.py,guest_dump_file_manager.py

# regex matches against base names, not paths.
ignore-patterns=.git
Expand Down
13 changes: 13 additions & 0 deletions virttest/env_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
cpu,
data_dir,
error_context,
guest_dump_file_manager,
libvirt_version,
png_utils,
ppm_utils,
Expand All @@ -45,6 +46,7 @@
from virttest._wrappers import lazy_import
from virttest.test_setup.aexpect import KillTailThreads
from virttest.test_setup.core import SetupManager
from virttest.test_setup.dump_file import DumpFileSetup
from virttest.test_setup.gcov import (
ResetGCov,
collect_gcovr_coverage,
Expand Down Expand Up @@ -645,6 +647,8 @@ def postprocess_vm(test, params, env, name):
if not vm:
return

_mgr = guest_dump_file_manager.get_dump_file_mgr(params.get("vm_type"))

Comment on lines +650 to +651
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Manager instantiated unconditionally for every VM postprocess.

get_dump_file_mgr is called at the top of postprocess_vm for every test, even when dumping_guest_memory is not configured. This is unnecessary overhead and creates a cached singleton as a side-effect. Move the call inside the conditional block at line 714 where it's actually needed.

Proposed fix
-    _mgr = guest_dump_file_manager.get_dump_file_mgr(params.get("vm_type"))
-
     if params.get("start_vm") == "yes":

Then at lines 714-718:

             if params.get("dumping_guest_memory", "") == "offline":
+                _mgr = guest_dump_file_manager.get_dump_file_mgr(params.get("vm_type"))
-            if params.get("dumping_guest_memory", "") == "offline" and _mgr:
+                if _mgr:
                     base_dir = params.get("images_base_dir", data_dir.get_data_dir())
🤖 Prompt for AI Agents
In `@virttest/env_process.py` around lines 646 - 647, The call that instantiates
the dump file manager (_mgr =
guest_dump_file_manager.get_dump_file_mgr(params.get("vm_type"))) should not run
unconditionally at the top of postprocess_vm; move this call into the branch
that checks dumping_guest_memory so the manager is only obtained when needed
(i.e., inside the conditional that uses _mgr later), and ensure any subsequent
uses of _mgr (the code that writes or cleans up guest memory dumps) still
reference the moved variable and handle a None/absent manager safely; remove the
top-level call to avoid the cached singleton side-effect and keep the variable
scoped to the dumping_guest_memory path.

if params.get("start_vm") == "yes":
# recover the changes done to kernel params in postprocess
serial_login = params.get_boolean("kernel_extra_params_serial_login")
Expand Down Expand Up @@ -711,6 +715,14 @@ def postprocess_vm(test, params, env, name):
if vm.devices is not None:
vm.devices.cleanup_daemons()

base_dir = params.get("images_base_dir", data_dir.get_data_dir())
_img = params.objects("images")[0]
_sys_image = qemu_storage.QemuImg(params, base_dir, _img)
try:
_mgr.extract_dump_files(params, test.outputdir, _sys_image.image_filename)
except Exception:
LOG.debug("Dump-file collection failed")

if params.get("enable_strace") == "yes":
strace = test_setup.StraceQemu(test, params, env)
strace.stop()
Expand Down Expand Up @@ -1033,6 +1045,7 @@ def preprocess(test, params, env):
_setup_manager.register(TransparentHugePagesSetup)
_setup_manager.register(KSMSetup)
_setup_manager.register(EGDSetup)
_setup_manager.register(DumpFileSetup)
_setup_manager.do_setup()

vm_type = params.get("vm_type")
Expand Down
Loading
Loading