You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/08/10 15:45:36 UTC

[GitHub] [cloudstack] RodrigoDLopez opened a new pull request #4255: Prevent null pointer on listPublicIpAddress cmd

RodrigoDLopez opened a new pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255


   ## Description
   <!--- Describe your changes in detail -->
   I reproduced this in a production environment that had been upgraded from 4.9 to 4.11 and then to 4.13.  
   
   If the environment has `data centers` and `VLANs` removed, sends an API request with the command `listPublicIpAddress` and allocatedOnly=false we can see this error:
   ```
   2020-07-29 08:15:16,224 ERROR [c.c.a.ApiServer] (qtp504527234-1307:ctx-d9b6eb3f ctx-a0add444) (logid:b94eb35a) unhandled exception executing api command: [Ljava.lang.String;@6177c5d4
   java.lang.NullPointerException
   ```
   
   This occurs because `ManagementService.searchForIPAddresses` returns IP addresses from those deleted `data centers`. And then we have a Null Pointer exception when building the `createIPAddressResponse`.  
   This PR prevents this null pointer exception by doing an `INNER_JOIN` with `data_center` table were `removed` is null.
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ## Screenshots (if appropriate):
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   To test this, I run the `listPublicIpAddrescomand` with `allocatedOnly = false` using `cloudmonkey` to make the request
   **Before the fix:**
   ```
   cloudmonkey listpublicipaddresses allocatedonly=false
   Error: (HTTP 530, error code 9999) <nil>
   ```
   
   **After the fix:**
   ```
   cloudmonkey listpublicipaddresses allocatedonly=false
   {
     "count": 755,
     "publicipaddress": [...]
   }
   ```
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] RodrigoDLopez commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
RodrigoDLopez commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-671522909


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-672193997


   <b>Trillian test result (tid-2355)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 38953 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4255-t2355-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 82 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL | `Failure` | 396.60 | test_vpc_redundant.py
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd merged pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-671779658


   @blueorangutan test


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on a change in pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#discussion_r469499226



##########
File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
##########
@@ -1985,6 +1985,10 @@ private boolean hasSuitablePoolsForVolume(final VolumeVO volume, final Host host
         vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
         sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);
 
+        SearchBuilder<DataCenterVO> zoneSearchBuilder = _dcDao.createSearchBuilder();

Review comment:
       That's great! :slightly_smiling_face:




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-673680185


   <b>Trillian test result (tid-2397)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 45514 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4255-t2397-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 82 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | `Failure` | 424.91 | test_vpc_redundant.py
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-672196848


   redundant vpc would not have much ado with listIps but to be sure
   @blueorangutan test


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-672197197


   @DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] RodrigoDLopez commented on a change in pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
RodrigoDLopez commented on a change in pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#discussion_r469428859



##########
File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
##########
@@ -1985,6 +1985,10 @@ private boolean hasSuitablePoolsForVolume(final VolumeVO volume, final Host host
         vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
         sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);
 
+        SearchBuilder<DataCenterVO> zoneSearchBuilder = _dcDao.createSearchBuilder();

Review comment:
       I did not see that. thanks for the hint
   work like a charm adding this removed filter for Vlan Search.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-671523338


   @RodrigoDLopez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-671779982


   @DaanHoogland a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on a change in pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#discussion_r469397649



##########
File path: server/src/main/java/com/cloud/server/ManagementServerImpl.java
##########
@@ -1985,6 +1985,10 @@ private boolean hasSuitablePoolsForVolume(final VolumeVO volume, final Host host
         vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
         sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);
 
+        SearchBuilder<DataCenterVO> zoneSearchBuilder = _dcDao.createSearchBuilder();

Review comment:
       I think that it would be better to implement this via the VLAN Search Builder instead of adding the proposed search builder. Here are a few points of why I think it would be better:
   
   1. All removed zones should have its networks removed anyway, therefore VLANs of a removed zone are marked as removed as well;
   2. this could also prevent issues of selecting IP addresses of removed VLANs on an existing Zone;
   3. and, at the end, it reduces costs of one extra join.
   
   Currently lines 1984 - 1986:
   ```
   final SearchBuilder<VlanVO> vlanSearch = _vlanDao.createSearchBuilder();
   vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
   sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);
   ```
   
   Changing current VLAN search builder adding a verification "_WHERE removed IS NULL_":
   ```
   final SearchBuilder<VlanVO> vlanSearch = _vlanDao.createSearchBuilder();
   vlanSearch.and("vlanType", vlanSearch.entity().getVlanType(), SearchCriteria.Op.EQ);
   vlanSearch.and("removed", vlanSearch.entity().getRemoved(), SearchCriteria.Op.NULL);
   sb.join("vlanSearch", vlanSearch, sb.entity().getVlanId(), vlanSearch.entity().getId(), JoinBuilder.JoinType.INNER);SearchCriteria.Op.NULL);
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #4255: Prevent null pointer on listPublicIpAddress cmd

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #4255:
URL: https://github.com/apache/cloudstack/pull/4255#issuecomment-671540776


   Packaging result: ✔centos7 ✔debian. JID-1700


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org