GitHub user wilderrodrigues opened a pull request: https://github.com/apache/cloudstack/pull/527
As an operator I want to be able to change the KVM hypervisor credentials API call (updateHostPassword) changes credentials on XenServer hypervisor but not on KVM. This should be extended also for KVM * Decouple the use of updateHostPassword - The code was hard to maintain because updating a host or all the hosts in a cluster was handled in the same method - Created updateHost and updateCluster password in both ResourceManager and ManagementServer interfaces/classes - The chck for whihc method to use is done in the API level - Started adding the support for KVM host password update * Fix a bug in the doUpdateHostPassword() method - 2 years ago a change in that method caused an issue when trying to update the hosts password: they would be updated in the database but not in the host it self, causing the hosts to disconnect after a management server restart. * Making possible to update KVM hosts password in the database via the API - Make sure the doUpdateHostPassword() method returns the result from the answer, not always true - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent that will be further implemented in the future. The command will avoid the agent to complain about Unsupported command - Added a test to make sure the current implementation of the comment works. If changes in the future, it will also require changes. In that way, we make sure nobody will break it I already did basic manual tests with Management Server running on CentOS 7.1; 2 XenServer hosts; and 1 KVM host. All deployed in 2 advances zones. I was able to successfully execute: Update KVM host - update hostpassword hostid=95aa28ae-8038-4457-8951-504e760b53a4 username=root password=admin Update 1 XenServer host - update hostpassword hostid=9b236e34-0cc7-4d36-8b01-925fb10b4c25 username=root password=password Update a XenServer cluster - update hostpassword hostid=9b236e34-0cc7-4d36-8b01-925fb10b4c25 clusterid=fb58b84d-f9bb-4603-8b85-b56a49e1676f username=root password=password I also created isolated networks and virtual machines. The machines deployed on the XenServer zone also used affinity groups. I deployed 1 virtual machine in the KVM zone. @DaanHoogland @remibergsma @bhaisaab Please, do not merge yet. I will also run the integration/smoke tests. Cheers, Wilder You can merge this pull request into a Git repository by running: $ git pull https://github.com/schubergphilis/cloudstack improvement/CS_180 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/527.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #527 ---- commit 2ed74d51187e5e6706d6f5ea9ebb84d3cda15feb Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-24T11:04:35Z Initial work on improveing host password update - Formatting the code of ManagementServerImpl commit 1eff70ad44f1df2947e47aac7e5d18e51f41a637 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-24T11:12:07Z Formatting the code of the ManagementService class commit 21b8ea04bb205bc5b0c62a82eb8cb54730c49a42 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-24T11:33:04Z Formatting UpdateHostPasswordCmd class - Needs to be formatted before applying other changes commit 5f6279135b8d7b58719b3791edd063cab0221d34 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-24T11:39:43Z Formatting the ResourceManagerImpl class - Needed to be formatted before applying the changes commit e3ea66a507d2b32919789391106a4886a69a7d5f Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-24T11:59:50Z Decouple the use of updateHostPassword - The code was hard to maintain because updating a host or all the hosts in a cluster was handled in the same method - Created updateHost and updateCluster password in both ResourceManager and ManagementServer interfaces/classes - The chck for whihc method to use is done in the API level - Started adding the support for KVM host passwd update No API changes are needed and it will be backwards compatible. commit d4e17e598ea74973ead2426e4aa250f9ef2fa4d4 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T06:33:52Z Add method implementation to the mock class. commit 096639d90bb20364187e4b1828e6635d9c1b4ece Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T07:47:40Z Add supported hypervisors to a list - By doing so the check is simple and will require less effort when adding other hypervisors. commit a8305ce3918995bfa286a1118b37590692437579 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T09:03:06Z Formatting the code of the AgentManagerImpl class commit 0e2dd64addc5d561ec691210381f5bd8cc45952f Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T09:04:58Z Extracting local variable in order to make the code more readable. commit 88420baabe369726d0b73e5f7a73843175551527 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T09:14:31Z In case we cannot update the password of all hosts in a cluster, please stop and notify the user about the failure. - The host id that failed to get updated will be informed in the error. commit 6b5f56a8db6b2e49c7f444bd117e20a59b87b490 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T10:09:09Z Improving exception message - Adding both ID and UUID of the host commit f2c55f8a7c62cefb869a4d9a7b4907c3d93d7885 Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T11:29:22Z Fix a bug in the doUpdateHostPassword() method - 2 years ago a change in that method caused an issue when trying to update the hosts password: - they would be updated in the databse but not in the host it self, causing the hosts to disconnect after a management server resstart commit 07cee4116c5a7a1b582181b20b034e8b344f6d9c Author: wilderrodrigues <wrodrig...@schubergphilis.com> Date: 2015-06-25T12:32:51Z Making possible to update KVM hosts password in the database via the API - Make sure the doUpdateHostPassword() method returns the result from the answer, not always true - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent That's will be further implemented in the future. The command will avoid the agent to complain about Unsupported command - Added a test to make sure the current implementation of the comment works - If changes in the future, it will also require changes. In that way, we make sure nobody will break it ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---