How to prevent LXC migration in a cluster

Feb 12, 2024
11
1
3
stationproject.blog
I currently have an HA setup with three servers running Proxmox. I have an LXC container tied to storage on one of my servers, and I want to prevent any migration (either manual or due to an HA event) for this particular LXC. Can someone tell me how to configure the LXC and/or the Datacenter HA to block all manual and HA automated attempts to migrate a particular container? Thank you.
 
put it in a HA group that is restricted to that node?
 
you could also restrict the storage to that particular node, then it should at least be obvious that it will change the storage? there is no "lock guest to node" option.
 
  • Like
Reactions: waltar
put it in a HA group that is restricted to that node?
Why not this: AFAIK HA will only happen if that LXC/VM is added to the HA resources. Don't add it & it won't be HA.


Concerning the second part of the OP's question:
but what about an accidental manual migration from the GUI?
I'm not sure about this one, but maybe you could enlighten me; if that CT were to be added to the resources config /etc/pve/ha/resources.cfg , with the state: ignored option added, would this stop even a manual migration. I'm thinking this may only block the HA stack but not a direct migration command.

I must be honest, I'm not sure why the OP seeks to "lock" a manual migration from the GUI, how does he lock/block an accidental VM/LXC/ disk delete/move from the GUI. Maybe his case scenario is that he has to give migration permissions to some sort of migration manager - who only manages migration, but then he could simply not give those rights to that LXC but only to the other VMs - case solved. Maybe I'm missing something here.
 
The reason that I want to block manual migrations is to avoid potential mistakes related to migrating to a node where the undermining storage drives are not available. This can result in problems that cause the disks to become disconnected once I migrate the container back. Would it help if I were using a VM instead of an LXC perhaps?
 
Even though I still don't get the scenario, here I have another idea. With a VM you could add a local resource (USB, PCI or CD-ROM) to that VM so that would make it un-migratable in anyway. With an LXC, possibly adding a bind/mountpoint to it would also achieve the same. Give it a test.
 
Thank you for helping me. I put it in a HA group that is restricted to the node that contains the associated disks and that takes care of the automatic migrations due to HA.

The LXC already uses a mount point that uses disks that are only available on the target node. Unfortunately, can still manually migrate the target LXC to nodes that don't have the disks.
 
Thank you for helping me. I put it in a HA group that is restricted to the node that contains the associated disks and that takes care of the automatic migrations due to HA.

The LXC already uses a mount point that uses disks that are only available on the target node. Unfortunately, can still manually migrate the target LXC to nodes that don't have the disks.

could you please post the container config and your storage config?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!