lxc / incus

Powerful system container and virtual machine manager
https://linuxcontainers.org/incus
Apache License 2.0
2.65k stars 220 forks source link

Prevent instance migration #1306

Open bensmrs opened 1 week ago

bensmrs commented 1 week ago

Instance placement scriptlets offer interesting ways to control how instances are placed on cluster nodes. While creation, relocation (due to a node being down), and evacuation are handled, there is to the best of my knowledge no way to block a migration to an unwanted cluster node. So I have two questions:

stgraber commented 5 days ago

How to lock an instance to a specific node in a cluster, without creating a dedicated project attached to a dedicated group?

Easiest way to do this would be to use --target during creation and then set cluster.evacuate to stop so it never gets migrated away during evacuation or recovery.

Could the instance placement scriptlet be modified so that it includes an optional parameter (or request property) target containing the requested migration target, allowing us to call fail depending on different decision factors? (I can work on this one)

I think that starting with Incus 6.6 we call the scriptlet even with --target=NAME so that should let you perform your check there.

As for failing, you should be able to either call the fail function or do return "Placement rejected" which will also be treated as an error.

stgraber commented 5 days ago

Marking as incomplete as we may not have anything to add to Incus for that.