Skip to content

Backport #10500 framework/cluster: fix NPE for ms-host status when mgr stops #10653

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

Merged
merged 1 commit into from
Apr 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1052,12 +1052,24 @@
}

if (_mshostId != null) {
final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
mshost.setState(ManagementServerHost.State.Down);
mshostStatus.setLastJvmStop(new Date());
_mshostDao.update(_mshostId, mshost);
mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);

Check warning on line 1055 in framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java#L1055

Added line #L1055 was not covered by tests
if (mshost != null) {
ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());

Check warning on line 1057 in framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java#L1057

Added line #L1057 was not covered by tests
if (mshostStatus != null) {
mshost.setState(ManagementServerHost.State.Down);
mshostStatus.setLastJvmStop(new Date());
_mshostDao.update(_mshostId, mshost);
mshostStatusDao.update(mshostStatus.getId(), mshostStatus);

Check warning on line 1062 in framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java#L1059-L1062

Added lines #L1059 - L1062 were not covered by tests
} else {
s_logger.warn(String.format("Found a management server host [%s] without a status. This should never happen!", mshost));
mshostStatus = new ManagementServerStatusVO();
mshostStatus.setMsId(mshost.getUuid());
mshostStatus.setLastSystemBoot(new Date());
mshostStatus.setLastJvmStart(new Date());
mshostStatus.setUpdated(new Date());
mshostStatusDao.persist(mshostStatus);

Check warning on line 1070 in framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java#L1064-L1070

Added lines #L1064 - L1070 were not covered by tests
}
}
}

_heartbeatScheduler.shutdownNow();
Expand Down