-
Notifications
You must be signed in to change notification settings - Fork 0
<fix>[network]: ZCF-3703 add ZNS attach skip hook #4007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 5.5.22
Are you sure you want to change the base?
Changes from all commits
a455e0f
fd6da83
e3bb9eb
5dc68e1
7151c70
3a95fa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package org.zstack.header.network.service; | ||
|
|
||
| public interface NetworkServiceAttachExtensionPoint { | ||
| boolean skipAttachNetworkService(APIAttachNetworkServiceToL3NetworkMsg msg); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -996,7 +996,7 @@ public static Map<String, String> getExistingDhcpServerIp(String l3Uuid, int ipV | |
|
|
||
| @Deferred | ||
| private String allocateDhcpIp(String l3Uuid, int ipVersion, boolean allocate_ip, String requiredIp, String excludedIp) { | ||
| if (!isAllocateDhcpServerIp(l3Uuid)) { | ||
| if (!isAllocateDhcpServerIp(l3Uuid, ipVersion)) { | ||
| return null; | ||
|
Comment on lines
997
to
1000
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要用 这里把“不支持当前 IP 版本分配”折叠成 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
@@ -1276,6 +1276,17 @@ private boolean isAllocateDhcpServerIp(String l3Uuid) { | |
| return type.isAllocateDhcpServerIp(); | ||
| } | ||
|
|
||
| private boolean isAllocateDhcpServerIp(String l3Uuid, int ipVersion) { | ||
| String providerType = new NetworkProviderFinder().getNetworkProviderTypeByNetworkServiceType(l3Uuid, NetworkServiceType.DHCP.toString()); | ||
| if (providerType == null) { | ||
| return false; | ||
| } | ||
|
|
||
| NetworkServiceProviderType type = NetworkServiceProviderType.valueOf(providerType); | ||
| return type.isAllocateDhcpServerIp() | ||
| && (ipVersion != IPv6Constants.IPv6 || type.isAllocateDhcpv6ServerIp()); | ||
| } | ||
|
|
||
| private boolean isCreateDhcpNameSpace(String l3Uuid) { | ||
| String providerType = new NetworkProviderFinder().getNetworkProviderTypeByNetworkServiceType(l3Uuid, NetworkServiceType.DHCP.toString()); | ||
| if (providerType == null) { | ||
|
|
@@ -2490,7 +2501,10 @@ private void validate(APIDetachNetworkServiceFromL3NetworkMsg msg) { | |
| } | ||
|
|
||
| private void validate(APIChangeL3NetworkDhcpIpAddressMsg msg) { | ||
| if (!isAllocateDhcpServerIp(msg.getL3NetworkUuid())) { | ||
| if ((msg.getDhcpServerIp() != null && !isAllocateDhcpServerIp(msg.getL3NetworkUuid(), IPv6Constants.IPv4)) | ||
| || (msg.getDhcpv6ServerIp() != null && !isAllocateDhcpServerIp(msg.getL3NetworkUuid(), IPv6Constants.IPv6)) | ||
| || (msg.getDhcpServerIp() == null && msg.getDhcpv6ServerIp() == null | ||
| && !isAllocateDhcpServerIp(msg.getL3NetworkUuid()))) { | ||
| throw new ApiMessageInterceptionException(argerr(ORG_ZSTACK_NETWORK_SERVICE_FLAT_10044, "could change dhcp server ip, because flat dhcp is not enabled")); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment from shixin.ruan:
是不是应该加@APINoSee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment from shixin.ruan:
fixed in 3a61b56.\n\nDefect class: API surface hygiene.\nBefore: skipAttach was transient but still had no explicit API hiding annotation.\nAfter: added @APINoSee to skipAttach so this internal control flag is hidden from REST/API field exposure.\nValidation: mvn -pl header,network -DskipTests install passed.