You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "JSpon (via GitHub)" <gi...@apache.org> on 2024/05/14 01:02:49 UTC
[PR] Fix comparison of Long objects to use primitives [cloudstack]
JSpon opened a new pull request, #9079:
URL: https://github.com/apache/cloudstack/pull/9079
### Description
This PR...
<!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
fixes a bug that compares two Long objects, instead of their primitives. The comparison of two Long objects with the same underlying long value returned as not equal, throwing an error even though the public IP address was correctly assigned to the VPC associated with the guest network. This issue does not occur when comparing the primitives.
When this issue occurs, any cluster using a guest network in a particular VPC will always throw the error.
<!-- 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: # -->
<!--- ******************************************************************************* -->
<!--- NOTE: AUTOMATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
<!--- PLEASE PUT AN 'X' in only **ONE** box -->
<!--- ******************************************************************************* -->
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] Enhancement (improves an existing feature and functionality)
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
- [ ] build/CI
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [X] Critical
- [ ] Major
- [ ] Minor
- [ ] Trivial
### 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 -->
In a test environment, any attempt to create a CKS cluster on a specific VPC always returned the error "Public IP with ID: ... linked to the Kubernetes cluster: ... is not usable". The public IP address was correctly attached, and debugging showed that they had the same long value. The code was compiled with this update and put in a jar earlier in the classpath, and the CKS cluster was created successfully.
#### How did you try to break this feature and the system with this change?
<!-- see how your change affects other areas of the code, etc. -->
<!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #9079: Fix comparison of Long objects to use primitives
URL: https://github.com/apache/cloudstack/pull/9079
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "rajujith (via GitHub)" <gi...@apache.org>.
rajujith commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-3742050126
@JSpon Since this is for the 4.22.1 release, could you retarget the PR to the 4.22 branch?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958919501
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
It seems that the issue was already fixed on 4.20.0+ with #8906, but it wasn't ported to 4.19.
@JSpon, could you target 4.19 and backport the code from main?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2332274872
@rohityadavcloud a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2334759486
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2123209162
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/9079?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 4.26%. Comparing base [(`21af134`)](https://app.codecov.io/gh/apache/cloudstack/commit/21af134087a55c044f921b3f6ab64aba83b80071?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`e41e1cb`)](https://app.codecov.io/gh/apache/cloudstack/pull/9079?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #9079 +/- ##
============================================
- Coverage 15.28% 4.26% -11.02%
============================================
Files 5425 363 -5062
Lines 474138 29565 -444573
Branches 58984 5190 -53794
============================================
- Hits 72486 1262 -71224
+ Misses 393584 28160 -365424
+ Partials 8068 143 -7925
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/9079/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/9079/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.26% <ø> (ø)` | |
| [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/9079/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/9079?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328037935
@rohityadavcloud a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-3804412631
@JSpon , it seems this never got the attention it needed. I am closing it. Can you re-evaluate and re-open if needed?
cc @shwstppr @CodeBleu @winterhazel @weizhouapache
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2332270774
@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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328276237
@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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958929330
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
> It seems that the issue was already fixed on 4.20.0+ with #8906, but it wasn't ported to 4.19.
>
> @JSpon, could you target 4.19 and backport the code from main?
@winterhazel that to me doesn't look like the code that is in this PR. I still think 4.20+ needs this change. Unless I'm looking at it wrong.
I'm basically just looking at this file, since this is the file I changed and re-compiled and deployed and it worked for me. `plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java`
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328186011
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 10943
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328413227
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10949
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958942754
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
@CodeBleu `network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()` (the changes in this PR) and `!Objects.equals(network.getVpcId(), address.getVpcId())` (the existing code in main and 4.20) will have the same result here.
See the code in the 4.19 branch, its comparing the `Long` objects instead, resulting in the issue that the comment mentions:
https://github.com/apache/cloudstack/blob/212f2a3898c46a09b2515c954af8d61d995bcf56/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java#L363
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2147380443
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2148121636
@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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328035403
@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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2149149701
<b>[SF] Trillian test result (tid-10344)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 48222 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9079-t10344-kvm-centos7.zip
Smoke tests completed. 130 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_02_trigger_shutdown | `Failure` | 351.99 | test_safe_shutdown.py
test_hostha_enable_ha_when_host_disabled | `Error` | 3.15 | test_hostha_kvm.py
test_hostha_enable_ha_when_host_in_maintenance | `Error` | 303.18 | test_hostha_kvm.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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #9079: Fix comparison of Long objects to use primitives
URL: https://github.com/apache/cloudstack/pull/9079
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2664860698
> @JSpon @DaanHoogland FYI - I was able to take this code change and build it into a .jar file and run it on the management server and was also able to successfully create the K8S cluster in the VPC
I would say that sounds as a successful test ;)
There is a conflict @JSpon , could you resolve that.
Also de we feel this needs to go on another release branch than main? (i.e. 4.19 or 4.20?)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-3625670951
> @JSpon can you address the conflicts on this please?
>
> @DaanHoogland what is the status of this. I was looking into creating CKS cluster in a VPC again and noticed this is now in Draft. Isn't this what is needed to be able to deploy a CKS cluster in a VPC? What is the minimum version of Cloudstack this will be in?
Depending on the branch the conflict will be resolved against?! I suppose 4.22 is good. It needs work though (hence the draft status)
> CC: @harikrishna-patnala ( I see you changed the milestone on this, so maybe you have some insight into this as well? )
@harikrishna-patnala changed the milestone to the minor version following the one that was just released, @CodeBleu . Just an administrative action on his part, no policy decision.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2147376657
@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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "shwstppr (via GitHub)" <gi...@apache.org>.
shwstppr commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1626960678
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -361,7 +361,7 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || network.getVpcId() != address.getVpcId()) {
+ if (address == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
Could there be possibilities of an NPE?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958929330
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
> It seems that the issue was already fixed on 4.20.0+ with #8906, but it wasn't ported to 4.19.
>
> @JSpon, could you target 4.19 and backport the code from main?
@winterhazel that to me doesn't look like the code that is in this PR. I still think 4.20+ needs this change. Unless I'm looking at it wrong.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "winterhazel (via GitHub)" <gi...@apache.org>.
winterhazel commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958942754
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
@CodeBleu `network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()` (the changes in this PR) and `!Objects.equals(network.getVpcId(), address.getVpcId())` (the existing code in main and 4.20) will have the same result here.
See the code in the 4.19 branch, its comparing the `Long` objects instead:
https://github.com/apache/cloudstack/blob/212f2a3898c46a09b2515c954af8d61d995bcf56/plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java#L363
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2664936643
> > o a .jar file and run it on the management server and was also able to successfully create the K8S cluster in the VPC
>
> I would say that sounds as a successful test ;)
>
> There is a conflict @JSpon , could you resolve that.
>
> Also de we feel this needs to go on another release branch than main? (i.e. 4.19 or 4.20?)
if the issue exists in 4.19 or 4.20, it would be better to rebase with 4.19/4.20
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-3609023710
@JSpon can you address the conflicts on this please?
@DaanHoogland what is the status of this. I was looking into creating CKS cluster in a VPC again and noticed this is now in Draft. Isn't this what is needed to be able to deploy a CKS cluster in a VPC? What is the minimum version of Cloudstack this will be in?
CC: @harikrishna-patnala ( I see you changed the milestone on this, so maybe you have some insight into this as well? )
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2328277699
@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2109080567
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:
- In case of a new feature add useful documentation (raise doc PR at https://github.com/apache/cloudstack-documentation)
- Be patient and persistent. It might take some time to get a review or get the final approval from the committers.
- Pay attention to the quality of your code, ensure tests are passing and your PR doesn't have conflicts.
- Please follow [ASF Code of Conduct](https://github.com/apache/.github/blob/main/.github/CODE_OF_CONDUCT.md) for all communication including (but not limited to) comments on Pull Requests, Issues, Mailing list and Slack.
- Be sure to read the [CloudStack Coding Conventions](https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions).
Apache CloudStack is a community-driven project and together we are making it better 🚀.
In case of doubts contact the developers at:
Mailing List: dev@cloudstack.apache.org (https://cloudstack.apache.org/mailing-lists.html)
Slack: https://apachecloudstack.slack.com/
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "JSpon (via GitHub)" <gi...@apache.org>.
JSpon commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2145815438
Is there something I should do to get this progressed? If there are any concerns, please let me know. Thanks.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2148124587
@DaanHoogland a [SL] 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "sureshanaparti (via GitHub)" <gi...@apache.org>.
sureshanaparti commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2943545773
hi @JSpon please resolve the conflicts.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2654765403
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "weizhouapache (via GitHub)" <gi...@apache.org>.
weizhouapache commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1743326005
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -361,7 +361,7 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || network.getVpcId() != address.getVpcId()) {
+ if (address == null || !address.getVpcId().equals(network.getVpcId()) {
Review Comment:
```suggestion
if (address == null || !network.getVpcId().equals(address.getVpcId())) {
```
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1905134315
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
What cerconstances are those @JSpon ? as both `network.getVpcId()` and `address.getVpcId()` return an object of type `Long`, this should work with the `Long.equals()` method.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2333525541
<b>[SF] Trillian test result (tid-11385)</b>
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 51481 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9079-t11385-kvm-ol8.zip
Smoke tests completed. 137 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_isolate_network_password_server | `Failure` | 10.14 | test_password_server.py
test_01_secure_vm_migration | `Error` | 136.54 | test_vm_life_cycle.py
test_01_secure_vm_migration | `Error` | 136.55 | test_vm_life_cycle.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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2147376225
@JSpon , well, you could find a 3rd party tester and a second reviewer. the rules are two reviews of which one did a test. I'll at least run some regression tests.
also see https://github.com/apache/cloudstack/actions/runs/9072065551/job/25241922319?pr=9079#step:7:5497
I think there are some errors in the github actions.
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2147543245
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9777
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1627167985
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -361,7 +361,7 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || network.getVpcId() != address.getVpcId()) {
+ if (address == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
good point, I was thinking .equals() should work as well but then forgot to look further. @JSpon can you eliminate that possibility?
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#issuecomment-2664259041
@JSpon @DaanHoogland FYI - I was able to take this code change and build it into a .jar file and run it on the management server and was also able to successfully create the K8S cluster in the VPC
--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix comparison of Long objects to use primitives [cloudstack]
Posted by "CodeBleu (via GitHub)" <gi...@apache.org>.
CodeBleu commented on code in PR #9079:
URL: https://github.com/apache/cloudstack/pull/9079#discussion_r1958929330
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -360,7 +360,8 @@ protected IpAddress getVpcTierKubernetesPublicIp(Network network) {
return null;
}
IpAddress address = ipAddressDao.findByUuid(detailsVO.getValue());
- if (address == null || !network.getVpcId().equals(address.getVpcId())) {
+ // Under certain circumstances, Long objects may differ even though they have the same primitive value. Compare the primitive values
+ if (address == null || network.getVpcId() == null || address.getVpcId() == null || network.getVpcId().longValue() != address.getVpcId().longValue()) {
Review Comment:
> It seems that the issue was already fixed on 4.20.0+ with #8906, but it wasn't ported to 4.19.
>
> @JSpon, could you target 4.19 and backport the code from main?
@winterhazel that to me doesn't look like the code that is in this PR. I still think 4.20+ needs this change. Unless I'm looking at it wrong.
I'm basically just looking at this file, since this is the file I changed and re-compiled and deployed and it worked for me. `plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java`
#8906 shows these changes which is different from above.

--
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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org