-
Notifications
You must be signed in to change notification settings - Fork 45
Revise TSG for Update Service memory issues #230
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -97,6 +97,24 @@ if ($resourceIds.Count -gt 0) | |||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ## Remove failed Update action plan instances | ||||||||||||||||||||||||||||||||||||||||||||||
| Delete all failed Update action plans except for the last failed one. | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||||||||||||||
| Import-Module ECEClient -DisableNameChecking | ||||||||||||||||||||||||||||||||||||||||||||||
| $failedUpdates = Get-ActionPlanInstances | ? { $_.Status -eq "Failed" -and $_.ActionPlanName -match "MAS Update" } | sort LastModifiedDateTime -Descending | select -Skip 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| $instanceIDs = $failedUpdates.InstanceID | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| $eceClient = Create-ECEClusterServiceClient | ||||||||||||||||||||||||||||||||||||||||||||||
| $deleteActionPlanInstanceDescription = New-Object Microsoft.AzureStack.Solution.Deploy.EnterpriseCloudEngine.Controllers.Models.DeleteActionPlanInstanceDescription | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| foreach ($actionPlanInstanceId in $instanceIDs) { | ||||||||||||||||||||||||||||||||||||||||||||||
| # remove old instance | ||||||||||||||||||||||||||||||||||||||||||||||
| $deleteActionPlanInstanceDescription.ActionPlanInstanceID = $actionPlanInstanceID | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
| $deleteActionPlanInstanceDescription.ActionPlanInstanceID = $actionPlanInstanceID | |
| $deleteActionPlanInstanceDescription.ActionPlanInstanceID = $actionPlanInstanceId |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code formatting has inconsistent indentation with trailing spaces on lines 107, 109, 110, 111, and 112. Remove trailing whitespace and use consistent spacing to match the formatting style of other PowerShell scripts in this document.
| Import-Module ECEClient -DisableNameChecking | |
| $failedUpdates = Get-ActionPlanInstances | ? { $_.Status -eq "Failed" -and $_.ActionPlanName -match "MAS Update" } | sort LastModifiedDateTime -Descending | select -Skip 1 | |
| $instanceIDs = $failedUpdates.InstanceID | |
| $eceClient = Create-ECEClusterServiceClient | |
| $deleteActionPlanInstanceDescription = New-Object Microsoft.AzureStack.Solution.Deploy.EnterpriseCloudEngine.Controllers.Models.DeleteActionPlanInstanceDescription | |
| foreach ($actionPlanInstanceId in $instanceIDs) { | |
| # remove old instance | |
| $deleteActionPlanInstanceDescription.ActionPlanInstanceID = $actionPlanInstanceID | |
| $eceClient.DeleteActionPlanInstance($deleteActionPlanInstanceDescription).Wait() | |
| Import-Module ECEClient -DisableNameChecking | |
| $failedUpdates = Get-ActionPlanInstances | ? { $_.Status -eq "Failed" -and $_.ActionPlanName -match "MAS Update" } | sort LastModifiedDateTime -Descending | select -Skip 1 | |
| $instanceIDs = $failedUpdates.InstanceID | |
| $eceClient = Create-ECEClusterServiceClient | |
| $deleteActionPlanInstanceDescription = New-Object Microsoft.AzureStack.Solution.Deploy.EnterpriseCloudEngine.Controllers.Models.DeleteActionPlanInstanceDescription | |
| foreach ($actionPlanInstanceId in $instanceIDs) { | |
| # remove old instance | |
| $deleteActionPlanInstanceDescription.ActionPlanInstanceID = $actionPlanInstanceID | |
| $eceClient.DeleteActionPlanInstance($deleteActionPlanInstanceDescription).Wait() |
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PowerShell script lacks error handling that is present in other mitigation scripts in this document. This script performs state-changing delete operations that could fail. Add $ErrorActionPreference = "Stop" at the beginning of the script to ensure errors are caught and the script stops if operations fail.
Copilot
AI
Jan 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script deletes action plan instances without defensive validation. Before performing the delete operations, add a check to verify that failed updates were found and provide user confirmation or output about what will be deleted. For example, check if $failedUpdates is empty and inform the user how many instances will be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The section description is too brief for a potentially destructive operation. The instruction should warn users that this operation will permanently delete action plan instances and cannot be undone. Consider adding context about why keeping the last failed instance is important for troubleshooting.