Repository navigation
considder stopped VMs on autoscale - #14284
DaanHoogland wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14284 +/- ##
=========================================
Coverage 18.00% 18.00%
- Complexity 16219 16222 +3
=========================================
Files 5936 5936
Lines 535716 535716
Branches 65596 65596
=========================================
+ Hits 96459 96478 +19
+ Misses 428268 428248 -20
- Partials 10989 10990 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
2 open issues
What changed in this PR
This PR addresses autoscale groups leaking stopped VMs after a failed start by ensuring stopped instances are considered “errored” for scaling decisions and by handling the unchecked exception thrown during VM start.
Changes:
- Update autoscale scale-up error handling to catch
CloudRuntimeExceptionthrown by VM start. - Treat
VirtualMachine.State.Stoppedas an errored state for autoscale VM group instance counting. - Add regression/unit tests covering the stopped/errored instance counting and scale-up cleanup behavior.
| File | Description |
|---|---|
| server/src/main/java/com/cloud/network/as/AutoScaleManagerImpl.java | Adjusts scale-up exception handling to react to unchecked start failures. |
| server/src/test/java/com/cloud/network/as/AutoScaleManagerImplTest.java | Adds regression test ensuring failed starts trigger VM cleanup and state reset. |
| engine/schema/src/main/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImpl.java | Counts Stopped VMs alongside Error as “errored” instances. |
| engine/schema/src/test/java/com/cloud/network/as/dao/AutoScaleVmGroupVmMapDaoImplTest.java | Adds test validating Stopped is included in errored instance count query. |
Review effort: Lite
| break; | ||
| } | ||
| } catch (ServerApiException e) { | ||
| } catch (CloudRuntimeException e) { |
| Mockito.doThrow(new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [Resource unavailable].", virtualMachineId))) | ||
| .when(userVmMgr).startVirtualMachine(virtualMachineId, null, new HashMap<>(), null); |
There was a problem hiding this comment.
thanks @DaanHoogland for the changes, I think it's fine to add Stopped state as well in threshold. Just have few ques:
- Can we specifically target Stopped Instances which failed to Start. Currently any instances which are in stopped state in the group will be taken into account, even the ones without start failure.
- Setting description and log message need to be changed


Description
This PR...
Fixes: #14185
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?