mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
server: fix host anti-affinity when start batch vms (#6002)
This commit is contained in:
parent
b8ce07475d
commit
5d1e54a4ab
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.affinity;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -85,7 +86,7 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Added host " + groupVM.getHostId() + " to avoid set, since VM " + groupVM.getId() + " is present on the host");
|
||||
}
|
||||
} else if (VirtualMachine.State.Stopped.equals(groupVM.getState()) && groupVM.getLastHostId() != null) {
|
||||
} else if (Arrays.asList(VirtualMachine.State.Starting, VirtualMachine.State.Stopped).contains(groupVM.getState()) && groupVM.getLastHostId() != null) {
|
||||
long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - groupVM.getUpdateTime().getTime()) / 1000;
|
||||
if (secondsSinceLastUpdate < _vmCapacityReleaseInterval) {
|
||||
avoid.addHost(groupVM.getLastHostId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user