canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.38k stars 931 forks source link

lxc image import (split images (VM)) creates a too large temporary file #10765

Closed lukts30 closed 2 years ago

lukts30 commented 2 years ago

Required information

Issue description

I am trying to import a Windows VM image (38GB) but the import fails because lxc runs out of space during importing a split image.

lxc image import metadata.tar.gz WindowsVM_UEFI_VIRTIO.qcow2 --alias Win11
Error: write /tmp/lxc_image_710211666: no space left on device`

This problem is similar to https://github.com/lxc/lxd/issues/7561 but in this case lxc image import and not lxc import is used.

https://github.com/lxc/lxd/blob/fee89073a8bf865a04cd9175bb39fa41040cab80/client/lxd_images.go#L420

tomponline commented 2 years ago

The difference/difficulty here is that this is in the client package and so cannot use LXD's image volume for temporary unpacking.

stgraber commented 2 years ago

@tomponline I wonder, is there some way we can do this in a streaming manner, so without having to write the whole thing to tmp first?