bhouse-nexthop commented on code in PR #14207:
URL: https://github.com/apache/cloudstack/pull/14207#discussion_r4208622007
##########
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java:
##########
@@ -5480,20 +5566,26 @@ private void
handlePowerOffReportWithNoPendingJobsOnVM(final VMInstanceVO vm) {
return;
}
- if (PowerState.PowerOff.equals(vm.getPowerState())) {
+ // A missing report is not proof that the instance is gone, only
that the host did not list it. Stop it
+ // on the host before giving up its resources, otherwise a
still-running instance keeps its NICs and IP
+ // addresses while the database says they are free and they get
handed to another instance.
+ if (PowerState.PowerOff.equals(vm.getPowerState()) ||
PowerState.PowerReportMissing.equals(vm.getPowerState())) {
+ // force is false for a missing report. sendStop() swallows
AgentUnavailableException and
+ // OperationTimedoutException and answers success when forced,
and a host too busy to answer is
+ // exactly the condition that produced the stale report in the
first place. Backing off and letting a
+ // later report decide is better than freeing an address on no
evidence. A PowerOff report is the
+ // host stating the instance is down, so that path keeps its
previous behaviour.
Review Comment:
Shortened in 0d068391e5, with one change to the wording: `forceStop` is true
when the host reported the instance `PowerOff`, so known to be down rather than
up. It now reads:
```java
// forceStop only if the host reported the instance as powered off, not for
a missing report.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]