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.
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.