Skip to content

Commit e40b06e

Browse files
committed
AgentAttache: allow checkonhost command in maintenance, cancel if only allowed
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 46cd98b commit e40b06e

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

‎engine/orchestration/src/com/cloud/agent/manager/AgentAttache.java‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.cloud.agent.api.Answer;
3939
import com.cloud.agent.api.CheckHealthCommand;
4040
import com.cloud.agent.api.CheckNetworkCommand;
41+
import com.cloud.agent.api.CheckOnHostCommand;
4142
import com.cloud.agent.api.CheckVirtualMachineCommand;
4243
import com.cloud.agent.api.CleanupNetworkRulesCmd;
4344
import com.cloud.agent.api.Command;
@@ -111,7 +112,7 @@ public int compare(final Object o1, final Object o2) {
111112
public final static String[] s_commandsAllowedInMaintenanceMode = new String[] {MaintainCommand.class.toString(), MigrateCommand.class.toString(),
112113
StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(),
113114
ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(),
114-
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString()};
115+
CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString()};
115116
protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] {StartCommand.class.toString(), CreateCommand.class.toString()};
116117
static {
117118
Arrays.sort(s_commandsAllowedInMaintenanceMode);
@@ -307,16 +308,18 @@ public boolean processAnswers(final long seq, final Response resp) {
307308
}
308309

309310
protected void cancelAllCommands(final Status state, final boolean cancelActive) {
310-
final Set<Map.Entry<Long, Listener>> entries = _waitForList.entrySet();
311-
final Iterator<Map.Entry<Long, Listener>> it = entries.iterator();
312-
while (it.hasNext()) {
313-
final Map.Entry<Long, Listener> entry = it.next();
314-
it.remove();
315-
final Listener monitor = entry.getValue();
316-
if (s_logger.isDebugEnabled()) {
317-
s_logger.debug(log(entry.getKey(), "Sending disconnect to " + monitor.getClass()));
311+
if (cancelActive) {
312+
final Set<Map.Entry<Long, Listener>> entries = _waitForList.entrySet();
313+
final Iterator<Map.Entry<Long, Listener>> it = entries.iterator();
314+
while (it.hasNext()) {
315+
final Map.Entry<Long, Listener> entry = it.next();
316+
it.remove();
317+
final Listener monitor = entry.getValue();
318+
if (s_logger.isDebugEnabled()) {
319+
s_logger.debug(log(entry.getKey(), "Sending disconnect to " + monitor.getClass()));
320+
}
321+
monitor.processDisconnect(_id, state);
318322
}
319-
monitor.processDisconnect(_id, state);
320323
}
321324
}
322325

0 commit comments

Comments
 (0)