registerTemplate and registerIso expect the template to be returned, not the template id...fixed

This commit is contained in:
Kris McQueen 2010-10-07 14:52:06 -07:00
parent 7c4a06a764
commit ea84f3bde2
2 changed files with 10 additions and 10 deletions

View File

@ -71,11 +71,11 @@ public interface TemplateManager extends Manager {
* @param enablePassword Does the template support password change.
* @param guestOSId OS that is on the template
* @param bootable true if this template will represent a bootable ISO
* @return id of the template created.
* @return the template created.
*/
// Long create(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable);
Long registerTemplate(RegisterTemplateCmd cmd) throws InvalidParameterValueException, URISyntaxException, ResourceAllocationException;
Long registerIso(RegisterIsoCmd cmd) throws InvalidParameterValueException, IllegalArgumentException, ResourceAllocationException;
VMTemplateVO registerTemplate(RegisterTemplateCmd cmd) throws InvalidParameterValueException, URISyntaxException, ResourceAllocationException;
VMTemplateVO registerIso(RegisterIsoCmd cmd) throws InvalidParameterValueException, IllegalArgumentException, ResourceAllocationException;
/**
* Creates a Template
*

View File

@ -151,7 +151,7 @@ public class TemplateManagerImpl implements TemplateManager {
protected SearchBuilder<VMTemplateHostVO> HostTemplateStatesSearch;
@Override
public Long registerIso(RegisterIsoCmd cmd) throws InvalidParameterValueException, IllegalArgumentException, ResourceAllocationException{
public VMTemplateVO registerIso(RegisterIsoCmd cmd) throws InvalidParameterValueException, IllegalArgumentException, ResourceAllocationException{
Account account = (Account)UserContext.current().getAccountObject();
Long userId = UserContext.current().getUserId();
String name = cmd.getName();
@ -221,7 +221,7 @@ public class TemplateManagerImpl implements TemplateManager {
}
@Override
public Long registerTemplate(RegisterTemplateCmd cmd) throws InvalidParameterValueException, URISyntaxException, ResourceAllocationException{
public VMTemplateVO registerTemplate(RegisterTemplateCmd cmd) throws InvalidParameterValueException, URISyntaxException, ResourceAllocationException{
Account account = (Account)UserContext.current().getAccountObject();
Long userId = UserContext.current().getUserId();
@ -302,7 +302,7 @@ public class TemplateManagerImpl implements TemplateManager {
}
private Long createTemplateOrIso(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws InvalidParameterValueException,IllegalArgumentException, ResourceAllocationException {
private VMTemplateVO createTemplateOrIso(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, String format, String diskType, String url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) throws InvalidParameterValueException,IllegalArgumentException, ResourceAllocationException {
try
{
if (name.length() > 32)
@ -374,7 +374,7 @@ public class TemplateManagerImpl implements TemplateManager {
}
}
private Long create(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) {
private VMTemplateVO create(long userId, Long zoneId, String name, String displayText, boolean isPublic, boolean featured, ImageFormat format, FileSystem fs, URI url, String chksum, boolean requiresHvm, int bits, boolean enablePassword, long guestOSId, boolean bootable) {
Long id = _tmpltDao.getNextInSequence(Long.class, "id");
UserVO user = _userDao.findById(userId);
@ -403,7 +403,7 @@ public class TemplateManagerImpl implements TemplateManager {
_accountMgr.incrementResourceCount(userAccount.getAccountId(), ResourceType.template);
return id;
return template;
}
@Override
@ -811,8 +811,8 @@ public class TemplateManagerImpl implements TemplateManager {
return copiedTemplate;
}
@Override
@Override @DB
public boolean delete(long userId, long templateId, Long zoneId) throws InternalErrorException {
boolean success = true;
VMTemplateVO template = _tmpltDao.findById(templateId);