cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kous...@apache.org
Subject [1/2] git commit: updated refs/heads/master to e7ddbd4
Date Mon, 24 Aug 2015 04:43:02 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 6d57a86cb -> e7ddbd498


CLOUDSTACK-8733: Host stuck in rebalancing state during agent LB
This is happening as ClusterServiceServletAdapter is started after ClusteredAgentManagerImpl.
Fix is to start ClusterServiceServletAdapter before ClusteredAgentManagerImpl.


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

Branch: refs/heads/master
Commit: c989921fb7adcfd125ca5f541c0f9c5d1c512c54
Parents: 05a29f0
Author: Koushik Das <koushik@apache.org>
Authored: Fri Aug 14 17:11:52 2015 +0530
Committer: Koushik Das <koushik@apache.org>
Committed: Fri Aug 14 17:11:52 2015 +0530

----------------------------------------------------------------------
 .../cluster/ClusterServiceServletAdapter.java   |  6 ++-
 .../ClusterServiceServletAdapterTest.java       | 47 ++++++++++++++++++++
 .../jobs/impl/SyncQueueManagerImpl.java         |  1 +
 3 files changed, 53 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c989921f/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
index d36aed1..7451b5f 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
@@ -24,12 +24,12 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.framework.config.ConfigDepot;
 
 import com.cloud.cluster.dao.ManagementServerHostDao;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.AdapterBase;
+import com.cloud.utils.component.ComponentLifecycle;
 import com.cloud.utils.db.DbProperties;
 
 public class ClusterServiceServletAdapter extends AdapterBase implements ClusterServiceAdapter
{
@@ -50,6 +50,10 @@ public class ClusterServiceServletAdapter extends AdapterBase implements
Cluster
 
     private int _clusterServicePort = DEFAULT_SERVICE_PORT;
 
+    public ClusterServiceServletAdapter() {
+        setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK);
+    }
+
     @Override
     public ClusterService getPeerService(String strPeer) throws RemoteException {
         try {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c989921f/framework/cluster/test/com/cloud/cluster/ClusterServiceServletAdapterTest.java
----------------------------------------------------------------------
diff --git a/framework/cluster/test/com/cloud/cluster/ClusterServiceServletAdapterTest.java
b/framework/cluster/test/com/cloud/cluster/ClusterServiceServletAdapterTest.java
new file mode 100644
index 0000000..28dbcaa
--- /dev/null
+++ b/framework/cluster/test/com/cloud/cluster/ClusterServiceServletAdapterTest.java
@@ -0,0 +1,47 @@
+// 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.cluster;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import com.cloud.utils.component.ComponentLifecycle;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ClusterServiceServletAdapterTest {
+
+    ClusterServiceServletAdapter clusterServiceServletAdapter;
+    ClusterManagerImpl clusterManagerImpl;
+
+    @Before
+    public void setup() throws IllegalArgumentException,
+            IllegalAccessException, NoSuchFieldException, SecurityException {
+        clusterServiceServletAdapter = new ClusterServiceServletAdapter();
+        clusterManagerImpl = new ClusterManagerImpl();
+    }
+
+    @Test
+    public void testRunLevel() {
+        int runLevel = clusterServiceServletAdapter.getRunLevel();
+        assertTrue(runLevel == ComponentLifecycle.RUN_LEVEL_FRAMEWORK);
+        assertTrue(runLevel == clusterManagerImpl.getRunLevel());
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c989921f/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
index c17c581..2f97991 100644
--- a/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
+++ b/framework/jobs/src/org/apache/cloudstack/framework/jobs/impl/SyncQueueManagerImpl.java
@@ -207,6 +207,7 @@ public class SyncQueueManagerImpl extends ManagerBase implements SyncQueueManage
     @Override
     @DB
     public void returnItem(final long queueItemId) {
+        s_logger.info("Returning queue item " + queueItemId + " back to queue for second
try in case of DB deadlock");
         try {
             Transaction.execute(new TransactionCallbackNoReturn() {
                 @Override


Mime
View raw message