don't update VM state if the state doesn't really change. updating VM state increases the update count, which might cause real VM update fail

This commit is contained in:
Anthony Xu 2013-07-22 15:49:11 -07:00
parent 9f9f7d3ffd
commit b77723df13
1 changed files with 4 additions and 0 deletions

View File

@ -398,6 +398,10 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
Long oldHostId = vmi.getHostId();
Long oldUpdated = vmi.getUpdated();
Date oldUpdateDate = vmi.getUpdateTime();
if ( newState.equals(oldState) && newHostId != null && newHostId.equals(oldHostId) ) {
// state is same, don't need to update
return true;
}
SearchCriteria<VMInstanceVO> sc = StateChangeSearch.create();
sc.setParameters("id", vmi.getId());