mirror of https://github.com/apache/cloudstack.git
bug 11838: Create Private Template from Snapshot - Lift the restriction of creating duplicate names keeping it consistent with register template
Reviewed by : Kishan.
This commit is contained in:
parent
b2b8ce1758
commit
353bc396e3
|
|
@ -39,15 +39,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
|
|||
//finds by the column "unique_name"
|
||||
public VMTemplateVO findByName(String templateName);
|
||||
//finds by the column "name"
|
||||
public VMTemplateVO findByTemplateName(String templateName);
|
||||
|
||||
/**
|
||||
* Find a template by name for a specific account.
|
||||
* @param templateName the name to search for
|
||||
* @param accountId the account to use for filtering the search results
|
||||
* @return the template with the given name for the given account if it exists, null otherwise
|
||||
*/
|
||||
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId);
|
||||
public VMTemplateVO findByTemplateName(String templateName);
|
||||
|
||||
//public void update(VMTemplateVO template);
|
||||
|
||||
|
|
|
|||
|
|
@ -131,14 +131,6 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
|||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VMTemplateVO findByTemplateNameAccountId(String templateName, Long accountId) {
|
||||
SearchCriteria<VMTemplateVO> sc = NameAccountIdSearch.create();
|
||||
sc.setParameters("name", templateName);
|
||||
sc.setParameters("accountId", accountId);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VMTemplateVO> publicIsoSearch(Boolean bootable, boolean listRemoved){
|
||||
SearchCriteria<VMTemplateVO> sc = PublicIsoSearch.create();
|
||||
|
|
|
|||
|
|
@ -1388,11 +1388,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
hyperType = snapshot.getHypervisorType();
|
||||
}
|
||||
|
||||
VMTemplateVO existingTemplate = _templateDao.findByTemplateNameAccountId(name, accountId);
|
||||
if (existingTemplate != null) {
|
||||
throw new InvalidParameterValueException("Failed to create private template " + name + ", a template with that name already exists.");
|
||||
}
|
||||
|
||||
AccountVO ownerAccount = _accountDao.findById(accountId);
|
||||
_resourceLimitMgr.checkResourceLimit(ownerAccount, ResourceType.template);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue