You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/04/11 00:25:49 UTC

[08/54] [abbrv] git commit: updated refs/heads/affinity_groups to 6ec7e25

QuickCloud: Remove reference to unused code
QuickCloud: remove some dead code in ConsoleProxyManager


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

Branch: refs/heads/affinity_groups
Commit: 790d2ce82ef6b1ac910124c8c9ab519e2431e622
Parents: 1679044
Author: Chiradeep Vittal <ch...@apache.org>
Authored: Mon Mar 25 12:13:51 2013 -0700
Committer: Chiradeep Vittal <ch...@apache.org>
Committed: Tue Apr 9 14:45:26 2013 -0700

----------------------------------------------------------------------
 .../cloud/api/commands/DestroyConsoleProxyCmd.java |   12 +------
 .../cloud/consoleproxy/ConsoleProxyService.java    |   23 ---------------
 api/src/org/apache/cloudstack/api/BaseCmd.java     |    2 -
 .../cloud/consoleproxy/ConsoleProxyManager.java    |   17 +----------
 .../consoleproxy/ConsoleProxyManagerImpl.java      |   20 ++-----------
 .../cloud/consoleproxy/ConsoleProxyService.java    |    9 ++++++
 6 files changed, 15 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
index 829283e..f3210ce 100644
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
@@ -17,14 +17,12 @@
 package com.cloud.api.commands;
 
 import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ApiErrorCode;
 import org.apache.cloudstack.api.BaseAsyncCmd;
 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.event.EventTypes;
+import com.cloud.exception.UnsupportedServiceException;
 import com.cloud.user.Account;
 import com.cloud.user.UserContext;
 
