You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/09/16 12:52:04 UTC

[15/15] git commit: updated refs/heads/hotfix/4.4/CLOUDSTACK-7184 to b82f27b

CLOUDSTACK-7184 retry-wait loop config to deal with network glitches


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b82f27be
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b82f27be
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b82f27be

Branch: refs/heads/hotfix/4.4/CLOUDSTACK-7184
Commit: b82f27be4150e70c017ed2597137319daa79560b
Parents: 7a694d4
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Sep 16 12:20:30 2014 +0200
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Sep 16 12:49:36 2014 +0200

----------------------------------------------------------------------
 .../com/cloud/agent/manager/DirectAgentAttache.java    | 13 ++++++++++++-
 .../hypervisor/xen/resource/CitrixResourceBase.java    |  2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b82f27be/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
index 7ca6929..480a7af 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/DirectAgentAttache.java
@@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.log4j.Logger;
+import org.apache.cloudstack.framework.config.ConfigKey;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
 
 import com.cloud.agent.api.Answer;
@@ -40,6 +41,10 @@ import com.cloud.resource.ServerResource;
 public class DirectAgentAttache extends AgentAttache {
     private final static Logger s_logger = Logger.getLogger(DirectAgentAttache.class);
 
+    protected final ConfigKey<Integer> _HostPingRetryCount = new ConfigKey<Integer>("Advanced", Integer.class, "host.ping.retry.count", "2",
+            "Number of times retrying a host ping while waiting for check results", true);
+    protected final ConfigKey<Integer> _HostPingRetryTimer = new ConfigKey<Integer>("Advanced", Integer.class, "host.ping.retry.timer", "20",
+            "Interval to wait before retrying a host ping while waiting for check results", true);
     ServerResource _resource;
     List<ScheduledFuture<?>> _futures = new ArrayList<ScheduledFuture<?>>();
     AgentManagerImpl _mgr;
@@ -161,7 +166,13 @@ public class DirectAgentAttache extends AgentAttache {
                 ServerResource resource = _resource;
 
                 if (resource != null) {
-                    PingCommand cmd = resource.getCurrentStatus(_id);
+                    PingCommand cmd = null;
+                    int retried = 0;
+                    while ( cmd == null && ++retried < _HostPingRetryCount.value())
+                    {
+                        cmd = resource.getCurrentStatus(_id);
+                        Thread.sleep(1000*_HostPingRetryTimer.value());
+                    }
                     if (cmd == null) {
                         s_logger.warn("Unable to get current status on " + _id + "(" + _name + ")");
                         return;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b82f27be/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 644ef65..a399c98 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -4276,7 +4276,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             if (!pingXAPI()) {
                 Thread.sleep(1000);
                 if (!pingXAPI()) {
-                    s_logger.warn(" can not ping xenserver " + _host.uuid);
+                    s_logger.warn("can not ping xenserver " + _host.uuid);
                     return null;
                 }
             }