nitin-maharana commented on a change in pull request #2493: CLOUDSTACK-10326:
Prevent hosts fall into Maintenance when there are running VMs on it
URL: https://github.com/apache/cloudstack/pull/2493#discussion_r175377422
##########
File path: server/src/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1296,10 +1296,17 @@ public boolean checkAndMaintain(final long hostId) {
if (host.getType() != Host.Type.Storage) {
final List<VMInstanceVO> vos = _vmDao.listByHostId(hostId);
final List<VMInstanceVO> vosMigrating =
_vmDao.listVmsMigratingFromHost(hostId);
+ final List<VMInstanceVO> failedMigratedVms =
_vmDao.listNonMigratingVmsByHostEqualsLastHost(hostId);
if (vos.isEmpty() && vosMigrating.isEmpty()) {
- resourceStateTransitTo(host,
ResourceState.Event.InternalEnterMaintenance, _nodeId);
- hostInMaintenance = true;
-
ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(),
CallContext.current().getCallingAccountId(), EventVO.LEVEL_INFO,
EventTypes.EVENT_MAINTENANCE_PREPARE, "completed maintenance for host " +
hostId, 0);
+ if (!failedMigratedVms.isEmpty()) {
Review comment:
@nvazquez, I think if we put this condition in line 1300 itself, then it
would maintain the old flow. Something like this in line 1300: if
(vos.isEmpty() && vosMigrating.isEmpty() && failedMigratedVms.isEmpty()) {...}.
And we can put this message(debug purpose) for all kind of failures, where
resource state would transit to UnableToMigrate.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services