-
Notifications
You must be signed in to change notification settings - Fork 0
<fix>[compute]: always submit DeleteVmGC on rollback failure regardless of GC_ELIGIBLE #3352
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.6
Are you sure you want to change the base?
Changes from all commits
6b4521b
3b5bda3
80df074
a84a36e
f19223a
24d4f3b
f563992
6545350
76490a5
461e8a2
32e1e94
addec8c
26b8b1a
be53c72
e1dee9f
3bd062b
aaeaf39
f41558d
673be94
7f53f5a
72ce6ef
34bceb1
3e02188
799a84f
4f77a78
1d08048
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 |
|---|---|---|
|
|
@@ -1075,6 +1075,13 @@ private void handle(APIGetFreeIpMsg msg) { | |
| } | ||
| limit -= freeIpInventorys.size(); | ||
| } | ||
|
|
||
| Set<ReservedIpRangeVO> reservedIpRanges = self.getReservedIpRanges(); | ||
| if (reservedIpRanges != null && !reservedIpRanges.isEmpty()) { | ||
| freeIpInventorys.removeIf(freeIp -> reservedIpRanges.stream().anyMatch( | ||
| r -> NetworkUtils.isInRange(freeIp.getIp(), r.getStartIp(), r.getEndIp()))); | ||
| } | ||
|
Comment on lines
+1079
to
+1083
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for NetworkUtils.isInRange implementation
rg -n "boolean\s+isInRange\s*\(" -A 15 --type javaRepository: MatheMatrix/zstack Length of output: 2006 🏁 Script executed: #!/bin/bash
# Search for ReservedIpRangeVO to check if it has ipVersion field
fd -n "ReservedIpRangeVO" --type java -x cat {} | head -150Repository: MatheMatrix/zstack Length of output: 292 🏁 Script executed: #!/bin/bash
# Check for NetworkUtils methods related to IP validation
rg -n "isIpv4|isIpv6|ipVersion" utils/src/main/java/org/zstack/utils/network/NetworkUtils.java 2>/dev/null | head -30Repository: MatheMatrix/zstack Length of output: 1885 🏁 Script executed: #!/bin/bash
# Look at how reserved ranges are used in comparisons elsewhere
rg -n "ReservedIpRangeVO" -A 5 -B 5 --type java | grep -A 5 -B 5 "isInRange\|ipVersion" | head -50Repository: MatheMatrix/zstack Length of output: 4933 reserved IP 过滤需要按 IP 版本匹配,否则触发 IllegalArgumentException 导致 APIGetFreeIp 失败。 当前代码对 同一 L3 网络内可同时存在 IPv4 和 IPv6 reserved IP 范围,这里必须按版本过滤。参考同文件 486-487 行的正确做法,应在 建议修复 Set<ReservedIpRangeVO> reservedIpRanges = self.getReservedIpRanges();
if (reservedIpRanges != null && !reservedIpRanges.isEmpty()) {
- freeIpInventorys.removeIf(freeIp -> reservedIpRanges.stream().anyMatch(
- r -> NetworkUtils.isInRange(freeIp.getIp(), r.getStartIp(), r.getEndIp())));
+ freeIpInventorys.removeIf(freeIp -> {
+ int ipVersion = NetworkUtils.isIpv4Address(freeIp.getIp()) ? IPv6Constants.IPv4 : IPv6Constants.IPv6;
+ return reservedIpRanges.stream().anyMatch(r ->
+ r.getIpVersion() == ipVersion
+ && NetworkUtils.isInRange(freeIp.getIp(), r.getStartIp(), r.getEndIp()));
+ });
}🤖 Prompt for AI Agents |
||
|
|
||
| reply.setInventories(freeIpInventorys); | ||
|
|
||
| bus.reply(msg, reply); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |
| import org.zstack.network.service.vip.VipVO_; | ||
| import org.zstack.tag.PatternedSystemTag; | ||
| import org.zstack.tag.TagManager; | ||
| import org.zstack.core.upgrade.UpgradeGlobalConfig; | ||
| import org.zstack.utils.*; | ||
| import org.zstack.utils.function.ForEachFunction; | ||
| import org.zstack.utils.logging.CLogger; | ||
|
|
@@ -152,10 +153,22 @@ public APIMessage intercept(APIMessage msg) throws ApiMessageInterceptionExcepti | |
| validate((APIGetCandidateVmNicsForLoadBalancerServerGroupMsg)msg); | ||
| } else if (msg instanceof APIChangeLoadBalancerBackendServerMsg) { | ||
| validate((APIChangeLoadBalancerBackendServerMsg)msg); | ||
| } else if (msg instanceof APIDeleteLoadBalancerMsg) { | ||
| validate((APIDeleteLoadBalancerMsg) msg); | ||
| } | ||
| return msg; | ||
| } | ||
|
|
||
| private void validate(APIDeleteLoadBalancerMsg msg) { | ||
| if (UpgradeGlobalConfig.GRAYSCALE_UPGRADE.value(Boolean.class)) { | ||
| LoadBalancerVO lb = dbf.findByUuid(msg.getUuid(), LoadBalancerVO.class); | ||
| if (lb != null && lb.getType() == LoadBalancerType.SLB) { | ||
| throw new ApiMessageInterceptionException(argerr( | ||
| "cannot delete the standalone load balancer[uuid:%s] during grayscale upgrade", msg.getUuid())); | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+162
to
+170
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if UpgradeGlobalConfig.GRAYSCALE_UPGRADE exists
echo "=== Checking UpgradeGlobalConfig.GRAYSCALE_UPGRADE ==="
rg "GRAYSCALE_UPGRADE" --type java -B 2 -A 2 | head -20
echo ""
echo "=== Checking LoadBalancerType.SLB ==="
# Search for LoadBalancerType enum definition
rg "enum LoadBalancerType|class LoadBalancerType" --type java -A 20 | head -40
echo ""
echo "=== Checking argerr() pattern in LoadBalancerApiInterceptor ==="
# Get the file path first
fd "LoadBalancerApiInterceptor.java" --type fRepository: MatheMatrix/zstack Length of output: 2932 🏁 Script executed: #!/bin/bash
# Read the LoadBalancerApiInterceptor.java file to see all argerr() calls
fd "LoadBalancerApiInterceptor.java" --type f -x cat {} | grep -n "argerr(" | head -20Repository: MatheMatrix/zstack Length of output: 4158 🏁 Script executed: #!/bin/bash
# Get full context of other argerr calls in the file to see if they use constants
fd "LoadBalancerApiInterceptor.java" --type f -x cat {} | grep -B 2 -A 2 "argerr("Repository: MatheMatrix/zstack Length of output: 47032 缺少错误码常量,与文件其他验证方法不一致。 该文件内所有 ♻️ 建议修改 private void validate(APIDeleteLoadBalancerMsg msg) {
if (UpgradeGlobalConfig.GRAYSCALE_UPGRADE.value(Boolean.class)) {
LoadBalancerVO lb = dbf.findByUuid(msg.getUuid(), LoadBalancerVO.class);
if (lb != null && lb.getType() == LoadBalancerType.SLB) {
throw new ApiMessageInterceptionException(argerr(
- "cannot delete the standalone load balancer[uuid:%s] during grayscale upgrade", msg.getUuid()));
+ ORG_ZSTACK_NETWORK_SERVICE_LB_10xxx, "cannot delete the standalone load balancer[uuid:%s] during grayscale upgrade", msg.getUuid()));
}
}
}需在 🤖 Prompt for AI Agents |
||
|
|
||
| private void validate(APIDeleteAccessControlListMsg msg) { | ||
| /*List<String> refs = Q.New(LoadBalancerListenerACLRefVO.class).select(LoadBalancerListenerACLRefVO_.listenerUuid) | ||
| .eq(LoadBalancerListenerACLRefVO_.aclUuid, msg.getUuid()).isNull(LoadBalancerListenerACLRefVO_.serverGroupUuid).listValues(); | ||
|
|
||
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.
🧩 Analysis chain
🏁 Script executed:
fd 'ImageInventory.java' -t fRepository: MatheMatrix/zstack
Length of output: 354
🏁 Script executed:
rg -n "getActualSize" header/src/main/java/org/zstack/header/image/ImageInventory.java -A 3Repository: MatheMatrix/zstack
Length of output: 514
🏁 Script executed:
Repository: MatheMatrix/zstack
Length of output: 519
🏁 Script executed:
rg -n "public Long getSize\(\)|public long getSize\(\)" header/src/main/java/org/zstack/header/image/ImageInventory.java -A 2Repository: MatheMatrix/zstack
Length of output: 128
修复
getActualSize()返回类型以避免 NPE 风险。getActualSize()返回Long(可为空)。第 851 行将其自动拆箱到long原始类型,若值为null则触发 NPE。应将ImageInventory.getActualSize()的返回类型从Long改为long,并在 Agent 端确保设置默认值,而非在使用端做空值检查。这与getSize()的设计(已正确返回long)保持一致,也符合 ZStack 关于数值字段的最佳实践。🤖 Prompt for AI Agents