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

(cherry picked from commit aa75b43885)
This commit is contained in:
Harikrishna Patnala 2014-06-11 16:33:00 +05:30 committed by Daan Hoogland
parent 891ec9bd54
commit 0667f678b8
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

@ -2898,6 +2898,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);
}
@ -2971,11 +2977,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()) {