tp-libvirt icon indicating copy to clipboard operation
tp-libvirt copied to clipboard

Fix failed to open file '/var/tmp/xml_utils_temp_88tre3pp.xml' issue

Open chunfuwen opened this issue 2 years ago • 2 comments

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]

chunfuwen avatar Dec 12 '22 06:12 chunfuwen

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"

chunfuwen avatar Dec 12 '22 06:12 chunfuwen

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 avatar Dec 12 '22 06:12 chunfuwen

@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 avatar Dec 13 '22 08:12 smitterl

@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

chunfuwen avatar Dec 21 '22 08:12 chunfuwen

@smitterl your comment is replied, please double check

chunfuwen avatar Jan 09 '23 02:01 chunfuwen

@smitterl please check replied comment

chunfuwen avatar Feb 09 '23 02:02 chunfuwen

@smitterl please check replied comment

Sorry for the late response. Ack'd Thank you

smitterl avatar Feb 09 '23 10:02 smitterl