mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
framework/cluster: fix NPE for ms-host status when mgr stops (#10500)
* framework/cluster: fix NPE for ms-host status when mgr stops This handles an NPE case for when management server host status is not found in the DB, when stopping the cluster manager. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> * Update framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com> * Update framework/cluster/src/main/java/com/cloud/cluster/ClusterManagerImpl.java --------- Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> Co-authored-by: dahn <daan.hoogland@gmail.com>
This commit is contained in:
parent
7f3f104295
commit
f47bd61279
@ -1107,9 +1107,19 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
||||
if (_mshostId != null) {
|
||||
final ManagementServerHostVO mshost = _mshostDao.findByMsid(_msId);
|
||||
if (mshost != null) {
|
||||
final ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
|
||||
mshostStatus.setLastJvmStop(new Date());
|
||||
mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
|
||||
ManagementServerStatusVO mshostStatus = mshostStatusDao.findByMsId(mshost.getUuid());
|
||||
if (mshostStatus != null) {
|
||||
mshostStatus.setLastJvmStop(new Date());
|
||||
mshostStatusDao.update(mshostStatus.getId(), mshostStatus);
|
||||
} else {
|
||||
logger.warn("Found a management server host [{}] 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);
|
||||
}
|
||||
|
||||
ManagementServerHost.State msHostState = ManagementServerHost.State.Down;
|
||||
if (ManagementServerHost.State.Maintenance.equals(mshost.getState()) || ManagementServerHost.State.PreparingForMaintenance.equals(mshost.getState())) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user