Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMHyperV: Support AutomaticStartAction and AutomaticStopAction #216

Open
janegilring opened this issue Dec 30, 2023 · 3 comments
Open

VMHyperV: Support AutomaticStartAction and AutomaticStopAction #216

janegilring opened this issue Dec 30, 2023 · 3 comments
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community.

Comments

@janegilring
Copy link

janegilring commented Dec 30, 2023

Resource proposal

I suggest adding support for configuring AutomaticStartAction and AutomaticStopAction, which can be configured using Set-VM:

Set-VM -Name $VmName -AutomaticStartAction Start/StartIfRunning/Nothing -AutomaticStopAction Save/TurnOff/ShutDown

Proposed properties

Property Data type Description Default value Allowed values
AutomaticStartAction String Configures automatic start action for VM None Start/StartIfRunning/Nothing
AutomaticStopAction String Configures automatic stop action for VM None Save/TurnOff/ShutDown

Special considerations or limitations

Modifying these properties can only be done when the VM is powered off

@johlju
Copy link
Member

johlju commented Dec 31, 2023

So if these properties can only be modified when the VM is off, should they only be allowed to be configured when the VM is created, or should these also be enforced if they diverge? If the later how should there be an opt-in for turning off and on a VM to be able to enforce these values?

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub labels Dec 31, 2023
@janegilring
Copy link
Author

janegilring commented Jan 1, 2024

Good question.

I was just looking at how this works for the ProcessorCount property, and noticed it will turn off the VM when the value changes if RestartIfNeeded is set to true. Otherwise, it fails with the following error:

PowerShell DSC resource DSC_VMHyperV  failed to execute Set-TargetResource functionality with error message: System.InvalidOperationException: Can not change
properties for VM 'Disk1_vm' in 'Running' state unless 'RestartIfNeeded' is set to true.

I think AutomaticStartAction/AutomaticStopAction should follow the same pattern.

@johlju
Copy link
Member

johlju commented Jan 2, 2024

Great, that will do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants