Allow to query management server node alive status

This commit is contained in:
Kelven Yang 2011-03-04 17:37:58 -08:00
parent ade92456df
commit cbb5aa0e89
3 changed files with 17 additions and 1 deletions

View File

@ -44,6 +44,7 @@ public interface ClusterManager extends Manager {
public int getHeartbeatThreshold();
public long getId();
public long getCurrentRunId();
public boolean isManageemnNodeAlive(long msid);
public String getSelfPeerName();
public String getSelfNodeIP();
public String getPeerName(long agentHostId);

View File

@ -23,8 +23,8 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener;
import com.cloud.agent.AgentManager.OnError;
import com.cloud.agent.Listener;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.ChangeAgentCommand;
import com.cloud.agent.api.Command;
@ -781,6 +781,17 @@ public class ClusterManagerImpl implements ClusterManager {
return _runId;
}
@Override
public boolean isManageemnNodeAlive(long msid) {
ManagementServerHostVO mshost = _mshostDao.findById(msid);
if(mshost != null) {
if(mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - heartbeatThreshold)
return true;
}
return false;
}
@Override
public int getHeartbeatThreshold() {
return this.heartbeatThreshold;

View File

@ -101,6 +101,10 @@ public class DummyClusterManagerImpl implements ClusterManager {
public String getSelfNodeIP() {
return _clusterNodeIP;
}
public boolean isManageemnNodeAlive(long msid) {
return true;
}
public String getPeerName(long agentHostId) {
throw new CloudRuntimeException("Unsupported feature");