when system VM ping times out, stop system VM

This commit is contained in:
Anthony Xu 2014-09-30 12:34:32 -07:00
parent 783ed9be98
commit 847e1e47ae
5 changed files with 22 additions and 2 deletions

View File

@ -775,7 +775,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
}
if (s_logger.isDebugEnabled()) {
s_logger.debug("The next status of agent " + hostId + "is " + nextStatus + ", current status is " + currentStatus);
s_logger.debug("The next status of agent " + hostId + " is " + nextStatus + ", current status is " + currentStatus);
}
}
}
@ -1513,7 +1513,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|| host.getType() == Host.Type.SecondaryStorageCmdExecutor)) {
s_logger.warn("Disconnect agent for CPVM/SSVM due to physical connection close. host: " + host.getId());
disconnectWithoutInvestigation(agentId, Event.ShutdownRequested);
disconnectWithoutInvestigation(agentId, Event.PingTimeout);
} else {
status_logger.debug("Ping timeout for host " + agentId + ", do invstigation");
disconnectWithInvestigation(agentId, Event.PingTimeout);

View File

@ -324,6 +324,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
final ConsoleProxyVO proxy = _consoleProxyDao.findById(proxyVmId);
if (proxy != null) {
stopProxy(proxyVmId);
// Disable this feature for now, as it conflicts
// with
// the case of allowing user to reboot console proxy

View File

@ -88,6 +88,7 @@ public class SecondaryStorageListener implements Listener {
@Override
public boolean processDisconnect(long agentId, Status state) {
_ssVmMgr.onAgentDisconnect(agentId, state);
return true;
}

View File

@ -21,6 +21,7 @@ import java.util.List;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.StartupCommand;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Manager;
import com.cloud.vm.SecondaryStorageVmVO;
@ -45,6 +46,8 @@ public interface SecondaryStorageVmManager extends Manager {
public void onAgentConnect(Long dcId, StartupCommand cmd);
public void onAgentDisconnect(long agentId, Status state);
public boolean generateFirewallConfiguration(Long agentId);
public boolean generateVMSetupCommand(Long hostId);

View File

@ -78,6 +78,7 @@ import com.cloud.exception.StorageUnavailableException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.Host.Type;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.info.RunningHostCountInfo;
@ -998,6 +999,20 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
public void onAgentConnect(Long dcId, StartupCommand cmd) {
}
@Override
public void onAgentDisconnect(long agentId, Status state) {
HostVO host = _hostDao.findById(agentId);
if (host == null || !Type.SecondaryStorageVM.equals(host.getType())) {
return;
}
if (state == Status.Alert || state == Status.Disconnected) {
SecondaryStorageVmVO ssvm = getSSVMfromHost(host);
if ( ssvm != null ) {
stopSecStorageVm(ssvm.getId());
}
}
}
private String getAllocLockName() {
// to improve security, it may be better to return a unique mashed
// name(for example MD5 hashed)