Skip to content

Commit b77723d

Browse files
author
Anthony Xu
committed
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
1 parent 9f9f7d3 commit b77723d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@ public boolean updateState(State oldState, Event event, State newState, VirtualM
398398
Long oldHostId = vmi.getHostId();
399399
Long oldUpdated = vmi.getUpdated();
400400
Date oldUpdateDate = vmi.getUpdateTime();
401+
if ( newState.equals(oldState) && newHostId != null && newHostId.equals(oldHostId) ) {
402+
// state is same, don't need to update
403+
return true;
404+
}
401405

402406
SearchCriteria<VMInstanceVO> sc = StateChangeSearch.create();
403407
sc.setParameters("id", vmi.getId());

0 commit comments

Comments
 (0)