From 07d64cb65a9917d95dcb9434eae712eb2fc61258 Mon Sep 17 00:00:00 2001 From: Nicolas Vazquez Date: Wed, 4 Dec 2019 10:43:17 -0300 Subject: [PATCH] [KVM] Agent LB Fix: Connections from disabled KVM host agents are refused (#3617) * Remove constraint for just enabled hosts receiving the ms list * Allow sending SetupMSList command when host is in maintenance --- .../src/main/java/com/cloud/agent/manager/AgentAttache.java | 3 ++- .../apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java index 4f03acd19fd..e96181b96d7 100644 --- a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentAttache.java @@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit; import com.cloud.agent.api.ModifySshKeysCommand; import com.cloud.agent.api.ModifyStoragePoolCommand; +import org.apache.cloudstack.agent.lb.SetupMSListCommand; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.log4j.Logger; @@ -116,7 +117,7 @@ public abstract class AgentAttache { StopCommand.class.toString(), CheckVirtualMachineCommand.class.toString(), PingTestCommand.class.toString(), CheckHealthCommand.class.toString(), ReadyCommand.class.toString(), ShutdownCommand.class.toString(), SetupCommand.class.toString(), CleanupNetworkRulesCmd.class.toString(), CheckNetworkCommand.class.toString(), PvlanSetupCommand.class.toString(), CheckOnHostCommand.class.toString(), - ModifyTargetsCommand.class.toString(), ModifySshKeysCommand.class.toString(), ModifyStoragePoolCommand.class.toString()}; + ModifyTargetsCommand.class.toString(), ModifySshKeysCommand.class.toString(), ModifyStoragePoolCommand.class.toString(), SetupMSListCommand.class.toString()}; protected final static String[] s_commandsNotAllowedInConnectingMode = new String[] { StartCommand.class.toString(), CreateCommand.class.toString() }; static { Arrays.sort(s_commandsAllowedInMaintenanceMode); diff --git a/server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java b/server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java index 19eb97d0fe1..c3cca0e9058 100644 --- a/server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java +++ b/server/src/main/java/org/apache/cloudstack/agent/lb/IndirectAgentLBServiceImpl.java @@ -136,7 +136,7 @@ public class IndirectAgentLBServiceImpl extends ComponentLifecycleBase implement } final List agentBasedHosts = new ArrayList<>(); for (final Host host : allHosts) { - if (host == null || host.getResourceState() != ResourceState.Enabled) { + if (host == null || host.getResourceState() == ResourceState.Creating || host.getResourceState() == ResourceState.Error) { continue; } if (host.getType() == Host.Type.Routing || host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorage || host.getType() == Host.Type.SecondaryStorageVM) {