mirror of https://github.com/apache/cloudstack.git
server: Look for active templates for VR deployment (#4047)
If the template from which VR is created got deleted, the state is set to inactive and removed to null. Since the template is already deleted, the VR can't be created using this template again. If someone restarts network with cleanup then it will try to deploy the vr from the old non existing template again. So search only for active template which are not yet deleted.
This commit is contained in:
parent
fef0e66764
commit
787491871a
|
|
@ -376,6 +376,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
tmpltTypeHyperSearch2.and("templateType", tmpltTypeHyperSearch2.entity().getTemplateType(), SearchCriteria.Op.EQ);
|
||||
tmpltTypeHyperSearch2.and("hypervisorType", tmpltTypeHyperSearch2.entity().getHypervisorType(), SearchCriteria.Op.EQ);
|
||||
tmpltTypeHyperSearch2.and("templateName", tmpltTypeHyperSearch2.entity().getName(), SearchCriteria.Op.EQ);
|
||||
tmpltTypeHyperSearch2.and("state", tmpltTypeHyperSearch2.entity().getState(), SearchCriteria.Op.EQ);
|
||||
|
||||
tmpltTypeSearch = createSearchBuilder();
|
||||
tmpltTypeSearch.and("state", tmpltTypeSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -897,6 +898,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
SearchCriteria<VMTemplateVO> sc = tmpltTypeHyperSearch2.create();
|
||||
sc.setParameters("templateType", TemplateType.ROUTING);
|
||||
sc.setParameters("hypervisorType", hType);
|
||||
sc.setParameters("state", VirtualMachineTemplate.State.Active.toString());
|
||||
if (templateName != null) {
|
||||
sc.setParameters("templateName", templateName);
|
||||
}
|
||||
|
|
@ -911,6 +913,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
sc = tmpltTypeHyperSearch2.create();
|
||||
sc.setParameters("templateType", TemplateType.SYSTEM);
|
||||
sc.setParameters("hypervisorType", hType);
|
||||
sc.setParameters("state", VirtualMachineTemplate.State.Active.toString());
|
||||
if (templateName != null) {
|
||||
sc.setParameters("templateName", templateName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue