You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/07/06 16:17:56 UTC

[6/8] git commit: updated refs/heads/master to 31c6b14

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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/86297e70
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/86297e70
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/86297e70

Branch: refs/heads/master
Commit: 86297e70be8cd587ab07ba3109042ea782772624
Parents: efa3436
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Sat Jul 4 11:33:52 2015 +0200
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Sat Jul 4 11:33:52 2015 +0200

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java           | 11 ++++++++++-
 .../xenbase/CitrixUpdateHostPasswordCommandWrapper.java  |  4 ++--
 server/src/com/cloud/resource/ResourceManagerImpl.java   |  2 ++
 3 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86297e70/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 24970a6..b205f2d 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -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() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86297e70/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java
index d5a530b..9e58678 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java
@@ -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());
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/86297e70/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index b777de9..b450e31 100644
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -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();
     }