virt-lightning / virt-lightning

Starts your VM on libvirt in a couple of seconds!
185 stars 43 forks source link

better support VM image file extensions for config.ini private_hub= #284

Closed jerzerisz closed 8 months ago

jerzerisz commented 8 months ago

First noticed this trying FreeBSD-14 alpha, their images are compressed: https://download.freebsd.org/releases/VM-IMAGES/14.0-BETA5/amd64/Latest/FreeBSD-14.0-BETA5-amd64-zfs.qcow2.xz

I figured so be it, however Ubuntu feels the need to play file extensions: [ ] mantic-server-cloudimg-amd64.img 2023-10-09 15:18 743M QCow2 UEFI/GPT Bootable disk image

It's simple enough to work around: curl -o /var/lib/virt-lightning/pool/upstream/ubuntu-23-10.qcow2 https://cloud-images.ubuntu.com/mantic/current/mantic-server-cloudimg-amd64.img

Doesn't look like it would be terribly hard to adjust: https://github.com/virt-lightning/virt-lightning/blob/e6e6ae2082a9457e2e480cbaa77b0fb7c9576d3d/virt_lightning/api.py#L443 for some limited support (.img/.xz compressed) files.

Certainly a niche issue, but any thoughts?

goneri commented 8 months ago

Hi @jerzerisz!

The .img extension of the Ubuntu images is not really a problem. There is already a redirection in place, See: https://github.com/virt-lightning/virt-lightning/blob/main/virt-lightning.org/etc/caddy/conf.d/virt-lightning.org.conf#L44-L53

For the .xz extension of the FreeBSD image, it's a bit more complicated. But the first problem is that they don't include cloud-init in their images. We won't be able to configure the VM when it starts. The images from https://bsd-cloud-image.org/ come with cloud-init and work fine.

jerzerisz commented 8 months ago

I was specifically thinking about the ~/.config/virt-lightning/config.ini file and the private_hub directive.

I forgot about the missing cloud-init, I did try it once, out of stubbornness. That kinda makes this out of scope / non-trivial. Only would be useful to test Ubuntu VM's before the public hub gets updated.

Thanks @goneri