CLOUDSTACK-8607 - Make sure the new password replaces the old one in the queue

- Added log info to show details of the operation
   - Renamed the addPwdToQueue to replaceOldPasswdInQueue
This commit is contained in:
wilderrodrigues 2015-07-04 11:33:52 +02:00
parent efa34361df
commit 86297e70be
3 changed files with 14 additions and 3 deletions

View File

@ -271,8 +271,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
public CitrixResourceBase() {
}
public void addToPwdQueue(final String password) {
/**
* Replaces the old password with the new password used to connect to the host.
*
* @param password - the new host password.
* @return the old password.
*/
public String replaceOldPasswdInQueue(final String password) {
final String oldPasswd = _password.poll();
_password.add(password);
return oldPasswd;
}
public String getPwdFromQueue() {

View File

@ -58,8 +58,8 @@ public final class CitrixUpdateHostPasswordCommandWrapper extends CommandWrapper
} catch (final Exception e) {
return new Answer(command, false, e.getMessage());
}
// Add new password to the stack.
citrixResourceBase.addToPwdQueue(command.getNewPassword());
// Add new password to the queue.
citrixResourceBase.replaceOldPasswdInQueue(newPassword);
return new Answer(command, result.first(), result.second());
}
}

View File

@ -2240,6 +2240,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
final UpdateHostPasswordCommand cmd = new UpdateHostPasswordCommand(username, password, hostIpAddress);
final Answer answer = _agentMgr.easySend(hostId, cmd);
s_logger.info("Result returned from update host password ==> " + answer.getDetails());
return answer.getResult();
}