CLOUDSTACK-6869: SSH Public key content is overridden by template's meta data when you create a instance

This commit is contained in:
Harikrishna Patnala 2014-06-11 16:33:00 +05:30 committed by Kishan Kavala
parent 31d870933d
commit 522208dec2
2 changed files with 7 additions and 5 deletions

View File

@ -1656,6 +1656,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
}
}
if (cmd.getDetails() != null) {
details.remove("Encrypted.Password"); // new password will be generated during vm deployment from password enabled template
details.putAll(cmd.getDetails());
}
if (!details.isEmpty()) {

View File

@ -2909,6 +2909,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
.getLimitCpuUse(), owner.getDomainId(), owner.getId(), offering.getId(), userData, hostName, diskOfferingId);
vm.setUuid(uuidName);
vm.setDynamicallyScalable(template.isDynamicallyScalable());
Map<String, String> details = template.getDetails();
if (details != null && !details.isEmpty()) {
vm.details.putAll(details);
}
if (sshPublicKey != null) {
vm.setDetail("SSH.PublicKey", sshPublicKey);
}
@ -2982,11 +2988,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
}
}
Map<String, String> details = template.getDetails();
if (details != null && !details.isEmpty()) {
vm.details.putAll(details);
}
_vmDao.persist(vm);
if (customParameters != null && customParameters.size() > 0) {
for (String key : customParameters.keySet()) {