Updated Branches: refs/heads/master 263062526 -> 5a8a2a259
CLOUDSTACK-2792: Send "saved_password" to BACKUP router when reset password for user VM Otherwise when MASTER failed, the user VM would get password reset again after reboot. But this fix still have issues if MASTER is failure before VM boot up, but in that case, password of user VM won't change and user would request password change again, then it would be fine. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5a8a2a25 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5a8a2a25 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5a8a2a25 Branch: refs/heads/master Commit: 5a8a2a259ea6e049b3e5810ff3a432d6ca7767e1 Parents: fbe6b27 Author: Sheng Yang <sheng.y...@citrix.com> Authored: Fri May 31 16:29:03 2013 -0700 Committer: Sheng Yang <sheng.y...@citrix.com> Committed: Thu Jun 13 16:05:15 2013 -0700 ---------------------------------------------------------------------- .../network/router/VirtualNetworkApplianceManagerImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a8a2a25/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 01f86ec..8da5176 100755 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -3353,7 +3353,12 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V // password should be set only on default network element if (password != null && nic.isDefaultNic()) { - final String encodedPassword = PasswordGenerator.rot13(password); + String encodedPassword = PasswordGenerator.rot13(password); + // We would unset password for BACKUP router in the RvR, to prevent user from accidently reset the + // password again after BACKUP become MASTER + if (router.getIsRedundantRouter() && router.getRedundantState() != RedundantState.MASTER) { + encodedPassword = PasswordGenerator.rot13("saved_password"); + } SavePasswordCommand cmd = new SavePasswordCommand(encodedPassword, nic.getIp4Address(), profile.getVirtualMachine().getHostName()); cmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId())); cmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, getRouterIpInNetwork(nic.getNetworkId(), router.getId()));