Updated Branches:
  refs/heads/master 30c334150 -> f6a2c817b

Switched AgentManager to use ConfigDepot


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

Branch: refs/heads/master
Commit: cf3bbb1fb1441cb07884483a9d2cb7c8e3031c81
Parents: 30c3341
Author: Alex Huang <alex.hu...@citrix.com>
Authored: Mon Aug 5 10:47:57 2013 -0700
Committer: Alex Huang <alex.hu...@citrix.com>
Committed: Wed Aug 7 16:41:00 2013 -0700

----------------------------------------------------------------------
 engine/compute/pom.xml                          | 52 --------------------
 .../cloudstack/compute/ComputeOrchestrator.java | 34 -------------
 .../compute/ComputeOrchestratorImpl.java        | 42 ----------------
 .../cloudstack/platform/planning/Concierge.java | 36 --------------
 engine/pom.xml                                  |  1 -
 .../cloud/agent/manager/AgentManagerImpl.java   | 13 +++--
 .../manager/ClusteredAgentManagerImpl.java      | 11 ++---
 7 files changed, 9 insertions(+), 180 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/engine/compute/pom.xml
----------------------------------------------------------------------
diff --git a/engine/compute/pom.xml b/engine/compute/pom.xml
deleted file mode 100644
index 9ad9ebc..0000000
--- a/engine/compute/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<!--
-  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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>cloud-engine-compute</artifactId>
-  <name>Apache CloudStack Cloud Engine Compute Component</name>
-  <parent>
-    <groupId>org.apache.cloudstack</groupId>
-    <artifactId>cloud-engine</artifactId>
-    <version>4.3.0-SNAPSHOT</version>
-    <relativePath>../pom.xml</relativePath>
-  </parent>
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-engine-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-framework-ipc</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.cloudstack</groupId>
-      <artifactId>cloud-engine-components-api</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-  </dependencies>
-  <build>
-    <defaultGoal>install</defaultGoal>
-    <sourceDirectory>src</sourceDirectory>
-    <testSourceDirectory>test</testSourceDirectory>
-  </build>
-</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
----------------------------------------------------------------------
diff --git 
a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java 
b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
deleted file mode 100755
index 37d0e6b..0000000
--- a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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 org.apache.cloudstack.compute;
-
-import java.util.logging.Handler;
-
-public interface ComputeOrchestrator {
-    /**
-     * start the vm 
-     * @param vm vm
-     * @param reservationId
-     */
-    void start(String vm, String reservationId, Handler handler);
-
-    void cancel(String reservationId);
-
-    void stop(String vm, String reservationId);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java 
b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
deleted file mode 100755
index 12d4533..0000000
--- 
a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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 org.apache.cloudstack.compute;
-
-import java.util.logging.Handler;
-
-
-public class ComputeOrchestratorImpl implements ComputeOrchestrator {
-
-    @Override
-    public void cancel(String reservationId) {
-    }
-
-    @Override
-    public void stop(String vm, String reservationId) {
-        // Retrieve the VM
-        // Locate the HypervisorGuru based on the VM type
-        // Call HypervisorGuru to stop the VM
-    }
-
-    @Override
-    public void start(String vm, String reservationId, Handler handler) {
-        // TODO Auto-generated method stub
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
----------------------------------------------------------------------
diff --git 
a/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java 
b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
deleted file mode 100755
index 97dfb2b..0000000
--- a/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 org.apache.cloudstack.platform.planning;
-
-import org.apache.cloudstack.framework.ipc.Ipc;
-
-public interface Concierge {
-    @Ipc(topic="cs.concierge.reserve")
-    String reserve(String vm, String planner, Long until);
-
-    @Ipc(topic="cs.concierge.cancel")
-    String cancel(String reservationId);
-
-    @Ipc(topic="cs.concierge.claim")
-    String claim(String reservationId);
-
-    @Ipc(topic="cs.concierge.reserveAnother")
-    String reserveAnother(String reservationId);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
index 25a2fa4..040246a 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -32,7 +32,6 @@
   </build>
   <modules>
     <module>api</module>
-    <module>compute</module>
     <module>orchestration</module>
     <module>storage</module>
     <module>storage/volume</module>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java 
b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index 200b5d7..5634754 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -97,7 +97,6 @@ import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
 import com.cloud.resource.ServerResource;
 import com.cloud.storage.resource.DummySecondaryStorageResource;
-import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
@@ -148,7 +147,6 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     protected ConfigurationDao _configDao = null;
     @Inject
     protected ClusterDao _clusterDao = null;
-    protected int _port;
 
     @Inject
     protected HighAvailabilityManager _haMgr = null;
@@ -194,12 +192,13 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
     protected final ConfigKey<Integer> DirectAgentPoolSize = new 
ConfigKey<Integer>(Integer.class, "direct.agent.pool.size", "Advance", 
AgentManager.class, "500",
             "Default size for DirectAgentPool", false, null);
 
+    protected ConfigValue<Integer> _port;
+
     @Override
     public boolean configure(final String name, final Map<String, Object> 
params) throws ConfigurationException {
 
-        final Map<String, String> configs = 
_configDao.getConfiguration("AgentManager", params);
-        _port = NumbersUtil.parseInt(configs.get("port"), 8250);
-        final int workers = NumbersUtil.parseInt(configs.get("workers"), 5);
+        _port = _configDepot.get(Port);
+        ConfigValue<Integer> workers = _configDepot.get(Workers);
 
         _pingInterval = _configDepot.get(PingInterval);
 
@@ -225,8 +224,8 @@ public class AgentManagerImpl extends ManagerBase 
implements AgentManager, Handl
         //allow core threads to time out even when there are no items in the 
queue
         _connectExecutor.allowCoreThreadTimeOut(true);
 
-        _connection = new NioServer("AgentManager", _port, workers + 10, this);
-        s_logger.info("Listening on " + _port + " with " + workers + " 
workers");
+        _connection = new NioServer("AgentManager", _port.value(), 
workers.value() + 10, this);
+        s_logger.info("Listening on " + _port.value() + " with " + 
workers.value() + " workers");
 
         
         ConfigValue<Integer> size = _configDepot.get(DirectAgentPoolSize);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf3bbb1f/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java 
b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index 0c3d6e1..a28d381 100755
--- a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -83,7 +83,6 @@ import com.cloud.host.Host;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
 import com.cloud.host.Status.Event;
-import com.cloud.resource.ResourceState;
 import com.cloud.resource.ServerResource;
 import com.cloud.serializer.GsonHelper;
 import com.cloud.storage.resource.DummySecondaryStorageResource;
@@ -508,13 +507,13 @@ public class ClusteredAgentManagerImpl extends 
AgentManagerImpl implements Clust
                     throw new CloudRuntimeException("Unable to resolve " + ip);
                 }
                 try {
-                    ch = SocketChannel.open(new InetSocketAddress(addr, 
_port));
+                    ch = SocketChannel.open(new InetSocketAddress(addr, 
_port.value()));
                     ch.configureBlocking(true); // make sure we are working at 
blocking mode
                     ch.socket().setKeepAlive(true);
                     ch.socket().setSoTimeout(60 * 1000);
                     try {
                         SSLContext sslContext = Link.initSSLContext(true);
-                        sslEngine = sslContext.createSSLEngine(ip, _port);
+                        sslEngine = sslContext.createSSLEngine(ip, 
_port.value());
                         sslEngine.setUseClientMode(true);
 
                         Link.doHandshake(ch, sslEngine, true);
@@ -1241,10 +1240,6 @@ public class ClusteredAgentManagerImpl extends 
AgentManagerImpl implements Clust
     }
 
 
-    public boolean executeResourceUserRequest(long hostId, ResourceState.Event 
event) throws AgentUnavailableException {
-        return _resourceMgr.executeUserRequest(hostId, event);
-    }
-
     protected class ClusterDispatcher implements ClusterManager.Dispatcher {
         @Override
         public String getName() {
@@ -1317,7 +1312,7 @@ public class ClusteredAgentManagerImpl extends 
AgentManagerImpl implements Clust
 
                 boolean result = false;
                 try {
-                    result = executeResourceUserRequest(cmd.getHostId(), 
cmd.getEvent());
+                    result = _resourceMgr.executeUserRequest(cmd.getHostId(), 
cmd.getEvent());
                     s_logger.debug("Result is " + result);
                 } catch (AgentUnavailableException ex) {
                     s_logger.warn("Agent is unavailable", ex);

Reply via email to