Skip to content

Commit 54bfd7e

Browse files
committed
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>
1 parent 44f345e commit 54bfd7e

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package org.apache.cloudstack.engine.cloud.entity.api;
1818

19+
import com.cloud.utils.component.ComponentContext;
1920
import org.springframework.beans.factory.FactoryBean;
2021
import org.springframework.stereotype.Component;
2122

@@ -24,7 +25,7 @@ public class VirtualMachineEntityFactory implements FactoryBean<VirtualMachineEn
2425

2526
@Override
2627
public VirtualMachineEntityImpl getObject() throws Exception {
27-
return new VirtualMachineEntityImpl();
28+
return ComponentContext.inject(VirtualMachineEntityImpl.class.newInstance());
2829
}
2930

3031
@Override

engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ public VirtualMachineEntity createVirtualMachine(
176176

177177
VirtualMachineEntityImpl vmEntity = null;
178178
try {
179-
//vmEntity = _vmEntityFactory.getObject();
180-
vmEntity = VirtualMachineEntityImpl.class.newInstance();
181-
vmEntity = ComponentContext.inject(vmEntity);
179+
vmEntity = _vmEntityFactory.getObject();
182180
} catch (Exception e) {
183181
// add error handling here
184182
}

0 commit comments

Comments
 (0)