avocado-framework / avocado-vt

Avocado VT Plugin
https://avocado-vt.readthedocs.org/
Other
83 stars 241 forks source link

libvirt.py -- Fix create_disk_xml() sometimes creates inaccessible file #3940

Closed Slancaster1 closed 2 months ago

Slancaster1 commented 2 months ago

The Issue

create_disk_xml() uses a disk.Disk() object to create a disk XML file. The disk.Disk() object, deletes the underlying XML when the object is garbage collected. The create_disk_xml() function only returns the XML filename, not the entire disk.Disk() object. As a result, the disk.Disk() object is garbage collected, and the underlying XML file is deleted.

This will result in any access to the XML file failing after a garbage collection cycle has been run.

The Solution

Copy the contents of the XML file into a more permanent file.

chloerh commented 2 months ago

"signed-off" missing in commit msg.

Slancaster1 commented 2 months ago

"signed-off" missing in commit msg.

Oops :facepalm: Fixed it!