cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke4...@apache.org
Subject [9/50] git commit: CS-9919: Support for Nexus Swiches (Cisco Vswitches)
Date Sun, 27 May 2012 22:30:43 GMT
CS-9919: Support for Nexus Swiches (Cisco Vswitches)

Description:

	Incorporating more changes from Alena's review.

	Modified the Nexus Enable and Disable commands
	to return CiscoNexusVSMResponse instead of
	SuccessResponse.

	Put event annotations for enable/disable functions
	that the enable/disable nexus commands cal into.


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

Branch: refs/heads/master
Commit: 7f26a43d481a1f2f79713a5b0830c9a399927d2f
Parents: 15d0cf7
Author: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Authored: Wed May 23 17:42:39 2012 -0700
Committer: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Committed: Fri May 25 18:37:50 2012 -0700

----------------------------------------------------------------------
 .../api/commands/DisableCiscoNexusVSMCmd.java      |   12 ++++++------
 .../cloud/api/commands/EnableCiscoNexusVSMCmd.java |   12 ++++++------
 .../network/CiscoNexusVSMDeviceManagerImpl.java    |   12 +++++-------
 .../network/element/CiscoNexusVSMElement.java      |   10 ++++++----
 .../element/CiscoNexusVSMElementService.java       |    4 ++--
 5 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f26a43d/server/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java b/server/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
index 8700086..17f4eb1 100644
--- a/server/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
+++ b/server/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java
@@ -27,17 +27,17 @@ import com.cloud.api.Implementation;
 import com.cloud.api.Parameter;
 import com.cloud.api.PlugService;
 import com.cloud.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.element.CiscoNexusVSMElementService;
 import com.cloud.user.Account;
-import com.cloud.user.UserContext;
 import com.cloud.event.EventTypes;
+import com.cloud.api.response.CiscoNexusVSMResponse;
+import com.cloud.network.CiscoNexusVSMDevice;
 
