You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2013/02/28 13:19:36 UTC

git commit: refs/heads/4.1 - orchestration: Fix VirtualMachineEntityFactory to process spring injections

Updated Branches:
  refs/heads/4.1 ca4103705 -> 9419d906e


orchestration: Fix VirtualMachineEntityFactory to process spring injections

The bug was found was Harikrishna P. when iso was used, in case of Isos, the
create vm from scratch which fails due to factory being used to get the object
which is not spring injected

Signed-off-by: Rohit Yadav <bh...@apache.org>
(cherry picked from commit 54bfd7e04a0ab8c613aba3fcb2dd7e112cb35b31)

Signed-off-by: Rohit Yadav <bh...@apache.org>


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

Branch: refs/heads/4.1
Commit: 9419d906e6e9f897505069fb6698f0e9e9b806f8
Parents: ca41037
Author: Rohit Yadav <bh...@apache.org>
Authored: Thu Feb 28 17:28:15 2013 +0530
Committer: Rohit Yadav <bh...@apache.org>
Committed: Thu Feb 28 17:29:27 2013 +0530

----------------------------------------------------------------------
 .../entity/api/VirtualMachineEntityFactory.java    |    3 ++-
 .../platform/orchestration/CloudOrchestrator.java  |    4 +---
 2 files changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9419d906/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java
index 2e8638e..e8ad8e4 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java
@@ -16,6 +16,7 @@
 // under the License.
 package org.apache.cloudstack.engine.cloud.entity.api;
 
+import com.cloud.utils.component.ComponentContext;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.stereotype.Component;
 
@@ -24,7 +25,7 @@ public class VirtualMachineEntityFactory implements FactoryBean<VirtualMachineEn
 
 	@Override
 	public VirtualMachineEntityImpl getObject() throws Exception {
-		return new VirtualMachineEntityImpl();
+        return ComponentContext.inject(VirtualMachineEntityImpl.class.newInstance());
 	}
 
 	@Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9419d906/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
index 41214dc..6085c61 100755
--- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
@@ -173,9 +173,7 @@ public class CloudOrchestrator implements OrchestrationService {
 
     	VirtualMachineEntityImpl vmEntity = null;
 		try {
-			//vmEntity = _vmEntityFactory.getObject();
-			vmEntity = VirtualMachineEntityImpl.class.newInstance();
-			vmEntity = ComponentContext.inject(vmEntity);
+			vmEntity = _vmEntityFactory.getObject();
 		} catch (Exception e) {
 			// add error handling here
 		}