You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/07/23 00:59:31 UTC

[2/2] git commit: updated refs/heads/master to eff27e1

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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eff27e1f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eff27e1f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eff27e1f

Branch: refs/heads/master
Commit: eff27e1f839de57b4c9f5bba3c07b8907e0f0bf9
Parents: 668089d
Author: Anthony Xu <an...@citrix.com>
Authored: Mon Jul 22 15:49:11 2013 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Mon Jul 22 15:56:37 2013 -0700

----------------------------------------------------------------------
 engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eff27e1f/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
index 8cbc6b6..e8f98e9 100644
--- a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -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());