tp-libvirt
tp-libvirt copied to clipboard
Fix failed to open file '/var/tmp/xml_utils_temp_88tre3pp.xml' issue
Fix failed to open file '/var/tmp/xml_utils_temp_88tre3pp.xml' issue python gc may quickly recycle disk object, although disk has one attribute disk.xml,which points to existed file.
So the solution to this is to copy out original disk xml
Signed-off-by: chunfuwen [email protected]
previously failed log
2022-11-25 18:07:38,139 stacktrace L0045 ERROR| run_func(self, params, env) 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| File "/var/lib/avocado/data/avocado-vt/virttest/test-providers.d/downloads/io-github-autotest-libvirt/libvirt/tests/src/virtual_disks/virtual_disks_rotation_rate.py", line 101, in run 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| virsh.detach_device(vm_name, disk_xml, debug=True, ignore_status=False) 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| File "/var/ci/libvirt-ci/runtest/avocado-vt/avocado-vt/virttest/virsh.py", line 738, in wrapper 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| return func(*args, **kwargs) 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| File "/var/ci/libvirt-ci/runtest/avocado-vt/avocado-vt/virttest/virsh.py", line 1800, in detach_device 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| detach_cmd_rv = _adu_device("detach-device", domainarg=domainarg, filearg=filearg, 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| File "/var/ci/libvirt-ci/runtest/avocado-vt/avocado-vt/virttest/virsh.py", line 1759, in _adu_device 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| return command(cmd, **dargs) 2022-11-25 18:07:38,139 stacktrace L0045 ERROR| File "/var/ci/libvirt-ci/runtest/avocado-vt/avocado-vt/virttest/virsh.py", line 816, in command 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| ret = process.run(cmd, timeout=timeout, verbose=debug, 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| File "/var/ci/libvirt-ci/runtest/avocado-vt/avocado/avocado/utils/process.py", line 1093, in run 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| raise CmdError(cmd, sp.result) 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| avocado.utils.process.CmdError: Command '/bin/virsh detach-device avocado-vt-vm1 /var/tmp/xml_utils_temp_88tre3pp.xml' failed. 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| stdout: b'\n' 2022-11-25 18:07:38,140 stacktrace L0045 ERROR| stderr: b"error: Failed to open file '/var/tmp/xml_utils_temp_88tre3pp.xml': No such file or directory\n"
Command 'virsh list' finished with 0 after 0.028771795s cleaning libvirtd logs... DATA (filename=output.expected) => NOT FOUND (data sources: variant, test, file) DATA (filename=stdout.expected) => NOT FOUND (data sources: variant, test, file) DATA (filename=stderr.expected) => NOT FOUND (data sources: variant, test, file) PASS 1-type_specific.io-github-autotest-libvirt.virtual_disks.rotation_rate.positive_test.at_dt.scsi_bus
@chunfuwen Would you expect this could happen in all test scripts that use libvirt.create_disk_xml(disk_dict)
? If so, would it be more helpful to have the solution there in avocado-vt?
@smitterl , libvirt.create_disk_xml(disk_dict) is heavily used across different python files, the root clause could be in libvirt.create_disk_xml(disk_dict) itself, but we do see very few happening in other places. So here I just fix it case by case to avoid impact on libvirt.create_disk_xml() itself
@smitterl your comment is replied, please double check
@smitterl please check replied comment
@smitterl please check replied comment
Sorry for the late response. Ack'd Thank you