-@Implementation(responseObject=SuccessResponse.class, description="disable a Cisco Nexus
VSM device")
+@Implementation(responseObject=CiscoNexusVSMResponse.class, description="disable a Cisco
Nexus VSM device")
 public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd {
 
     public static final Logger s_logger = Logger.getLogger(DisableCiscoNexusVSMCmd.class.getName());
@@ -66,9 +66,9 @@ public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd {
 
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException {
-    	boolean result = _ciscoNexusVSMService.disableCiscoNexusVSM(this);
-        if (result) {
-        	SuccessResponse response = new SuccessResponse(getCommandName());
+    	CiscoNexusVSMDevice result = _ciscoNexusVSMService.disableCiscoNexusVSM(this);
+        if (result != null) {
+        	CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
         	response.setResponseName(getCommandName());
         	this.setResponseObject(response);
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f26a43d/server/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java b/server/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
index af85a86..b532269 100644
--- a/server/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
+++ b/server/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java
@@ -27,7 +27,6 @@ import com.cloud.api.Implementation;
 import com.cloud.api.Parameter;
 import com.cloud.api.PlugService;
 import com.cloud.api.ServerApiException;
-import com.cloud.api.response.SuccessResponse;
 import com.cloud.event.EventTypes;
 import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientCapacityException;
@@ -35,9 +34,10 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
 import com.cloud.network.element.CiscoNexusVSMElementService;
 import com.cloud.user.Account;
-import com.cloud.user.UserContext;
+import com.cloud.api.response.CiscoNexusVSMResponse;
+import com.cloud.network.CiscoNexusVSMDevice;
 
-@Implementation(responseObject=SuccessResponse.class, description="Enable a Cisco Nexus VSM
device")
+@Implementation(responseObject=CiscoNexusVSMResponse.class, description="Enable a Cisco Nexus
VSM device")
 public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd {
 
     public static final Logger s_logger = Logger.getLogger(EnableCiscoNexusVSMCmd.class.getName());
@@ -66,9 +66,9 @@ public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd {
 
     @Override
     public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException {
-    	boolean result = _ciscoNexusVSMService.enableCiscoNexusVSM(this);
-        if (result) {
-        	SuccessResponse response = new SuccessResponse(getCommandName());
+    	CiscoNexusVSMDevice result = _ciscoNexusVSMService.enableCiscoNexusVSM(this);
+        if (result != null) {
+        	CiscoNexusVSMResponse response = _ciscoNexusVSMService.createCiscoNexusVSMDetailedResponse(result);
         	response.setResponseName(getCommandName());
         	this.setResponseObject(response);
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f26a43d/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
index fec8a4a..6746880 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
@@ -242,10 +242,9 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase
{
     }
 
     @DB
-    public boolean enableCiscoNexusVSM(long vsmId) {
+    public CiscoNexusVSMDeviceVO enableCiscoNexusVSM(long vsmId) {
         CiscoNexusVSMDeviceVO cisconexusvsm = _ciscoNexusVSMDeviceDao.findById(vsmId);
         if (cisconexusvsm == null) {
-        	// This entry is already not present. Return success.
         	throw new InvalidParameterValueException("Invalid vsm Id specified");        	
         }
         // Else, check if this db record shows that this VSM is enabled or not.
@@ -269,14 +268,13 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase
{
         obj.addPortProfile("pp1", 1, 4000, PortType.vEthernet, BindingType.Ephemeral);
         ***/
         
-        return true;
+        return cisconexusvsm;
     }
     
-    @DB
-    public boolean disableCiscoNexusVSM(long vsmId) {
+    @DB    
+    public CiscoNexusVSMDeviceVO disableCiscoNexusVSM(long vsmId) {
         CiscoNexusVSMDeviceVO cisconexusvsm = _ciscoNexusVSMDeviceDao.findById(vsmId);
         if (cisconexusvsm == null) {
-        	// This entry is already not present. Return success.
         	throw new InvalidParameterValueException("Invalid vsm Id specified");        	
         }
         // Else, check if this db record shows that this VSM is enabled or not.
@@ -301,7 +299,7 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase
{
         obj2.deletePortProfile(obj.getId());
         //_ppmgr.addPortProfile("pp1", 1, 4000, PortType.vEthernet, BindingType.Ephemeral);
         **/
-        return true;
+        return cisconexusvsm;
     }
     
     @DB

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f26a43d/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
index 1156a26..c57b664 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -146,15 +146,17 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl
impleme
     }    
 
     @Override
-    public boolean enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd) {
-    	boolean result;
+    @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, eventDescription
= "deleting VSM", async = true)  
+    public CiscoNexusVSMDeviceVO enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd) {
+    	CiscoNexusVSMDeviceVO result;
     	result = enableCiscoNexusVSM(cmd.getCiscoNexusVSMDeviceId());
     	return result;
     }
     
     @Override
-    public boolean disableCiscoNexusVSM(DisableCiscoNexusVSMCmd cmd) {
-    	boolean result;
+    @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, eventDescription
= "deleting VSM", async = true)
+    public CiscoNexusVSMDeviceVO disableCiscoNexusVSM(DisableCiscoNexusVSMCmd cmd) {
+    	CiscoNexusVSMDeviceVO result;
     	result = disableCiscoNexusVSM(cmd.getCiscoNexusVSMDeviceId());
     	return result;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7f26a43d/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
index 2912e6f..d462e99 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
@@ -40,13 +40,13 @@ public interface CiscoNexusVSMElementService extends PluggableService
{
     /**
      * Enables a Cisco Nexus VSM. 
      */
-    public boolean enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd);
+    public CiscoNexusVSMDeviceVO enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd);
     
     
     /**
      * Disables a Cisco Nexus VSM.
      */
-    public boolean disableCiscoNexusVSM(DisableCiscoNexusVSMCmd cmd);
+    public CiscoNexusVSMDeviceVO disableCiscoNexusVSM(DisableCiscoNexusVSMCmd cmd);
     
     /**
      * Returns a list of VSMs.


Mime
View raw message