Skip to content

Conversation

@swim-up-enterprises
Copy link

Check the power state and whether it needs to be changed to match the "start" parameter after both cloning and creating an LXC container.

I had run into an issue where LXC's would not start after being cloned from another VM. I checked the code and it seemed to be prone to issues, so I've broken that logic out into a function reconcilePowerState which is now run when we finish creating or cloning an LXC.

From my testing this works much more reliably than before. I'm not sure if there was a reason behind only checking and reconciling the power state if the "start" parameter had changed. If I am understanding correctly, the more "idempotent" thing to do would be to check regardless of the input and change the power state if it needs to be changed. Let me know if I am making any wrong assumptions here.

This is a somewhat quick and dirty proof of concept so definitely let me know if it should be tidied up in any way.
Thanks!

Check the power state and whether it needs to be changed to match the "start"
parameter after both cloning and creating an LXC container.

I had run into an issue where LXC's would not start after being cloned from
another VM. I checked the code and it seemed to be prone to issues, so I've
broken that logic out into a function `reconcilePowerState` which is now run
when we finish creating or cloning an LXC.
@Tinyblargon Tinyblargon added type/enhancement An improvement of existing functionality modifies/go Pull requests that update Go code resource/lxc Issue or PR related to LXC resource test/needen This PR has to be tested labels Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifies/go Pull requests that update Go code resource/lxc Issue or PR related to LXC resource test/needen This PR has to be tested type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants