You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ke...@apache.org on 2012/05/28 00:30:44 UTC

[29/50] git commit: CS-9919 Support for Nexus Swiches (Cisco Vswitches)

CS-9919 Support for Nexus Swiches (Cisco Vswitches)

Description:

	Didn't stage all modified files in previous
	commit by mistake. Checking in the rest of
	the changes in this commit. Please refer to
	immediate previous commit for CS-9919 for
	details on what changes went in with this
	commit.

Conflicts:

	client/tomcatconf/cisconexusvsm_commands.properties.in


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

Branch: refs/heads/master
Commit: 187d32057e61aeb06cdb9fe1f65006c914d3c7f2
Parents: c5aba77
Author: Vijayendra Bhamidipati <vi...@citrix.com>
Authored: Wed May 16 19:46:10 2012 -0700
Committer: Vijayendra Bhamidipati <vi...@citrix.com>
Committed: Fri May 25 18:07:48 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/api/commands/AddClusterCmd.java  |   14 +++++++
 .../cisconexusvsm_commands.properties.in           |    3 +-
 .../network/CiscoNexusVSMDeviceManagerImpl.java    |    1 +
 .../network/element/CiscoNexusVSMElement.java      |   28 ---------------
 .../element/CiscoNexusVSMElementService.java       |    9 -----
 .../com/cloud/resource/ResourceManagerImpl.java    |    4 ++-
 6 files changed, 19 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/api/src/com/cloud/api/commands/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddClusterCmd.java b/api/src/com/cloud/api/commands/AddClusterCmd.java
