diff --git a/engine/schema/src/com/cloud/storage/VMTemplateVO.java b/engine/schema/src/com/cloud/storage/VMTemplateVO.java index 9a77cbf873a..d44de221a87 100755 --- a/engine/schema/src/com/cloud/storage/VMTemplateVO.java +++ b/engine/schema/src/com/cloud/storage/VMTemplateVO.java @@ -159,10 +159,8 @@ public class VMTemplateVO implements VirtualMachineTemplate { uuid = UUID.randomUUID().toString(); } - /** - * Proper constructor for a new vm template. - */ - public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, + //FIXME - Remove unwanted constructors. + private VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) { this(id, @@ -250,8 +248,8 @@ public class VMTemplateVO implements VirtualMachineTemplate { state = State.Active; } - // Has an extra attribute - isExtractable - public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, + //FIXME - Remove unwanted constructors. Made them private for now + private VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) { this(id, @@ -278,34 +276,6 @@ public class VMTemplateVO implements VirtualMachineTemplate { state = State.Active; } - public VMTemplateVO(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, - String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, - boolean bootable, HypervisorType hyperType, String templateTag, Map details) { - this(id, - uniqueName, - name, - format, - isPublic, - featured, - isExtractable, - type, - url, - created, - requiresHvm, - bits, - accountId, - cksum, - displayText, - enablePassword, - guestOSId, - bootable, - hyperType, - details); - this.templateTag = templateTag; - uuid = UUID.randomUUID().toString(); - state = State.Active; - } - @Override public boolean getEnablePassword() { return enablePassword; diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index 06ca5e0209e..247ed003711 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -22,7 +22,6 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -1605,7 +1604,6 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, throw new InvalidParameterValueException("GuestOS with ID: " + guestOSId + " does not exist."); } - String uniqueName = Long.valueOf((userId == null) ? 1 : userId).toString() + UUID.nameUUIDFromBytes(name.getBytes()).toString(); Long nextTemplateId = _tmpltDao.getNextInSequence(Long.class, "id"); String description = cmd.getDisplayText(); boolean isExtractable = false; @@ -1630,10 +1628,9 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, s_logger.debug("Adding template tag: " + templateTag); } } - privateTemplate = - new VMTemplateVO(nextTemplateId, uniqueName, name, ImageFormat.RAW, isPublic, featured, isExtractable, TemplateType.USER, null, null, requiresHvmValue, - bitsValue, templateOwner.getId(), null, description, passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails()); - privateTemplate.setDynamicallyScalable(isDynamicScalingEnabled); + privateTemplate = new VMTemplateVO(nextTemplateId, name, ImageFormat.RAW, isPublic, featured, isExtractable, + TemplateType.USER, null, requiresHvmValue, bitsValue, templateOwner.getId(), null, description, + passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails(), false, isDynamicScalingEnabled); if (sourceTemplateId != null) { if (s_logger.isDebugEnabled()) {