forked from zstackio/zstack
-
Notifications
You must be signed in to change notification settings - Fork 0
<fix>[kvm]: fix Hygon_Customized CPU mode migration failure #3338
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
Open
ZStack-Robot
wants to merge
25
commits into
5.5.6
Choose a base branch
from
sync/ye.zou/fix/ZSTAC-73095
base: 5.5.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6b4521b
<fix>[vm]: use max of virtual and actual size for root disk when no d…
AlanJager 3b5bda3
<fix>[zbs]: enable tryNext and 30s timeout for getActiveClients MDS call
AlanJager 80df074
<fix>[vm]: add Destroying->Stopped state transition
AlanJager a84a36e
<fix>[ceph]: apply over-provisioning ratio when releasing snapshot ca…
AlanJager f19223a
<fix>[loadBalancer]: block SLB deletion during grayscale upgrade
AlanJager 24d4f3b
<fix>[i18n]: improve snapshot error message for unattached volume
AlanJager f563992
<fix>[compute]: add null check for VmNicVO in afterDelIpAddress and a…
AlanJager 6545350
<fix>[network]: filter reserved IPs from GetFreeIp API results
AlanJager 76490a5
Merge branch 'fix/ZSTAC-80620' into '5.5.12'
461e8a2
Merge branch 'fix/ZSTAC-82153' into '5.5.12'
32e1e94
Merge branch 'fix/ZSTAC-80595' into '5.5.12'
addec8c
Merge branch 'fix/ZSTAC-74683' into '5.5.12'
26b8b1a
<fix>[mn]: synchronize hash ring operations to prevent dual-MN task s…
AlanJager be53c72
Merge branch 'fix/ZSTAC-81182' into '5.5.12'
e1dee9f
Merge branch 'fix/ZSTAC-79709' into '5.5.12'
3bd062b
Merge branch 'fix/ZSTAC-81741' into '5.5.12'
aaeaf39
<fix>[storage]: desensitize mdsUrls in ExternalPrimaryStorageInventory
AlanJager f41558d
<fix>[volumebackup]: add backup cancel timeout error code
AlanJager 673be94
Merge branch 'fix/ZSTAC-77711' into '5.5.12'
7f53f5a
<fix>[thread]: guard Context.current() with telemetry check
PandaWuu 72ce6ef
Merge branch 'bugfix/ZSTAC-82275' into '5.5.12'
PandaWuu 34bceb1
Merge branch 'fix/ZSTAC-78989' into '5.5.12'
3e02188
Merge branch 'fix/ZSTAC-82195' into '5.5.12'
799a84f
Merge branch 'fix/ZSTAC-80664' into '5.5.12'
1634bde
<fix>[kvm]: fix Hygon_Customized CPU mode migration failure
AlanJager File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
+1078
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. 避免 IPv4/IPv6 混用触发 当前对 🔧 建议修复- 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())));
- }
+ Set<ReservedIpRangeVO> reservedIpRanges = self.getReservedIpRanges();
+ if (reservedIpRanges != null && !reservedIpRanges.isEmpty()) {
+ freeIpInventorys.removeIf(freeIp -> {
+ int ipVersion = NetworkUtils.isIpv4Address(freeIp.getIp())
+ ? IPv6Constants.IPv4
+ : IPv6Constants.IPv6;
+ return reservedIpRanges.stream()
+ .filter(r -> r.getIpVersion() == ipVersion)
+ .anyMatch(r -> NetworkUtils.isInRange(freeIp.getIp(), r.getStartIp(), r.getEndIp()));
+ });
+ } |
||
|
|
||
| reply.setInventories(freeIpInventorys); | ||
|
|
||
| bus.reply(msg, reply); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
空值检查的位置应该在更新 UsedIpVO 之前
当前代码先在第 58 行更新了
UsedIpVO.vmNicUuid,然后再检查VmNicVO是否存在。如果 NIC 不存在,UsedIpVO已经被更新为引用一个不存在的vmNicUuid,可能导致数据不一致。建议将空值检查移到更新操作之前:
🛠️ 建议的修复方案
`@Override` public void afterAddIpAddress(String vmNicUUid, String usedIpUuid) { - /* update UsedIpVO */ - SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, usedIpUuid).set(UsedIpVO_.vmNicUuid, vmNicUUid).update(); - VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find(); if (nic == null) { logger.debug(String.format("VmNic[uuid:%s] not found, skip afterAddIpAddress", vmNicUUid)); return; } + /* update UsedIpVO */ + SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, usedIpUuid).set(UsedIpVO_.vmNicUuid, vmNicUUid).update(); + UsedIpVO temp = null;🤖 Prompt for AI Agents