LXC VM caused OOM while using more ram than it's location machine. How can I check the ram before creating it?

I found that when I set no --target param, lxd will start a large(1TiB) ram vm automatic on a target machine even if there’s only 128GiB ram free. When I use more than 128GiB in the vm, it will be crashed(and the machine will also crash). I think this is dangerous for me and my users.

Where could I find the default target allocation policy? Or how can I have a check of ram before I do lxd init without --target?
If it is recommended to use --target param, I will do this way, and check ram by myself

There is some documentation about this you may find useful:

https://documentation.ubuntu.com/lxd/en/latest/explanation/clustering/#automatic-placement-of-instances

https://documentation.ubuntu.com/lxd/en/latest/howto/cluster_groups/

The placement scriptlet option may be of particular interest to you.

Thanks a lot, I’ll learn about it

1 Like