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 <bhaisaab@apache.org>
This commit is contained in:
Rohit Yadav 2013-02-28 17:28:15 +05:30
parent 44f345e4c6
commit 54bfd7e04a
2 changed files with 3 additions and 4 deletions

View File

@ -16,6 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.engine.cloud.entity.api; package org.apache.cloudstack.engine.cloud.entity.api;
import com.cloud.utils.component.ComponentContext;
import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -24,7 +25,7 @@ public class VirtualMachineEntityFactory implements FactoryBean<VirtualMachineEn
@Override @Override
public VirtualMachineEntityImpl getObject() throws Exception { public VirtualMachineEntityImpl getObject() throws Exception {
return new VirtualMachineEntityImpl(); return ComponentContext.inject(VirtualMachineEntityImpl.class.newInstance());
} }
@Override @Override

View File

@ -176,9 +176,7 @@ public class CloudOrchestrator implements OrchestrationService {
VirtualMachineEntityImpl vmEntity = null; VirtualMachineEntityImpl vmEntity = null;
try { try {
//vmEntity = _vmEntityFactory.getObject(); vmEntity = _vmEntityFactory.getObject();
vmEntity = VirtualMachineEntityImpl.class.newInstance();
vmEntity = ComponentContext.inject(vmEntity);
} catch (Exception e) { } catch (Exception e) {
// add error handling here // add error handling here
} }