Public bug reported:

Nova LXD driver contains a disk usage resource leak.
Each disk image import from Glance leads to O(image_size) disk space lost in 
Leak exists until nova-compute service is restarted as during restart open 
descriptors will be freed and disk space will reclaimed by OS.

The reason is wrong usage of mkstemp in nova/virt/lxd/ 
The code use mkstemp to generate "random" filename to pass to glance API as 
destination path for downloaded image. But mkstemp also open file description 
to this file which is lost and never closed. As result even when this temporary 
file (downloaded image) is deleted file is still locked by nova-compute process.

def _sync_glance_image_to_lxd(client, context, image_ref):
        image_file = tempfile.mkstemp()[1]
        # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        # in code above we lost msktemp[0] of tuple which is open file handle
        # so file never be 'freed' until process finished
..., image_ref, dest_path=image_file) 

** Affects: nova-lxd (Ubuntu)
     Importance: Undecided
         Status: New

You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

  Disk usage leak on image import

To manage notifications about this bug go to:

ubuntu-bugs mailing list

Reply via email to