CLOUDSTACK-4482: getVMPassword() API call does not return password for Vms that are deployed with password enabled templates.

Improving the error message saying no ssh key pair is assinged to VM to get the encrypted password and included a check for password enabled template

Signed-off-by: Koushik Das <koushik@apache.org>
(cherry picked from commit 37d500d2a6)

Signed-off-by: animesh <animesh@apache.org>
This commit is contained in:
Harikrishna Patnala 2013-08-27 11:46:26 +05:30 committed by animesh
parent daaba12997
commit 1e3eeacf2d
1 changed files with 2 additions and 1 deletions

View File

@ -3673,7 +3673,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
_userVmDao.loadDetails(vm);
String password = vm.getDetail("Encrypted.Password");
if (password == null || password.equals("")) {
InvalidParameterValueException ex = new InvalidParameterValueException("No password for VM with specified id found.");
InvalidParameterValueException ex = new InvalidParameterValueException("No password for VM with specified id found. " +
"If VM is created from password enabled template and SSH keypair is assigned to VM then only password can be retrieved.");
ex.addProxyObject(vm.getUuid(), "vmId");
throw ex;
}