cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From frankzh...@apache.org
Subject git commit: updated refs/heads/4.2 to a473e49
Date Wed, 07 Aug 2013 00:51:25 GMT
Updated Branches:
  refs/heads/4.2 0243f043c -> a473e49b7


CLOUDSTACK-4093
UCS:API: Need delete UCS_manager API


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

Branch: refs/heads/4.2
Commit: a473e49b72eea75cd76ab4efebc2e5b74f0e3585
Parents: 0243f04
Author: frank <frank.zhang@citrix.com>
Authored: Tue Aug 6 17:58:48 2013 -0700
Committer: frank <frank.zhang@citrix.com>
Committed: Tue Aug 6 17:59:20 2013 -0700

----------------------------------------------------------------------
 client/tomcatconf/commands.properties.in        |  1 +
 .../src/com/cloud/ucs/manager/UcsManager.java   |  2 +
 .../com/cloud/ucs/manager/UcsManagerImpl.java   | 11 ++++
 .../cloudstack/api/DeleteUcsManagerCmd.java     | 58 ++++++++++++++++++++
 4 files changed, 72 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a473e49b/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 47282af..66782e0 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -617,6 +617,7 @@ listUcsManagers=1
 listUcsProfiles=1
 listUcsBlades=1
 associateUcsProfileToBlade=1
+deleteUcsManager=1
 
 #### New Load Balancer commands
 createLoadBalancer=15

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a473e49b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
index 35a4459..0833e31 100755
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java
@@ -40,4 +40,6 @@ public interface UcsManager extends Manager, PluggableService {
     UcsBladeResponse associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd);
 
     ListResponse<UcsBladeResponse> listUcsBlades(ListUcsBladeCmd cmd);
+    
+    void deleteUcsManager(Long id);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a473e49b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
index e19c72a..d3068a8 100755
--- a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
+++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java
@@ -491,4 +491,15 @@ public class UcsManagerImpl implements UcsManager {
         cmds.add(AssociateUcsProfileToBladeCmd.class);
         return cmds;
     }
+
+	@Override
+	public void deleteUcsManager(Long id) {
+        SearchCriteriaService<UcsBladeVO, UcsBladeVO> serv = SearchCriteria2.create(UcsBladeVO.class);
+        serv.addAnd(serv.getEntity().getUcsManagerId(), Op.EQ, id);
+        List<UcsBladeVO> vos = serv.list();
+        for (UcsBladeVO vo : vos) {
+        	bladeDao.remove(vo.getId());
+        }
+		ucsDao.remove(id);
+	}
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a473e49b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java
b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java
new file mode 100644
index 0000000..c715c56
--- /dev/null
+++ b/plugins/hypervisors/ucs/src/org/apache/cloudstack/api/DeleteUcsManagerCmd.java
@@ -0,0 +1,58 @@
+package org.apache.cloudstack.api;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.ucs.manager.UcsManager;
+import com.cloud.user.Account;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.UcsManagerResponse;
+import org.apache.log4j.Logger;
+
+import javax.inject.Inject;
+
+@APICommand(name="deleteUcsManager", description="Delete a Ucs manager", responseObject=
SuccessResponse.class)
+public class DeleteUcsManagerCmd extends BaseCmd {
+	private static final Logger logger = Logger.getLogger(DeleteUcsManagerCmd.class);
+	
+    @Inject
+    private UcsManager mgr;
+
+    @Parameter(name=ApiConstants.UCS_MANAGER_ID, type= BaseCmd.CommandType.UUID, description="ucs
manager id", entityType=UcsManagerResponse.class, required=true)
+    private Long ucsManagerId;
+
+    public Long getUcsManagerId() {
+        return ucsManagerId;
+    }
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException,
+			NetworkRuleConflictException {
+		try {
+			mgr.deleteUcsManager(ucsManagerId);
+			SuccessResponse rsp = new SuccessResponse();
+			rsp.setResponseName(getCommandName());
+			rsp.setObjectName("success");
+			this.setResponseObject(rsp);
+		} catch (Exception e) {
+			logger.debug(e.getMessage(), e);
+			throw new CloudRuntimeException(e);
+		}
+	}
+
+	@Override
+	public String getCommandName() {
+		return "deleteUcsManagerResponse";
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		return Account.ACCOUNT_ID_SYSTEM;
+	}
+}


Mime
View raw message