cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject git commit: updated refs/heads/master to 9cc7442
Date Tue, 13 Aug 2013 12:34:19 GMT
Updated Branches:
  refs/heads/master b4464d88d -> 9cc74429b


CLOUDSTACK-4285: configure simulator API not discovered

- ManagementServerSimulatorImpl is not injected by default context.
configureSimulatorCmd API was loaded as part of it. Use
SimulatorManagerImpl as PluggableService to inject configureSimulator
API.
- Remove unused ManagementServerSimulatorImpl.
- Rename ConfigureSimulator to ConfigureSimulatorCmd for uniformity with
  all API Cmds

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit 0c294a50a8a926580ca724dee137488ea6242bf7)


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

Branch: refs/heads/master
Commit: 9cc74429bd2d539f19d658b2956c781ae09fe243
Parents: b4464d8
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Tue Aug 13 17:59:45 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Tue Aug 13 18:04:08 2013 +0530

----------------------------------------------------------------------
 .../tomcatconf/commands-simulator.properties.in |  2 +-
 .../agent/manager/SimulatorManagerImpl.java     | 13 ++-
 .../cloud/api/commands/ConfigureSimulator.java  | 84 --------------------
 .../api/commands/ConfigureSimulatorCmd.java     | 84 ++++++++++++++++++++
 .../server/ManagementServerSimulatorImpl.java   | 31 --------
 5 files changed, 97 insertions(+), 117 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc74429/agent-simulator/tomcatconf/commands-simulator.properties.in
----------------------------------------------------------------------
diff --git a/agent-simulator/tomcatconf/commands-simulator.properties.in b/agent-simulator/tomcatconf/commands-simulator.properties.in
index a0c1301..ba19e33 100644
--- a/agent-simulator/tomcatconf/commands-simulator.properties.in
+++ b/agent-simulator/tomcatconf/commands-simulator.properties.in
@@ -16,4 +16,4 @@
 # under the License.
 
 
-configureSimulator=com.cloud.api.commands.ConfigureSimulator;1
+configureSimulator=com.cloud.api.commands.ConfigureSimulatorCmd;1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc74429/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
index 391efee..bcd4200 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
@@ -86,6 +86,7 @@ import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.ListTemplateCommand;
 import com.cloud.agent.api.storage.ListVolumeCommand;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
+import com.cloud.api.commands.ConfigureSimulatorCmd;
 import com.cloud.resource.SimulatorStorageProcessor;
 import com.cloud.simulator.MockConfigurationVO;
 import com.cloud.simulator.MockHost;
@@ -96,6 +97,7 @@ import com.cloud.storage.resource.StorageSubsystemCommandHandler;
 import com.cloud.storage.resource.StorageSubsystemCommandHandlerBase;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
+import com.cloud.utils.component.PluggableService;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
@@ -110,12 +112,14 @@ import org.springframework.stereotype.Component;
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Component
 @Local(value = { SimulatorManager.class })
-public class SimulatorManagerImpl extends ManagerBase implements SimulatorManager {
+public class SimulatorManagerImpl extends ManagerBase implements SimulatorManager, PluggableService
{
     private static final Logger s_logger = Logger.getLogger(SimulatorManagerImpl.class);
     @Inject
     MockVmManager _mockVmMgr;
@@ -168,6 +172,13 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage
         return _mockAgentMgr;
     }
 
+    @Override
+    public List<Class<?>> getCommands() {
+        List<Class<?>> cmdList = new ArrayList<Class<?>>();
+        cmdList.add(ConfigureSimulatorCmd.class);
+        return cmdList;
+    }
+
     @DB
     @Override
     public Answer simulate(Command cmd, String hostGuid) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc74429/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
deleted file mode 100755
index e982665..0000000
--- a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java
+++ /dev/null
@@ -1,84 +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 com.cloud.api.commands;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.manager.SimulatorManager;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
-
-
-@APICommand(name = "configureSimulator", description="configure simulator", responseObject=SuccessResponse.class)
-public class ConfigureSimulator extends BaseCmd {
-    public static final Logger s_logger = Logger.getLogger(ConfigureSimulator.class.getName());
-    private static final String s_name = "configuresimulatorresponse";
-
-    @Inject SimulatorManager _simMgr;
-
-    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="configure range:
in a zone")
-    private Long zoneId;
-
-    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="configure range:
in a pod")
-    private Long podId;
-
-    @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="configure
range: in a cluster")
-    private Long clusterId;
-
-    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="configure range:
in a host")
-    private Long hostId;
-
-    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="which
command needs to be configured")
-    private String command;
-
-    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, required=true, description="configuration
options for this command, which is seperated by ;")
-    private String values;
-
-    @Override
-    public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException {
-        boolean result = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command,
values);
-        if (!result) {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure
simulator");
-        }
-
-        SuccessResponse response = new SuccessResponse(getCommandName());
-        this.setResponseObject(response);
-    }
-
-    @Override
-    public String getCommandName() {
-        return s_name;
-    }
-
-    @Override
-    public long getEntityOwnerId() {
-        return Account.ACCOUNT_ID_SYSTEM;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc74429/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
new file mode 100755
index 0000000..b5685e4
--- /dev/null
+++ b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulatorCmd.java
@@ -0,0 +1,84 @@
+// 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.api.commands;
+
+import com.cloud.agent.manager.SimulatorManager;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+
+@APICommand(name = "configureSimulator", description="configure simulator", responseObject=SuccessResponse.class)
+public class ConfigureSimulatorCmd extends BaseCmd {
+    public static final Logger s_logger = Logger.getLogger(ConfigureSimulatorCmd.class.getName());
+    private static final String s_name = "configuresimulatorresponse";
+
+    @Inject SimulatorManager _simMgr;
+
+    @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="configure range:
in a zone")
+    private Long zoneId;
+
+    @Parameter(name=ApiConstants.POD_ID, type=CommandType.LONG, description="configure range:
in a pod")
+    private Long podId;
+
+    @Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.LONG, description="configure
range: in a cluster")
+    private Long clusterId;
+
+    @Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, description="configure range:
in a host")
+    private Long hostId;
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="which
command needs to be configured")
+    private String command;
+
+    @Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, required=true, description="configuration
options for this command, which is seperated by ;")
+    private String values;
+
+    @Override
+    public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException {
+        boolean result = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command,
values);
+        if (!result) {
+            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure
simulator");
+        }
+
+        SuccessResponse response = new SuccessResponse(getCommandName());
+        this.setResponseObject(response);
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        return Account.ACCOUNT_ID_SYSTEM;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cc74429/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
deleted file mode 100644
index 728271c..0000000
--- a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java
+++ /dev/null
@@ -1,31 +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 com.cloud.server;
-
-
-import java.util.List;
-
-import com.cloud.api.commands.ConfigureSimulator;
-
-public class ManagementServerSimulatorImpl extends ManagementServerImpl {
-    @Override
-    public List<Class<?>> getCommands() {
-        List<Class<?>> cmdList = super.getCommands();
-        cmdList.add(ConfigureSimulator.class);
-        return cmdList;
-    }
-}


Mime
View raw message