I have been trying to figure out how or even if it’s possible to use a qemu disk image that I created with packer to boot an lxd vm.
I did read on another forum post that a method to try is to create init a vm with the --epmty option and possibly switch out the drives and boot the vm. I’m not sure on how to even make that work.
So If I create a raw qemu image with packer of ubuntu 18.04. Could I some how boot that with lxd and if so how?
So if you have the raw image, first create an empty container and then copy it to that location (adjust the path according to your setup).
Note: I did not try this.
I move the image to the virtual machine location :
/var/snap/lxd/common/lxd/storage-pools/lxd_storage/virtual-machines/consul-server# ls
consul-server-1591076437.img
Error: Failed to run: zfs mount lxd_storage/virtual-machines/consul-server: cannot mount ‘/var/snap/lxd/common/lxd/storage-pools/lxd_storage/virtual-machines/consul-server’: directory is not empty
How would I set the image type for the imported image? The import works for me but the image is of type container and I can’t use it for a VM. I tried with type: virtual-machine in the metadata.yaml file to no avail.
For lxc image import, the server bases it on whether the multipart stream had a rootfs.img member in it. On the CLI front, this gets set if the image file has a .qcow2 extension.