Skip to content

Commit 918a667

Browse files
zstackzstack
authored andcommitted
fix: add null cluster guard before state check in CephKvmExtension
P1: Separate null check from state check. When findByUuid returns null (cluster deleted during race with reconnect callback), the original `cluster != null && cluster.getState() != Enabled` short-circuits false and falls through to createSecret(), causing downstream errors. Now null cluster triggers early return with warn-level log. P2: Improve comment to describe the constraint technically instead of only referencing the ticket key. Resolves: ZSTAC-80275
1 parent 2ababed commit 918a667

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

plugin/ceph/src/main/java/org/zstack/storage/ceph/primary/CephKvmExtension.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,14 @@ public void connectionReestablished(HostInventory inv) throws HostException {
5858
return;
5959
}
6060

61-
// skip Ceph storage operations if cluster is not Enabled (ZSTAC-80275)
61+
// skip Ceph secret creation when cluster is missing or not Enabled
6262
ClusterVO cluster = dbf.findByUuid(inv.getClusterUuid(), ClusterVO.class);
63-
if (cluster != null && cluster.getState() != ClusterState.Enabled) {
63+
if (cluster == null) {
64+
logger.warn(String.format("skip Ceph secret creation on host[uuid:%s] because cluster[uuid:%s] not found",
65+
inv.getUuid(), inv.getClusterUuid()));
66+
return;
67+
}
68+
if (cluster.getState() != ClusterState.Enabled) {
6469
logger.info(String.format("skip Ceph secret creation on host[uuid:%s] because cluster[uuid:%s] is %s",
6570
inv.getUuid(), inv.getClusterUuid(), cluster.getState()));
6671
return;

0 commit comments

Comments
 (0)