Commit 0cc8922
committed
Direct Routed (L3) guest networks: route public IPv4/IPv6 directly to Instances
Add a guest network type in which the hypervisor performs L3 routing
for the Instance: no Virtual Router, no NAT and no DHCP. Each Instance
receives a public IPv4 address as a /32 and/or an IPv6 address as a
/128, with a shared, host-independent link-local gateway (169.254.0.1
and fe80::1) that every hypervisor carries. All addressing reaches the
Instance exclusively via ConfigDrive/cloud-init; a routing daemon on
the host (FRR, BIRD, ...) advertises the addresses to the fabric and is
deliberately out of scope for CloudStack.
The networks live on a dedicated physical network with the new ROUTED
isolation method, so the feature can be added to existing zones without
touching anything already running there. Each network carries a
routed://<id> broadcast domain - the id allocated from the physical
network's vnet range or chosen by the operator - naming the network's
uplink-less bridge (brdr-<id>) that the new modifybrdr.sh manages on
every host: gateway addresses, forwarding sysctls, strict rp_filter,
and a MAC derived from the routed id so it is identical on every
hypervisor and live migration never invalidates the guest's neighbour
cache. The existing modifymacip.sh installs the per-address host route
and static neighbour entry when a NIC is plugged.
Both address families are optional and IPv6-only networks are
supported: IPv4 is a subnet (cidr=..., or netmask + start/end IP), IPv6
is an ip6cidr alone - addresses derive from the subnet and the NIC MAC
with EUI-64, so no range exists. No gateways are declared or stored;
createNetwork gains an optional cidr parameter (L3-only, additive).
Security groups work through a --directrouted dispatch in
security_group.py that matches the return path by ipset destination
instead of bridge port; a golden-file harness pins the classic rule
stream to prove existing deployments unchanged. SystemVMs run on routed
public ranges (createVlanIpRange with vlan=routed://<id>) in the same
host-route form. ConfigDrive network data is always generated for these
NICs, with the IPv4 default route emitted as a network-level gateway
key so cloud-init (netplan >= 23.1, networkd >= 24.2) renders it
on-link. A DefaultL3NetworkOffering (UserData and DNS via ConfigDrive,
security groups) is created on install and upgrade, and the UI gains an
L3 creation form, ROUTED in the zone wizard, and active IPv4/IPv6
addresses in the Instance list with click-to-copy.
General fixes that the feature surfaced but apply beyond it:
auto-allocated ids are exempt from the dynamic-vlan-range check in
createVlanAndPublicIpRange; a failed VM start or migration prepare now
unplugs the NICs it plugged; canUseForDeploy() counts the real IPv4
pool and no longer hides IPv4-less networks from the deploy wizard; the
zone-wide IPv6 overlap check keys on ip6_cidr rather than ip6_gateway.
The design document with the decision log lives in docs/design/.
This implements #12210
Claude-Session: https://claude.ai/code/session_01LkswKyuC2a58YCHFTEPnay1 parent a723d44 commit 0cc8922
57 files changed
Lines changed: 5010 additions & 262 deletions
File tree
- api/src
- main/java
- com/cloud
- network
- offering
- org/apache/cloudstack/api/command/user
- network
- vm
- test/java/org/apache/cloudstack/api/command/user/network
- core/src/main/java/com/cloud/agent/api
- docs/design
- engine
- api/src/main/java/org/apache/cloudstack/engine/orchestration/service
- orchestration/src/main/java/org/apache/cloudstack/engine/orchestration
- storage/configdrive/src
- main/java/org/apache/cloudstack/storage/configdrive
- test/java/org/apache/cloudstack/storage/configdrive
- plugins/hypervisors/kvm/src
- main/java/com/cloud/hypervisor/kvm/resource
- wrapper
- test/java/com/cloud/hypervisor/kvm/resource
- wrapper
- scripts/vm/network
- tests
- vnet
- server/src
- main
- java/com/cloud
- configuration
- consoleproxy
- network
- guru
- security
- resources/META-INF/cloudstack/server-network
- test/java/com/cloud
- configuration
- network
- guru
- vpc
- services/secondary-storage/controller/src/main/java/org/apache/cloudstack/secondarystorage
- systemvm/debian/opt/cloud/bin/setup
- test/integration/smoke
- tools/marvin/marvin
- config
- lib
- ui
- public/locales
- src
- components/view
- config/section/infra
- views
- infra/zone
- network
- offering
- utils/src/main/java/com/cloud/utils/net
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
134 | 151 | | |
135 | 152 | | |
136 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
Lines changed: 12 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
231 | 237 | | |
232 | 238 | | |
233 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
| |||
340 | 350 | | |
341 | 351 | | |
342 | 352 | | |
343 | | - | |
| 353 | + | |
344 | 354 | | |
345 | 355 | | |
346 | | - | |
| 356 | + | |
347 | 357 | | |
348 | 358 | | |
349 | 359 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
| |||
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
147 | | - | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | 160 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
37 | 53 | | |
38 | 54 | | |
39 | 55 | | |
| |||
0 commit comments