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 2022/12/27 12:47:19 UTC
[GitHub] [cloudstack] shwstppr opened a new pull request, #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
shwstppr opened a new pull request, #7026:
URL: https://github.com/apache/cloudstack/pull/7026
### Description
Fixes #7025
### 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)
### Feature/Enhancement Scale or Bug Severity
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] 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 -->
<!-- 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
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#discussion_r1057692089
##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -58,6 +58,7 @@
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.PodVlanMapDao;
import com.cloud.dc.dao.VlanDao;
+import com.cloud.domain.Domain;
Review Comment:
```suggestion
```
--
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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1365890711
@DaanHoogland a 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
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#discussion_r1057669485
##########
utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java:
##########
@@ -741,4 +742,30 @@ public void testCidrNetmask() {
assertEquals("255.255.0.0", NetUtils.cidr2Netmask("169.254.0.0/16"));
assertEquals("255.255.240.0", NetUtils.cidr2Netmask("169.254.240.0/20"));
}
+
+ @Test
+ public void testGetAllIpsFromCidr() {
Review Comment:
how about asking for more IPs than a net contains?
i.e. asking for 55 ips on a /24 net
##########
utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java:
##########
@@ -741,4 +742,30 @@ public void testCidrNetmask() {
assertEquals("255.255.0.0", NetUtils.cidr2Netmask("169.254.0.0/16"));
assertEquals("255.255.240.0", NetUtils.cidr2Netmask("169.254.240.0/20"));
}
+
+ @Test
+ public void testGetAllIpsFromCidr() {
+ String cidr = "10.20.0.0";
+ int size = 22;
+ Set<Long> result = NetUtils.getAllIpsFromCidr(cidr, size, new TreeSet<>(), -1);
+ assertNotNull(result);
+ assertEquals(1022, result.size());
+ result = NetUtils.getAllIpsFromCidr(cidr, size, new TreeSet<>(), 255);
+ assertNotNull(result);
+ assertEquals(255, result.size());
+ result = NetUtils.getAllIpsFromCidr(cidr, size, new TreeSet<>(), 10);
+ assertNotNull(result);
+ assertEquals(10, result.size());
+ Long usedIp = NetUtils.ip2Long("10.20.0.100");
+ Set<Long> usedIps = new TreeSet<>();
+ usedIps.add(usedIp);
+ result = NetUtils.getAllIpsFromCidr(cidr, size, usedIps, -1);
+ assertNotNull(result);
+ assertEquals(1022 - usedIps.size(), result.size());
+ assertFalse(result.contains(usedIp));
+ result = NetUtils.getAllIpsFromCidr(cidr, size, usedIps, 50);
+ assertNotNull(result);
+ assertEquals(50, result.size());
+ assertFalse(result.contains(usedIp));
+ }
Review Comment:
these are sensible tests but should be in separate test methods imnsho
--
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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1367405465
@rohityadavcloud 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.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366453450
@shwstppr a 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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1367682482
<b>Trillian test result (tid-5694)</b>
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 37121 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7026-t5694-kvm-centos7.zip
Smoke tests completed. 101 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:
Test | Result | Time (s) | Test File
--- | --- | --- | ---
--
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
[GitHub] [cloudstack] rohityadavcloud commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
rohityadavcloud commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1367404736
@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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1365895903
Packaging result: :heavy_multiplication_x: el7 :heavy_multiplication_x: el8 :heavy_multiplication_x: el9 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 5096
--
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
[GitHub] [cloudstack] shwstppr commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
shwstppr commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366450732
@blueorangutan packgae
--
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
[GitHub] [cloudstack] DaanHoogland commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1365890354
@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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366449176
@shwstppr a 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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366492700
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_multiplication_x: el9 :heavy_check_mark: debian :heavy_multiplication_x: suse15. SL-JID 5105
--
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
[GitHub] [cloudstack] DaanHoogland merged pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
DaanHoogland merged PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026
--
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
[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#discussion_r1057692632
##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -137,6 +138,7 @@
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
+import com.cloud.vm.VirtualMachineManager;
Review Comment:
```suggestion
```
##########
server/src/main/java/com/cloud/network/NetworkModelImpl.java:
##########
@@ -137,6 +138,7 @@
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
+import com.cloud.vm.VirtualMachineManager;
Review Comment:
```suggestion
```
--
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
[GitHub] [cloudstack] codecov[bot] commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366560828
# [Codecov](https://codecov.io/gh/apache/cloudstack/pull/7026?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#7026](https://codecov.io/gh/apache/cloudstack/pull/7026?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1a9cdcb) into [4.17](https://codecov.io/gh/apache/cloudstack/commit/08881d69c78026a06dbede893bd2b18976bff5ed?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (08881d6) will **not change** coverage.
> The diff coverage is `0.00%`.
```diff
@@ Coverage Diff @@
## 4.17 #7026 +/- ##
=========================================
Coverage 10.36% 10.36%
Complexity 6628 6628
=========================================
Files 2453 2453
Lines 242386 242386
Branches 37928 37928
=========================================
Hits 25116 25116
Misses 214163 214163
Partials 3107 3107
```
| [Impacted Files](https://codecov.io/gh/apache/cloudstack/pull/7026?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../main/java/com/cloud/network/NetworkModelImpl.java](https://codecov.io/gh/apache/cloudstack/pull/7026/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2VydmVyL3NyYy9tYWluL2phdmEvY29tL2Nsb3VkL25ldHdvcmsvTmV0d29ya01vZGVsSW1wbC5qYXZh) | `9.92% <0.00%> (ø)` | |
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
--
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
[GitHub] [cloudstack] blueorangutan commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
blueorangutan commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366540365
Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 5112
--
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
[GitHub] [cloudstack] shwstppr commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
shwstppr commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366448834
@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
[GitHub] [cloudstack] shwstppr commented on pull request #7026: utils: fix NetUtils method to retrieve all IPs for a CIDR
Posted by GitBox <gi...@apache.org>.
shwstppr commented on PR #7026:
URL: https://github.com/apache/cloudstack/pull/7026#issuecomment-1366453071
@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