cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to 800e407
Date Wed, 30 Jul 2014 11:08:29 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 3dc0a64b3 -> 800e40737


Fixed issues reported by coverity NPEs, unwritten field access and self assignment

Signed-off-by: Koushik Das <koushik@apache.org>
(cherry picked from commit 390e498dc58a89f0b060c50e5b796061bc97342e)

Conflicts:
	engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java


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

Branch: refs/heads/4.4
Commit: 800e40737d11c4c5f8c2b5a34ed9d9e6f6543a56
Parents: 3dc0a64
Author: Rajani Karuturi <rajanikaruturi@gmail.com>
Authored: Tue Jun 10 13:52:43 2014 +0530
Committer: Daan Hoogland <daan@onecht.net>
Committed: Wed Jul 30 13:08:15 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/vm/VirtualMachineManagerImpl.java | 43 +++++++++++---------
 1 file changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/800e4073/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 08e8968..c239b93 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -777,8 +777,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateStart(vmUuid, params, planToDeploy, planner);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params,
planToDeploy, planner);
@@ -1354,8 +1355,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateStop(vmUuid, cleanUpEvenIfUnableToStop);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
 
         } else {
@@ -1453,7 +1455,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Unable to transition the state but we're moving on because
it's forced stop");
             }
-            if (state == State.Starting || state == State.Migrating) {
+            if ((state == State.Starting) || (state == State.Migrating) || (state == State.Stopping))
{
                 if (work != null) {
                     doCleanup = true;
                 } else {
@@ -1462,8 +1464,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
                     }
                     throw new CloudRuntimeException("Work item not found, We cannot stop
" + vm + " when it is in state " + vm.getState());
                 }
-            } else if (state == State.Stopping) {
-                doCleanup = true;
             }
 
             if (doCleanup) {
@@ -1683,8 +1683,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateStorageMigration(vmUuid, destPool);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = migrateVmStorageThroughJobQueue(vmUuid,
destPool);
@@ -1777,8 +1778,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateMigrate(vmUuid, srcHostId, dest);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = migrateVmThroughJobQueue(vmUuid, srcHostId,
dest);
@@ -2082,8 +2084,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateMigrateWithStorage(vmUuid, srcHostId, destHostId, volumeToPool);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
 
         } else {
@@ -2428,8 +2431,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateReboot(vmUuid, params);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = rebootVmThroughJobQueue(vmUuid, params);
@@ -3292,12 +3296,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         public String hostUuid;
         public VMInstanceVO vm;
 
-        @SuppressWarnings("unchecked")
         public AgentVmInfo(String name, VMInstanceVO vm, State state, String host) {
             this.name = name;
             this.state = state;
             this.vm = vm;
-            hostUuid = host;
+            this.hostUuid = host;
         }
 
         public AgentVmInfo(String name, VMInstanceVO vm, State state) {
@@ -3402,8 +3405,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 return orchestrateAddVmToNetwork(vm, network, requested);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = addVmToNetworkThroughJobQueue(vm, network,
requested);
@@ -3413,7 +3417,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             } catch (InterruptedException e) {
                 throw new RuntimeException("Operation is interrupted", e);
             } catch (java.util.concurrent.ExecutionException e) {
-                throw new RuntimeException("Execution excetion", e);
+                throw new RuntimeException("Execution exception", e);
             }
 
             Object jobException = _jobMgr.unmarshallResultObject(outcome.getJob());
@@ -3516,8 +3520,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 return orchestrateRemoveNicFromVm(vm, nic);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
 
         } else {
@@ -3768,8 +3773,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 orchestrateMigrateForScale(vmUuid, srcHostId, dest, oldSvcOfferingId);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = migrateVmForScaleThroughJobQueue(vmUuid,
srcHostId, dest, oldSvcOfferingId);
@@ -4031,8 +4037,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
             try {
                 return orchestrateReConfigureVm(vmUuid, oldServiceOffering, reconfiguringOnExistingHost);
             } finally {
-                if (VmJobEnabled.value())
+                if (placeHolder != null) {
                     _workJobDao.expunge(placeHolder.getId());
+                }
             }
         } else {
             Outcome<VirtualMachine> outcome = reconfigureVmThroughJobQueue(vmUuid,
oldServiceOffering, reconfiguringOnExistingHost);
@@ -4084,7 +4091,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         work.setStep(Step.Prepare);
         work.setResourceType(ItWorkVO.ResourceType.Host);
         work.setResourceId(vm.getHostId());
-        work = _workDao.persist(work);
+        _workDao.persist(work);
         boolean success = false;
         try {
             if (reconfiguringOnExistingHost) {
@@ -4106,8 +4113,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements
VirtualMac
         } catch (AgentUnavailableException e) {
             throw e;
         } finally {
-            // work.setStep(Step.Done);
-            //_workDao.update(work.getId(), work);
             if (!success) {
                 _capacityMgr.releaseVmCapacity(vm, false, false, vm.getHostId()); // release
the new capacity
                 vm.setServiceOfferingId(oldServiceOffering.getId());


Mime
View raw message