cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wei Zhou (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-9569) VR on shared network not starting on KVM
Date Wed, 26 Oct 2016 18:41:58 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15609292#comment-15609292
] 

Wei Zhou commented on CLOUDSTACK-9569:
--------------------------------------

OR you can try our following change:
{code}


commit 0cc5ed5fd86ba7a93ebf5b861590f6807588ad70
Author: Wei Zhou <w.zhou@tech.leaseweb.com>
Date:   Mon Oct 24 09:29:42 2016 +0200

    Set KVM host params (router.aggregation.command.each.timeout)

diff --git a/core/src/com/cloud/agent/api/SetHostParamsCommand.java b/core/src/com/cloud/agent/api/SetHostParamsCommand.java
new file mode 100644
index 0000000..9f13bf5
--- /dev/null
+++ b/core/src/com/cloud/agent/api/SetHostParamsCommand.java
@@ -0,0 +1,43 @@
+//
+// 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
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.agent.api;
+
+import java.util.Map;
+
+public class SetHostParamsCommand extends Command {
+
+    Map<String, String> params;
+
+    public SetHostParamsCommand(Map<String, String> params) {
+        this.params = params;
+    }
+
+    public Map<String, String> getParams() {
+        return params;
+    }
+
+    protected SetHostParamsCommand() {
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return true;
+    }
+}
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index 9e0055f..c9615db 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -77,6 +77,7 @@ public class VirtualRoutingResource {
     private int _retry;
     private int _port;
     private int _eachTimeout;
+    private Map<String, Object> _params;

     private String _cfgVersion = "1.0";
     private String _routerUpgradePath;
@@ -295,8 +296,18 @@ public class VirtualRoutingResource {
         }
     }

+    public boolean configureHostParams(final Map<String, String> params) {
+        if (_params.get("router.aggregation.command.each.timeout") == null) {
+            String value = (String)params.get("router.aggregation.command.each.timeout");
+            _eachTimeout = NumbersUtil.parseInt(value, _eachTimeout);
+        }
+
+        return true;
+    }
+
     public boolean configure(final String name, final Map<String, Object> params) throws
ConfigurationException {
         _name = name;
+        _params = params;

         String value = (String)params.get("ssh.sleep");
         _sleep = NumbersUtil.parseInt(value, 10) * 1000;
diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
index 45a7dca..ac4afa9 100644
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -60,6 +60,7 @@ import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.PingRoutingCommand;
 import com.cloud.agent.api.ReadyAnswer;
 import com.cloud.agent.api.ReadyCommand;
+import com.cloud.agent.api.SetHostParamsCommand;
 import com.cloud.agent.api.ShutdownCommand;
 import com.cloud.agent.api.StartupAnswer;
 import com.cloud.agent.api.StartupCommand;
@@ -211,6 +212,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager,
Handl

         registerForHostEvents(new BehindOnPingListener(), true, true, false);

+        registerForHostEvents(new SetHostParamsListener(), true, true, false);
+
         _executor = new ThreadPoolExecutor(threads, threads, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("AgentTaskPool"));

         _connectExecutor = new ThreadPoolExecutor(100, 500, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("AgentConnectTaskPool"));
@@ -1656,4 +1659,61 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager,
Handl
                         DirectAgentThreadCap };
     }

+    protected class SetHostParamsListener implements Listener {
+        @Override
+        public boolean isRecurring() {
+            return false;
+        }
+
+        @Override
+        public boolean processAnswers(final long agentId, final long seq, final Answer[]
answers) {
+            return false;
+        }
+
+        @Override
+        public boolean processCommands(final long agentId, final long seq, final Command[]
commands) {
+            return false;
+        }
+
+        @Override
+        public AgentControlAnswer processControlCommand(final long agentId, final AgentControlCommand
cmd) {
+            return null;
+        }
+
+        @Override
+        public void processConnect(final Host host, final StartupCommand cmd, final boolean
forRebalance) {
+        if (cmd instanceof StartupRoutingCommand) {
+            if (((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.KVM ||
((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.LXC) {
+                Map<String, String> params = new HashMap<String, String>();
+                params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout"));
+
+                try {
+                    SetHostParamsCommand cmds = new SetHostParamsCommand(params);
+                    Commands c = new Commands(cmds);
+                    send(host.getId(), c, this);
+                } catch (AgentUnavailableException e) {
+                    s_logger.debug("Failed to send host params on host: " + host.getId());
+                }
+            }
+        }
+
+        }
+
+        @Override
+        public boolean processDisconnect(final long agentId, final Status state) {
+            return true;
+        }
+
+        @Override
+        public boolean processTimeout(final long agentId, final long seq) {
+            return false;
+        }
+
+        @Override
+        public int getTimeout() {
+            return -1;
+        }
+
+    }
+
 }
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtSetHostParamsCommandWrapper.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtSetHostParamsCommandWrapper.java
new file mode 100644
index 0000000..52dd0e9
--- /dev/null
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtSetHostParamsCommandWrapper.java
@@ -0,0 +1,45 @@
+//
+// 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
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.hypervisor.kvm.resource.wrapper;
+
+import java.util.Map;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.SetHostParamsCommand;
+import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+
+@ResourceWrapper(handles =  SetHostParamsCommand.class)
+public final class LibvirtSetHostParamsCommandWrapper extends CommandWrapper<SetHostParamsCommand,
Answer, LibvirtComputingResource> {
+
+    @Override
+    public Answer execute(final SetHostParamsCommand command, final LibvirtComputingResource
libvirtComputingResource) {
+
+        final Map<String, String> params = command.getParams();
+        boolean success = libvirtComputingResource.getVirtRouterResource().configureHostParams(params);
+
+        if (!success) {
+            return new Answer(command, false, "Failed to set host parameters");
+        } else {
+            return new Answer(command, true, null);
+        }
+    }
+}
{code}

> VR on shared network not starting on KVM
> ----------------------------------------
>
>                 Key: CLOUDSTACK-9569
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9569
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: Network Controller
>    Affects Versions: 4.9.0
>            Reporter: John Burwell
>            Priority: Critical
>             Fix For: 4.9.2.0, 4.10.1.0, 4.11.0.0
>
>         Attachments: cloud.log
>
>
> A VR for a shared network on KVM fails to complete startup with the following behavior:
> # VR starts on KVM
> # Agent pings VR
> # Increase timeout from from 120 seconds to 1200 seconds
> # API configuration starts
> The Management Server reports that the command times out.  Please see the attached {cloud.log}
which depicts the activity of the VR through the timeout.  This failure does not occur on
VMware.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message