GitHub user miguelaferreira opened a pull request: https://github.com/apache/cloudstack/pull/737
CLOUDSTACK-8758: Handle redirects in communication with NXS controller (a.k.a. Nicira NVP) When an NSX controller node is part of a cluster it will redirect API calls to the master controller. Because the ACS management server does not follow such redirects, if there is a change of master within a NSX controller, the NSX device (a.k.a. NiciraNvp) needs to be reconfigured (via the management server DB). The goal of this PR is to enable ACS management server to follow HTTP redirects sent by NSX controllers. However, other changes were made to the cloud-utils module that provides the REST client that the NSX plugin uses. Cosmetic changes: * Upgrade maven module structure for cloud-utils and cloud-plugin-netowkr-nvp to comply with maven default * Several refactorings on both modules to consistently format the code, remove unused code, declare final when possible, remove auto generated comments, etc Other changes: * Upgrade HTTP library used in REST client to latest version of Apache HTTP Components * Implement NSX specific REST client that support following HTTP redirects * Simplify NSX api implementation * Previously existing unit tests for both the REST client and NSX api were either maintained in the same test classes, moved to new test classes (because code under tests also moved), or removed (because code under tests was also removed) * New Marvin tests for NSX controllers Testing: * Ran all unit tests present in the project * Ran Java Integration tests for NSX api targeting both a master and a slave controller * Ran new Marvin test for NSX controller * Manual inspection of logs to confirm redirection is taking place You can merge this pull request into a Git repository by running: $ git pull https://github.com/miguelaferreira/cloudstack feature/mferreira/ncx-follow-redirects-gardened-rebase Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/737.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 #737 ---- commit 31679f7dbcb861277b03849f5ffa7a805192f3ec Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-05T14:03:28Z Create Nicira NVP devices and enable plugin at deploy commit fcd39e8586ae367e946b327409c0390ac23b0cb5 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-21T15:39:02Z Add Marvin test for Nicira NVP plugin commit 357a223cc210a27696eada3abfa37df33b574739 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-23T14:11:06Z Fix unit-test library dependencies - XML formatting - Fix license header - Reorder hamcrest, junit, mockito and powermock dependencies * Since several libraries include a subset of hamcrest classes, hamcrest should be declared first in the pom, inorder for its classes to be loaded first by the JVM - Depdend on hamcrest-all and exclude hamcrest classes from other libraries commit a92c419231f1383f66929e59a8c9e2de2e3e70f7 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-23T14:03:11Z Refactor cloud-utils project into Maven default structure commit ebe27281651ac7a0e8959c48aa41948a25006e0d Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T18:48:27Z Refactor cloud-plugin-network-nvp project into Maven default structure commit 9018ab4be818c418779d44bcde0a2b9b8e1ea366 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T18:53:12Z Code clean up in cloud-utils project - Code formatting - Remove unused methods commit fafc33c7bf2ca65eafc9a0ee78ee8ae6781dd32e Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-21T15:44:57Z Add basic RestClient implentation based on HTTP Components 4.5 - Upgrade version of HTTP Components to 4.5 - Add helper class to create Http clients - Add helper class to build http requests - Add enum with the different Http Methods - Add constants class for HTTP related values commit 87e5852edb22910b57d756a656f361638810f0ae Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T18:53:28Z Code clean up in cloud-plugin-network-nvp project - Code formatting - Declare final where possible - Remove unused methods - Remove throws declarations where not needed - Remove generated comments (e.g. "TODO Auto-generated method stub") commit 151ed6e032ba5a7a0bb0e8b89fbe48fea71664ac Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-23T13:11:29Z Delegate HTTP protocol activity in RESTServiceConnector to RestClient - All HTTP protocol activities are now handled by RestClient - This service is now only responsible for creating requests, and dispatching them to the client - Provides a Simple API for creating, updating, retrieving and deleting objects commit 4af32bcf13ad3f30a4f30a24a1c86bb0eb4031a0 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T14:12:12Z Refactor NSX api implementation (NiciraNvpApi) - Make internal method private - Remove unused methods - Refactor type deserialization adapter classes out commit 06450d95d6410575f25d56a3ff2fb1ad65c00bf0 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T15:05:30Z Add NSX specific RestClient implementation - Add -noverify JVM arg to surefire plugin, to allow Powermockito to de-encapsulate private methods - Add dependency on cloud-utils test-jar to use custom HttpRequest matchers commit f6708866f2e6af6d06cf658c04574aac659011d5 Author: Miguel Ferreira <miguelferre...@me.com> Date: 2015-08-22T15:30:58Z Use NSX specific RestClient in API implementation (NiciraNvpApi) - Simplify public API to return Lists instead of NiciraNvpLists ---- --- 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. ---