index 28b38ab..c8f7eae 100755
--- a/api/src/com/cloud/api/commands/AddClusterCmd.java
+++ b/api/src/com/cloud/api/commands/AddClusterCmd.java
@@ -74,7 +74,21 @@ public class AddClusterCmd extends BaseCmd {
 
     @Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster")
     private String vsmipaddress;
+    
+    @Parameter(name = ApiConstants.VCENTER_IP_ADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the vCenter the VSM associated with this cluster will connect to")
+    private String vcenteripaddr;
+    
+    @Parameter(name = ApiConstants.VCENTER_DC_NAME, type = CommandType.STRING, required = false, description = "the name of the vCenter Data Center the VSM associated with this cluster will serve")
+    private String vcenterdcname;
+    
+    public String getvCenterDCName() {
+    	return vcenterdcname;
+    }
 
+    public String getvCenterIPAddr() {
+    	return vcenteripaddr;
+    }
+    
     public String getVSMIpaddress() {
         return vsmipaddress;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/client/tomcatconf/cisconexusvsm_commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/cisconexusvsm_commands.properties.in b/client/tomcatconf/cisconexusvsm_commands.properties.in
index aba8e00..f689460 100644
--- a/client/tomcatconf/cisconexusvsm_commands.properties.in
+++ b/client/tomcatconf/cisconexusvsm_commands.properties.in
@@ -1,8 +1,7 @@
 ### bitmap of permissions at the end of each classname, 1 = ADMIN, 2 = RESOURCE_DOMAIN_ADMIN, 4 = DOMAIN_ADMIN, 8 = USER
 ### Please standardize naming conventions to camel-case (even for acronyms).
-
+
 #### Cisco Nexus 1000v Virtual Supervisor Module (VSM) commands
-addCiscoNexusVSM = com.cloud.api.commands.AddCiscoNexusVSMCmd;1
 deleteCiscoNexusVSM = com.cloud.api.commands.DeleteCiscoNexusVSMCmd;1
 enableCiscoNexusVSM = com.cloud.api.commands.EnableCiscoNexusVSMCmd;1
 disableCiscoNexusVSM = com.cloud.api.commands.DisableCiscoNexusVSMCmd;1

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/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 e09eee6..64d8dc3 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
@@ -215,6 +215,7 @@ public abstract class CiscoNexusVSMDeviceManagerImpl extends AdapterBase {
         		if (hosts != null && hosts.size() > 0) {
         			for (Host host: hosts) {
         				if (host.getType() == Host.Type.Routing) {
+        					s_logger.info("Non-empty cluster with id" + clusterId + "still has a host that uses this VSM. Please empty the cluster first");
                 			throw new ResourceInUseException("Non-empty cluster with id" + clusterId + "still has a host that uses this VSM. Please empty the cluster first");
         				}
         			}        			

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/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 f0fc362..5bcbb7b 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -20,7 +20,6 @@ import javax.ejb.Local;
 import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
-import com.cloud.api.commands.AddCiscoNexusVSMCmd;
 import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
 import com.cloud.api.commands.ListCiscoNexusVSMCmd;
 import com.cloud.api.commands.EnableCiscoNexusVSMCmd;
@@ -160,33 +159,6 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme
     public boolean verifyServicesCombination(List<String> services) {
     	return true;
     }
-    
-    @Override
-    public CiscoNexusVSMDeviceVO addCiscoNexusVSM(AddCiscoNexusVSMCmd cmd) {
-    
-    	// This function essentially prepares all the parameters we need to send
-    	// to the addCiscoNexusVSM() function defined in CiscoNexusVSMDeviceManagerImpl.java.
-    	
-    	// We have this separation of functionality between CiscoNexusVSMElement.java
-    	// to address multiple versions of Cisco Nexus Switches in future. This is the
-    	// function/layer that will parse multiple versions and accordingly prepare
-    	// different parameters to pass to to the CiscoNexusVSMDeviceManagerImpl functions
-    	// which will in turn talk to the right resource via the appropriate manager.
-
-        String vsmipaddress = cmd.getIpAddr();
-        String vsmusername = cmd.getUsername();
-        String vsmpassword = cmd.getPassword();
-        String vCenterIpaddr = cmd.getvCenterIpaddr();
-        String vCenterDcName = cmd.getvCenterDcName();
-        long clusterId = cmd.getClusterId();
-        
-        // Invoke the addCiscoNexusVSM() function defined in the upper layer (DeviceMgrImpl).
-        // The  upper layer function will create a resource of type "host" to represent this VSM.
-        // It will add this VSM to the db.
-        //CiscoNexusVSMDeviceVO vsmDeviceVO = addCiscoNexusVSM(clusterId, vsmipaddress, vsmusername, vsmpassword, (ServerResource) new CiscoNexusVSMResource(), vsmName);
-        CiscoNexusVSMDeviceVO vsmDeviceVO = addCiscoNexusVSM(clusterId, vsmipaddress, vsmusername, vsmpassword, vCenterIpaddr, vCenterDcName);
-        return vsmDeviceVO;
-    }
 
     @Override
     public boolean deleteCiscoNexusVSM(DeleteCiscoNexusVSMCmd cmd) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/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 c1c5a07..1810c3e 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java
@@ -19,7 +19,6 @@
 package com.cloud.network.element;
 
 import java.util.List;
-import com.cloud.api.commands.AddCiscoNexusVSMCmd;
 import com.cloud.api.commands.DeleteCiscoNexusVSMCmd;
 import com.cloud.api.commands.EnableCiscoNexusVSMCmd;
 import com.cloud.api.commands.DisableCiscoNexusVSMCmd;
@@ -31,14 +30,6 @@ import com.cloud.network.CiscoNexusVSMDeviceVO;
 import com.cloud.utils.component.PluggableService;
 
 public interface CiscoNexusVSMElementService extends PluggableService {
-
-    /**
-     * adds a Cisco Nexus VSM
-     * @param AddCiscoNexusVSMCmd 
-     * @return CiscoNexusVSMDeviceVO object for the device added
-     */
-    public CiscoNexusVSMDeviceVO addCiscoNexusVSM(AddCiscoNexusVSMCmd cmd);
-
     /**
      * removes a Cisco Nexus VSM
      * @param DeleteCiscoNexusVSMCmd 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/187d3205/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index 99008b0..62653c0 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -434,6 +434,8 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
         String vsmIp = cmd.getVSMIpaddress();
         String vsmUser = cmd.getVSMUsername();
         String vsmPassword = cmd.getVSMPassword();
+        String vCenterIpaddr = cmd.getvCenterIPAddr();
+        String vCenterDcName = cmd.getvCenterDCName();
 
         if (vsmIp != null && vsmUser != null && vsmPassword != null) {
             NetconfHelper netconfClient;
@@ -446,7 +448,7 @@ public class ResourceManagerImpl implements ResourceManager, ResourceService, Ma
                 throw new CloudRuntimeException(msg);
             }
             // persist credentials in database
-            CiscoNexusVSMDeviceVO vsm = new CiscoNexusVSMDeviceVO(vsmIp, vsmUser, vsmPassword, "", "");
+            CiscoNexusVSMDeviceVO vsm = new CiscoNexusVSMDeviceVO(vsmIp, vsmUser, vsmPassword, vCenterIpaddr, vCenterDcName);
             
             Transaction txn = Transaction.currentTxn();
             try {