cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (CLOUDSTACK-10132) Multiple Management Servers Support for agents
Date Mon, 13 Nov 2017 07:57:00 GMT


ASF GitHub Bot commented on CLOUDSTACK-10132:

rhtyd commented on a change in pull request #2309: CLOUDSTACK-10132: Multiple Management Servers
Support for agents

 File path: server/src/org/apache/cloudstack/agent/mslb/
 @@ -0,0 +1,137 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.agent.mslb;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import org.apache.cloudstack.agent.mslb.algorithm.AgentMSLBRoundRobinAlgorithm;
+import org.apache.cloudstack.agent.mslb.algorithm.AgentMSLBShuffleAlgorithm;
+import org.apache.cloudstack.agent.mslb.algorithm.AgentMSLBStaticAlgorithm;
+import org.apache.cloudstack.config.ApiServiceConfiguration;
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
+import org.apache.log4j.Logger;
+public class AgentMSLBServiceImpl extends ComponentLifecycleBase implements AgentMSLB, Configurable
+    public static final Logger LOG = Logger.getLogger(AgentMSLBServiceImpl.class);
+    public static final ConfigKey<String> ConnectedAgentLBAlgorithm = new ConfigKey<>("Advanced",
+            "connected.agent.mslb.algorithm", "static",
+            "The algorithm to applied on the provided 'host' management server list that
is sent to indirect agents. Allowed values are: static, roundrobin and shuffle.",
+            true, ConfigKey.Scope.Global);
+    private static Map<String, AgentMSLBAlgorithm> algorithmMap = new HashMap<>();
+    @Inject
+    ResourceManager resourceManager;
+    @Inject
+    AgentManager agentManager;
+    @Override
+    public List<String> getManagementServerList() {
+        final String msServerAddresses = ApiServiceConfiguration.ManagementServerAddresses.value();
+        if (Strings.isNullOrEmpty(msServerAddresses)) {
+            throw new CloudRuntimeException(String.format("No management server addresses
are defined in '%s' setting",
+                    ApiServiceConfiguration.ManagementServerAddresses.key()));
+        }
+        return getAgentMSLBAlgorithm().getMSList(Arrays.asList(msServerAddresses.replace("
", "").split(",")));
+    }
+    protected List<HostVO> getOrderedRunningIndirectAgentIds() {
+        List<HostVO> hosts = resourceManager.findDirectlyConnectedHosts();
+        if (hosts != null) {
+            return
+                    .filter(x -> x.getState().equals(Status.Up) && x.getHypervisorType().equals(Hypervisor.HypervisorType.KVM))
+                    .sorted((x,y) ->, y.getId()))
+                    .collect(Collectors.toList());
+        }
+        return null;
+    }
+    @Override
+    public void propagateManagementServerListToAgents() {
+        List<HostVO> hosts = getOrderedRunningIndirectAgentIds();
+        if (hosts != null) {
+            for (HostVO h : hosts) {
 Review comment:
   @nvazquez I don't think it's a good idea, `resource claim and ownership` is not within
the scope of this feature. This method will send command/answers to all the hosts (even those
not managed by the `this` management server) and may cause disconnections. In case of multiple
management servers, this will cause all the management servers to send multiple requests to
all the agents. (note, when you do agent.send(), if the agent is not connected to `this` management
server, it will use clustered mgmt server impl to send the request to the forwarding agent
which is via other mgmt servers).

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Multiple Management Servers Support for agents
> ----------------------------------------------
>                 Key: CLOUDSTACK-10132
>                 URL:
>             Project: CloudStack
>          Issue Type: Improvement
>      Security Level: Public(Anyone can view this level - this is the default.) 
>    Affects Versions:
>            Reporter: Nicolas Vazquez
>            Assignee: Nicolas Vazquez
> Multiple Management Servers Support for agents

This message was sent by Atlassian JIRA

View raw message