cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject [3/3] git commit: updated refs/heads/master to ce1e53f
Date Wed, 19 Mar 2014 00:00:58 GMT
Fix style-check issue after cherry-picks


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

Branch: refs/heads/master
Commit: ce1e53f451a06298f0eed722c9a7f20226745633
Parents: d9506d2
Author: Kelven Yang <kelveny@gmail.com>
Authored: Tue Mar 18 17:00:08 2014 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Tue Mar 18 17:00:08 2014 -0700

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  6 +-
 .../src/com/cloud/vm/dao/VMInstanceDaoImpl.java | 70 ++++++++++----------
 .../cloud/ha/HighAvailabilityManagerImpl.java   |  1 -
 3 files changed, 37 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce1e53f4/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index bdc0f34..2ff870a 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -4224,13 +4224,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             if(vm.isHaEnabled() && vm.getState() == State.Running && vm.getHypervisorType()
!= HypervisorType.VMware && vm.getHypervisorType() != HypervisorType.Hyperv) {
                 s_logger.info("Detected out-of-band stop of a HA enabled VM " + vm.getInstanceName()
+ ", will schedule restart");
                 if(!_haMgr.hasPendingHaWork(vm.getId()))
-                	_haMgr.scheduleRestart(vm, true);
+                    _haMgr.scheduleRestart(vm, true);
                 else
                     s_logger.info("VM " + vm.getInstanceName() + " already has an pending
HA task working on it");
-                
                 return;
             }
-            
+
             VirtualMachineGuru vmGuru = getVmGuru(vm);
             VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
             sendStop(vmGuru, profile, true);
@@ -4420,7 +4419,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                     assert (jobVo != null);
                     if (jobVo == null || jobVo.getStatus() != JobInfo.Status.IN_PROGRESS)
                         return true;
-                    
                     return false;
                 }
             }, Topics.VM_POWER_STATE, AsyncJob.Topics.JOB_STATE);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce1e53f4/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 0c13ae7..cc05f53 100644
--- a/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -417,44 +417,44 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO,
Long> implem
 
     @Override
     public boolean updateState(State oldState, Event event, State newState, VirtualMachine
vm, Object opaque) {
-    	if (newState == null) {
-    		if (s_logger.isDebugEnabled()) {
-    			s_logger.debug("There's no way to transition from old state: " + oldState.toString()
+ " event: " + event.toString());
-    		}
-    		return false;
-    	}
-
-    	@SuppressWarnings("unchecked")
-		Pair<Long, Long> hosts = (Pair<Long,Long>)opaque;
-		Long newHostId = hosts.second();
-
-    	VMInstanceVO vmi = (VMInstanceVO)vm;
-    	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;
-    	}
+        if (newState == null) {
+            if (s_logger.isDebugEnabled()) {
+                s_logger.debug("There's no way to transition from old state: " + oldState.toString()
+ " event: " + event.toString());
+            }
+            return false;
+        }
+
+        @SuppressWarnings("unchecked")
+        Pair<Long, Long> hosts = (Pair<Long, Long>)opaque;
+        Long newHostId = hosts.second();
+
+        VMInstanceVO vmi = (VMInstanceVO)vm;
+        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;
+        }
 
         // lock the target row at beginning to avoid lock-promotion caused deadlock
         lockRow(vm.getId(), true);
-    	
-    	SearchCriteria<VMInstanceVO> sc = StateChangeSearch.create();
-    	sc.setParameters("id", vmi.getId());
-    	sc.setParameters("states", oldState);
-    	sc.setParameters("host", vmi.getHostId());
-    	sc.setParameters("update", vmi.getUpdated());
-
-    	vmi.incrUpdated();
-    	UpdateBuilder ub = getUpdateBuilder(vmi);
-
-    	ub.set(vmi, "state", newState);
-    	ub.set(vmi, "hostId", newHostId);
-    	ub.set(vmi, "podIdToDeployIn", vmi.getPodIdToDeployIn());
-    	ub.set(vmi, _updateTimeAttr, new Date());
-
-    	int result = update(vmi, sc);
+
+        SearchCriteria<VMInstanceVO> sc = StateChangeSearch.create();
+        sc.setParameters("id", vmi.getId());
+        sc.setParameters("states", oldState);
+        sc.setParameters("host", vmi.getHostId());
+        sc.setParameters("update", vmi.getUpdated());
+
+        vmi.incrUpdated();
+        UpdateBuilder ub = getUpdateBuilder(vmi);
+
+        ub.set(vmi, "state", newState);
+        ub.set(vmi, "hostId", newHostId);
+        ub.set(vmi, "podIdToDeployIn", vmi.getPodIdToDeployIn());
+        ub.set(vmi, _updateTimeAttr, new Date());
+
+        int result = update(vmi, sc);
         if (result == 0) {
             VMInstanceVO vo = findByIdIncludingRemoved(vm.getId());
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce1e53f4/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index 8eaa35e..f7ab552 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -72,7 +72,6 @@ import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.fsm.StateListener;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;


Mime
View raw message