terraform-lxd / terraform-provider-lxd

LXD Resource provider for Terraform
https://registry.terraform.io/providers/terraform-lxd/lxd/latest/docs
Mozilla Public License 2.0
254 stars 71 forks source link

Failed updating memory limit: Cannot increase memory size beyond boot time size when VM is running #514

Open Hybrid512 opened 1 month ago

Hybrid512 commented 1 month ago

Hi,

The title summurize my issue ... it is not possible to change memory size when a VM is running with terraform. I understand this is not possible to do it live (and even if I know this is technically possible with LXD but ok, rebooting an instance to change its memory setting doesn't hurt) but why triggering an error about that ? Why not just change the memory settings and let the user reboot by hand ? Or maybe force the instance to reboot if the user agree (maybe with just some new attribute in the instance definition or lifecycle management).

Well, this is not blocking in any way but it is quite annoying.

MusicDin commented 4 days ago

Why not just change the memory settings and let the user reboot by hand ?

The provider actually tries to do that, but LXD reports an error. However, it seems that the limitation only applies to virtual machines when increasing the memory limit.

$ lxc launch images:alpine/edge v1 --vm \
    -c security.secureboot=false \
    -c limits.cpu=4 \
    -c limits.memory=4GiB

$ lxc config set v1 limits.cpu=6
$ lxc config set v1 limits.memory=6GiB
Error: Failed updating memory limit: Cannot increase memory size beyond boot time size when VM is running (Boot time size 4096MiB, new size 6144MiB)

@simondeziel Do you know more about that? Is this intentional or a bug in LXD?