mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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:
parent
44f345e4c6
commit
54bfd7e04a
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user