@@ -82,12 +80,6 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
 
     @Override
     public void execute(){
-        boolean result = _consoleProxyService.destroyConsoleProxy(this);
-        if (result) {
-            SuccessResponse response = new SuccessResponse(getCommandName());
-            this.setResponseObject(response);
-        } else {
-            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
-        }
+        throw new UnsupportedServiceException("Use destroySystemVm API instead");
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/api/src/com/cloud/consoleproxy/ConsoleProxyService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/consoleproxy/ConsoleProxyService.java b/api/src/com/cloud/consoleproxy/ConsoleProxyService.java
deleted file mode 100644
index c347e0b..0000000
--- a/api/src/com/cloud/consoleproxy/ConsoleProxyService.java
+++ /dev/null
@@ -1,23 +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.consoleproxy;
-
-import com.cloud.api.commands.DestroyConsoleProxyCmd;
-
-public interface ConsoleProxyService {
-    boolean destroyConsoleProxy(DestroyConsoleProxyCmd cmd);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 78a2af3..8fef422 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -32,7 +32,6 @@ import org.apache.cloudstack.usage.UsageService;
 import org.apache.log4j.Logger;
 
 import com.cloud.configuration.ConfigurationService;
-import com.cloud.consoleproxy.ConsoleProxyService;
 import com.cloud.dao.EntityManager;
 import com.cloud.domain.Domain;
 import com.cloud.exception.ConcurrentOperationException;
@@ -109,7 +108,6 @@ public abstract class BaseCmd {
     @Inject public TemplateService _templateService;
     @Inject public SecurityGroupService _securityGroupService;
     @Inject public SnapshotService _snapshotService;
-    @Inject public ConsoleProxyService _consoleProxyService;
     @Inject public VpcVirtualNetworkApplianceService _routerService;
     @Inject public ResponseGenerator _responseGenerator;
     @Inject public EntityManager _entityMgr;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManager.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
index 6ebf3bc..faec513 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
@@ -16,17 +16,9 @@
 // under the License.
 package com.cloud.consoleproxy;
 
-import com.cloud.agent.api.AgentControlAnswer;
-import com.cloud.agent.api.ConsoleAccessAuthenticationCommand;
-import com.cloud.agent.api.ConsoleProxyLoadReportCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status;
-import com.cloud.host.Host.Type;
-import com.cloud.info.ConsoleProxyInfo;
 import com.cloud.utils.component.Manager;
 import com.cloud.vm.ConsoleProxyVO;
-public interface ConsoleProxyManager extends Manager {
+public interface ConsoleProxyManager extends Manager, ConsoleProxyService {
 	
 	public static final int DEFAULT_PROXY_CAPACITY = 50;
 	public static final int DEFAULT_STANDBY_CAPACITY = 10;
@@ -45,16 +37,9 @@ public interface ConsoleProxyManager extends Manager {
     public ConsoleProxyManagementState getManagementState();
     public void resumeLastManagementState();
 	
-	public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId);
-	
 	public ConsoleProxyVO startProxy(long proxyVmId);
 	public boolean stopProxy(long proxyVmId);
 	public boolean rebootProxy(long proxyVmId);
 	public boolean destroyProxy(long proxyVmId);
-
-	public void onLoadReport(ConsoleProxyLoadReportCommand cmd);
-	public AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd);
 	
-    public void onAgentConnect(HostVO host, StartupCommand cmd);
-	public void onAgentDisconnect(long agentId, Status state);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 1edd869..fc4fc6e 100755
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -30,7 +30,6 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
-import org.apache.cloudstack.api.ServerApiException;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.log4j.Logger;
@@ -54,7 +53,6 @@ import com.cloud.agent.api.proxy.StartConsoleProxyAgentHttpHandlerCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.manager.Commands;
-import com.cloud.api.commands.DestroyConsoleProxyCmd;
 import com.cloud.certificate.dao.CertificateDao;
 import com.cloud.cluster.ClusterManager;
 import com.cloud.configuration.Config;
@@ -71,7 +69,6 @@ import com.cloud.deploy.DeployDestination;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
 import com.cloud.exception.OperationTimedoutException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.exception.StorageUnavailableException;
@@ -113,8 +110,8 @@ import com.cloud.servlet.ConsoleProxyServlet;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePoolStatus;
 import com.cloud.storage.VMTemplateHostVO;
-import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VMTemplateHostDao;
@@ -127,7 +124,6 @@ import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.Manager;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GlobalLock;
@@ -170,7 +166,8 @@ import com.google.gson.GsonBuilder;
 // because sooner or later, it will be driven into Running state
 //
 @Local(value = { ConsoleProxyManager.class, ConsoleProxyService.class })
-public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxyManager, ConsoleProxyService, AgentHook, VirtualMachineGuru<ConsoleProxyVO>, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
+public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxyManager,
+        AgentHook, VirtualMachineGuru<ConsoleProxyVO>, SystemVmLoadScanHandler<Long>, ResourceStateAdapter {
     private static final Logger s_logger = Logger.getLogger(ConsoleProxyManagerImpl.class);
 
     private static final int DEFAULT_CAPACITY_SCAN_INTERVAL = 30000; // 30 seconds
@@ -1549,18 +1546,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
         return true;
     }
 
-    @Override
-    public boolean destroyConsoleProxy(DestroyConsoleProxyCmd cmd) throws ServerApiException {
-        Long proxyId = cmd.getId();
 
-        // verify parameters
-        ConsoleProxyVO proxy = _consoleProxyDao.findById(proxyId);
-        if (proxy == null) {
-            throw new InvalidParameterValueException("unable to find a console proxy with id " + proxyId);
-        }
-
-        return destroyProxy(proxyId);
-    }
 
     protected ConsoleProxyManagerImpl() {
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/790d2ce8/server/src/com/cloud/consoleproxy/ConsoleProxyService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyService.java b/server/src/com/cloud/consoleproxy/ConsoleProxyService.java
new file mode 100644
index 0000000..e43e5c3
--- /dev/null
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyService.java
@@ -0,0 +1,9 @@
+package com.cloud.consoleproxy;
+
+import com.cloud.info.ConsoleProxyInfo;
+
+public interface ConsoleProxyService {
+
+    public abstract ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId);
+
+}
\ No newline at end of file