Repository navigation
Conversation
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14217 +/- ##
============================================
+ Coverage 3.86% 21.18% +17.32%
- Complexity 0 21612 +21612
============================================
Files 494 6080 +5586
Lines 42890 552086 +509196
Branches 8142 73995 +65853
============================================
+ Hits 1657 116974 +115317
- Misses 41001 421294 +380293
- Partials 232 13818 +13586
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
a4394f9 to
f3ad009
Compare
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
f3ad009 to
6ba5120
Compare
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
6ba5120 to
590e476
Compare
|
@blueorangutan package |
|
@Damans227 a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19501 |
Damans227
left a comment
There was a problem hiding this comment.
thanks @rootnomad, tested both fixes on a kvm lab and they work. LGTM
|
tested the two fixes from 1bade4b on a kvm lab. a bad range is refused and no network is left behind. shrinking with guestvmcidr is refused when the range wont fit, and works when it does. |
|
@blueorangutan test |
|
@blueorangutan test |
|
@RosiKyu a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
can we simply honor the start_ip and end_ip, instead of introducing new columns ? |
|
[SF] Trillian test result (tid-17614)
|
|
@rootnomad the smoke run on the current commit has 5 errors, and one of them is the new test from this PR: Could you please also answer @weizhouapache's question above (using the existing start_ip and end_ip instead of the new columns), and look at the 3 open review threads from @DaanHoogland? I will run the lab test once the design question is settled and the new test passes. Thank you! |
|
@weizhouapache good point. Reworked in 8f911ef to drop the new columns: the custom DHCP range is now stored as network details (dhcpStartIp, dhcpEndIp) instead of the dhcp_start_ip and dhcp_end_ip columns, and read back from the details during guest IP allocation, on the Guest VM CIDR reservation check and in the network response. I kept it off the vlan IP range table on purpose, since a SourceNat isolated network creates no vlan range (it allocates guest IPs straight from the CIDR), so network details is the minimal fit without changing how isolated networks allocate. @RosiKyu the design is settled above. The new smoke test failure was a cleanup ordering bug in the test, not the feature: the asserts passed (the VM got an IP inside the custom range), it only failed in tearDown because the network was deleted before the VM. Fixed by deleting the VM first. @DaanHoogland the reservation-within-CIDR check is now extracted into its own method with javadoc. The getDhcpStartIp accessor was removed in favour of the detail keys, so that earlier javadoc suggestion no longer applies. Ready for the lab re-run. |
|
@rootnomad thank you for the rework and the test fix! |
|
@blueorangutan package |
|
@RosiKyu a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
thanks @rootnomad for the update. a few things I noticed:
|
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 20189 |
dd21d46 to
9582ea4
Compare
|
Thanks @weizhouapache.
Unit tests cover the gate and the update path; smoke tests check a VM lands in the range on a standalone network, after an update, and on a source NAT VPC tier. |
thanks please also consider secondary/additional IPs too
|
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
An isolated guest network allocates guest IPs from the whole CIDR, so there is no way to reserve part of the address space or restrict the DHCP pool. createNetwork already takes startip and endip, but they were only used for shared networks. This stores the start and end IP on an isolated network as a DHCP range, in two new networks columns dhcp_start_ip and dhcp_end_ip, validated to be within the network CIDR, in order, and not to include the gateway. NetworkModelImpl.getAvailableIps then restricts the guest IP pool to that range when it is set. The dnsmasq config on the VR is unchanged, since it serves the host entry CloudStack writes for the IP it allocated, so no system VM template change is needed. Without a range the whole CIDR is used, so existing networks are unaffected. The range is returned by listNetworks.
Show the start/end IP fields on the isolated network create form once a gateway is set, and surface the range on the network details tab so an operator can see and set the guest IP allocation window without the API.
… it on reservation Validate a custom isolated-network DHCP range before committing the network, so a range outside the CIDR (or reversed, or over the gateway) is rejected up front instead of throwing after the network is saved and leaving an orphaned network. The checks move into validateIsolatedNetworkDhcpRange, reused by storeIsolatedNetworkDhcpRange. Also reject an IP reservation (guestvmcidr) that would leave the stored DHCP range outside the reserved Guest VM CIDR, which would otherwise starve guest IP allocation.
Addresses the review request not to introduce new columns. The optional custom DHCP range for an isolated network is now stored as network details (dhcpStartIp, dhcpEndIp) instead of dedicated dhcp_start_ip and dhcp_end_ip columns on the networks table, and read back from the details during guest IP allocation, on the Guest VM CIDR reservation check and when building the network response. The reservation-within-CIDR check is extracted into its own method.
… allow updating it A custom DHCP range applies to an isolated network that allocates guest IPs from its CIDR, that is a network with source NAT. This covers a standalone source NAT isolated network and a source NAT VPC tier, both of which allocate from the CIDR. A routed (non source NAT) isolated network and a shared network keep start and end IP for their own IP range. Add updateNetwork start and end IP to change or clear the range on an existing network, validated before it is persisted so a bad range leaves the existing one in place.
acquireGuestIpAddress filtered the random pick to the custom DHCP range, but a specific requested IP was only checked against the CIDR, so a secondary IP, a VM deployed with an IP or a NIC IP update could still take an address outside the range. Reject a requested IP that is not in the allocatable set. Without a custom range that set is every free address in the CIDR, so nothing changes for other networks.
9582ea4 to
91b95d2
Compare
|
Thanks @weizhouapache, you were right. A secondary IP outside the range was still allowed, same for a VM deployed with a specific IP. Fixed in 4222ed4 and added your three cases to the smoke test, it passes on a 2 host KVM env. Also rebased on main for the conflict. |
91b95d2 to
2504c02
Compare
…dation paths Cover assertCustomDhcpRangeWithinGuestVmCidr, the DHCP range validation without an end IP or a gateway and with an end IP outside the CIDR, an unknown offering on update, and getAvailableIps with a half set range.
Description
An isolated guest network allocates guest IPs from the whole CIDR, so there is no way
to reserve part of the address space or keep the DHCP pool to a sub-range. createNetwork
already takes startip/endip, but NetworkServiceImpl only uses them for shared
networks.
This stores the start and end IP on an isolated network as a DHCP range, in two new
networks columns dhcp_start_ip/dhcp_end_ip, validated to be within the network CIDR,
in order, and not to include the gateway. NetworkModelImpl.getAvailableIps then restricts
the guest IP pool to that range when it is set; without one the whole CIDR is used, so
existing networks are unaffected.
The dnsmasq config on the VR is unchanged: for an isolated network it serves the host entry
CloudStack writes for the IP it allocated, so constraining the allocation is enough and no
system VM template change is needed. The range is returned by listNetworks as startip
and endip.
Creating an isolated network with a range needs gateway and netmask passed too
(already enforced by createNetwork), so the CIDR is deterministic. The create form shows
the start and end IP fields once a gateway is entered, and the network details tab shows the
range on an existing network, so the whole flow is usable from the UI.
Fixes: #12661
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):


Isolated network detail showing the DHCP range, and the deployed VMs leased inside it.
How Has This Been Tested?
Unit tests in server, 101 green. NetworkModelImplTest adds two for getAvailableIps:
the pool is restricted to the range when set, and is the whole CIDR (minus the gateway)
when it is not. NetworkServiceImplTest adds five for the validation: a valid range is
stored, the end defaults to the start, and a range outside the CIDR, a start greater than
the end, or a range that includes the gateway are each rejected. DatabaseUpgradeCheckerTest
is green with the schema change. The two changed UI files pass eslint clean.
Manually on a KVM advanced zone. Created an isolated network with gateway 10.99.99.1,
netmask /24 and a DHCP range 10.99.99.10-10.99.99.20, confirmed listNetworks returned
that range, then deployed three VMs on it. All three leased inside the range
(10.99.99.14, .15, .19), where without the change they would draw from the whole /24.
How did you try to break this feature and the system with this change?
at create time.
networks and shared networks are unchanged.