Skip to content

Commit 3bd062b

Browse files
author
gitlab
committed
Merge branch 'fix/ZSTAC-81741' into '5.5.12'
<fix>[network]: add null check for L3 network system tags in API interceptor See merge request zstackio/zstack!9169
2 parents e1dee9f + f563992 commit 3bd062b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

compute/src/main/java/org/zstack/compute/vm/VmNicManagerImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public void afterAddIpAddress(String vmNicUUid, String usedIpUuid) {
5858
SQL.New(UsedIpVO.class).eq(UsedIpVO_.uuid, usedIpUuid).set(UsedIpVO_.vmNicUuid, vmNicUUid).update();
5959

6060
VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find();
61+
if (nic == null) {
62+
logger.debug(String.format("VmNic[uuid:%s] not found, skip afterAddIpAddress", vmNicUUid));
63+
return;
64+
}
6165

6266
UsedIpVO temp = null;
6367
/* if there is ipv4 addresses, we put the first attached ipv4 address to VmNic.ip
@@ -88,6 +92,10 @@ public void afterAddIpAddress(String vmNicUUid, String usedIpUuid) {
8892
@Override
8993
public void afterDelIpAddress(String vmNicUUid, String usedIpUuid) {
9094
VmNicVO nic = Q.New(VmNicVO.class).eq(VmNicVO_.uuid, vmNicUUid).find();
95+
if (nic == null) {
96+
logger.debug(String.format("VmNic[uuid:%s] not found, skip afterDelIpAddress", vmNicUUid));
97+
return;
98+
}
9199
if (nic.getUsedIpUuid() != null && !nic.getUsedIpUuid().equals(usedIpUuid)) {
92100
return;
93101
}

0 commit comments

Comments
 (0)