|
38 | 38 | import javax.inject.Inject; |
39 | 39 | import javax.naming.ConfigurationException; |
40 | 40 |
|
41 | | -import com.cloud.configuration.Config; |
42 | | -import com.cloud.utils.NumbersUtil; |
43 | | -import com.cloud.utils.db.GlobalLock; |
44 | 41 | import org.apache.cloudstack.agent.lb.IndirectAgentLB; |
45 | 42 | import org.apache.cloudstack.ca.CAManager; |
46 | 43 | import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; |
|
54 | 51 | import org.apache.cloudstack.utils.identity.ManagementServerNode; |
55 | 52 | import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; |
56 | 53 | import org.apache.commons.lang3.BooleanUtils; |
| 54 | +import org.apache.commons.lang3.StringUtils; |
57 | 55 | import org.apache.log4j.Logger; |
58 | 56 | import org.apache.log4j.MDC; |
59 | 57 |
|
|
82 | 80 | import com.cloud.agent.transport.Request; |
83 | 81 | import com.cloud.agent.transport.Response; |
84 | 82 | import com.cloud.alert.AlertManager; |
| 83 | +import com.cloud.configuration.Config; |
85 | 84 | import com.cloud.configuration.ManagementServiceConfiguration; |
86 | 85 | import com.cloud.dc.ClusterVO; |
87 | 86 | import com.cloud.dc.DataCenterVO; |
|
105 | 104 | import com.cloud.resource.ResourceManager; |
106 | 105 | import com.cloud.resource.ResourceState; |
107 | 106 | import com.cloud.resource.ServerResource; |
| 107 | +import com.cloud.utils.NumbersUtil; |
108 | 108 | import com.cloud.utils.Pair; |
109 | 109 | import com.cloud.utils.component.ManagerBase; |
110 | 110 | import com.cloud.utils.concurrency.NamedThreadFactory; |
111 | 111 | import com.cloud.utils.db.DB; |
112 | 112 | import com.cloud.utils.db.EntityManager; |
| 113 | +import com.cloud.utils.db.GlobalLock; |
113 | 114 | import com.cloud.utils.db.QueryBuilder; |
114 | 115 | import com.cloud.utils.db.SearchCriteria.Op; |
115 | 116 | import com.cloud.utils.db.TransactionLegacy; |
|
124 | 125 | import com.cloud.utils.nio.NioServer; |
125 | 126 | import com.cloud.utils.nio.Task; |
126 | 127 | import com.cloud.utils.time.InaccurateClock; |
127 | | -import org.apache.commons.lang3.StringUtils; |
128 | 128 |
|
129 | 129 | /** |
130 | 130 | * Implementation of the Agent Manager. This class controls the connection to the agents. |
@@ -208,6 +208,11 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl |
208 | 208 | protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<Boolean>("Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false", |
209 | 209 | "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true); |
210 | 210 |
|
| 211 | + public static final List<Host.Type> HOST_DOWN_ALERT_UNSUPPORTED_HOST_TYPES = Arrays.asList( |
| 212 | + Host.Type.SecondaryStorage, |
| 213 | + Host.Type.ConsoleProxy |
| 214 | + ); |
| 215 | + |
211 | 216 | @Override |
212 | 217 | public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { |
213 | 218 |
|
@@ -901,7 +906,10 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, |
901 | 906 | if (determinedState == Status.Down) { |
902 | 907 | final String message = "Host is down: " + host.getId() + "-" + host.getName() + ". Starting HA on the VMs"; |
903 | 908 | s_logger.error(message); |
904 | | - if (host.getType() != Host.Type.SecondaryStorage && host.getType() != Host.Type.ConsoleProxy) { |
| 909 | + if (Status.Down.equals(host.getStatus())) { |
| 910 | + s_logger.debug(String.format("Skipping sending alert for %s as it already in %s state", |
| 911 | + host, host.getStatus())); |
| 912 | + } else if (!HOST_DOWN_ALERT_UNSUPPORTED_HOST_TYPES.contains(host.getType())) { |
905 | 913 | _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host down, " + host.getId(), message); |
906 | 914 | } |
907 | 915 | event = Status.Event.HostDown; |
|
0 commit comments