Skip to content

Commit 11d5ba9

Browse files
committed
allow same name template for different arch
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 4ff7c4a commit 11d5ba9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

server/src/main/java/com/cloud/template/TemplateAdapterBase.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.HashMap;
2222
import java.util.List;
2323
import java.util.Map;
24+
import java.util.Objects;
2425

2526
import javax.inject.Inject;
2627

@@ -243,7 +244,11 @@ public TemplateProfile prepare(boolean isIso, long userId, String name, String d
243244

244245
List<VMTemplateVO> systemvmTmplts = _tmpltDao.listAllSystemVMTemplates();
245246
for (VMTemplateVO template : systemvmTmplts) {
246-
if (template.getName().equalsIgnoreCase(name) || template.getDisplayText().equalsIgnoreCase(displayText)) {
247+
if ((template.getName().equalsIgnoreCase(name) ||
248+
template.getDisplayText().equalsIgnoreCase(displayText)) &&
249+
Objects.equals(template.getArch(), arch)) {
250+
logger.error("{} for same arch {} is having same name or description", template,
251+
template.getArch());
247252
throw new IllegalArgumentException("Cannot use reserved names for templates");
248253
}
249254
}

0 commit comments

Comments
 (0)