CS-9919: Support for Nexus Swiches (Cisco Vswitches)
Description:

        Removed the vcenter_dc_name and vcenter_ipaddr
        fields from the virtual_supervisor_module
        table, the CiscoNexusVSMDeviceVO, addClusterCmd,
        and all other references to these two fields.

        Fixing null pointer exceptions when checking
        for nexus related global parameter values in
        addClusterCmd.


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

Branch: refs/heads/3.0.x
Commit: a48a3bbfbde218d64238d5f6cf2aef6d45349d27
Parents: 44b88e0
Author: Vijayendra Bhamidipati <[email protected]>
Authored: Wed May 23 16:44:50 2012 -0700
Committer: Vijayendra Bhamidipati <[email protected]>
Committed: Wed May 23 16:53:27 2012 -0700

----------------------------------------------------------------------
 api/src/com/cloud/api/ApiConstants.java            |    2 -
 api/src/com/cloud/api/commands/AddClusterCmd.java  |   14 -----
 .../cloud/api/response/CiscoNexusVSMResponse.java  |   14 -----
 api/src/com/cloud/network/CiscoNexusVSMDevice.java |    4 --
 .../hypervisor/vmware/VmwareServerDiscoverer.java  |    6 +-
 .../network/CiscoNexusVSMDeviceManagerImpl.java    |    2 +-
 .../com/cloud/network/CiscoNexusVSMDeviceVO.java   |   39 +--------------
 .../network/element/CiscoNexusVSMElement.java      |    2 -
 .../com/cloud/resource/ResourceManagerImpl.java    |    4 +-
 setup/db/create-schema.sql                         |    2 -
 setup/db/db/schema-302to303.sql                    |    2 -
 11 files changed, 7 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/api/src/com/cloud/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/ApiConstants.java 
b/api/src/com/cloud/api/ApiConstants.java
index 4b2b2e5..d9d31cd 100755
--- a/api/src/com/cloud/api/ApiConstants.java
+++ b/api/src/com/cloud/api/ApiConstants.java
@@ -339,8 +339,6 @@ public class ApiConstants {
     public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = 
"vsmdevicestate";
     // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts 
managed by it perhaps? May remove this later.
     public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = 
"vsmdevicecapacity";
-    public static final String VCENTER_IP_ADDRESS = "vcenteripaddr";
-    public static final String VCENTER_DC_NAME = "vcenterdcname";
     public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
     public static final String VSM_USERNAME = "vsmusername";
     public static final String VSM_PASSWORD = "vsmpassword";

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/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 17d1b32..181da86 100755
--- a/api/src/com/cloud/api/commands/AddClusterCmd.java
+++ b/api/src/com/cloud/api/commands/AddClusterCmd.java
@@ -73,20 +73,6 @@ 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/a48a3bbf/api/src/com/cloud/api/response/CiscoNexusVSMResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/CiscoNexusVSMResponse.java 
b/api/src/com/cloud/api/response/CiscoNexusVSMResponse.java
index 3bef2ed..1bc880e 100644
--- a/api/src/com/cloud/api/response/CiscoNexusVSMResponse.java
+++ b/api/src/com/cloud/api/response/CiscoNexusVSMResponse.java
@@ -32,12 +32,6 @@ public class CiscoNexusVSMResponse extends BaseResponse {
     
     @SerializedName(ApiConstants.EXTERNAL_SWITCH_MGMT_DEVICE_STATE) 
@Param(description="device state")
     private String deviceState;
-
-    @SerializedName(ApiConstants.VCENTER_IP_ADDRESS) 
@Param(description="ipaddress of vCenter the VSM connects to")
-    private String vcenteripaddress;
-    
-    @SerializedName(ApiConstants.VCENTER_DC_NAME) @Param(description="name of 
the vCenter Data Center the VSM is associated with")
-    private String vcenterdcname;
     
     @SerializedName(ApiConstants.VSM_MGMT_VLAN_ID) 
@Param(description="management vlan id of the VSM")
     private String vsmmgmtvlanid;
@@ -80,14 +74,6 @@ public class CiscoNexusVSMResponse extends BaseResponse {
        this.deviceState = deviceState;
     }
     
-    public void setvCenterIpAddress(String ipaddress) {
-       this.vcenteripaddress = ipaddress;
-    }
-    
-    public void setvCenterDcName(String dcName) {
-       this.vcenterdcname = dcName;
-    }
-    
     public void setVSMMgmtVlanId(String vlanId) {
        this.vsmmgmtvlanid = vlanId;
     }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/api/src/com/cloud/network/CiscoNexusVSMDevice.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/CiscoNexusVSMDevice.java 
b/api/src/com/cloud/network/CiscoNexusVSMDevice.java
index 66315da..7b9ba9f 100644
--- a/api/src/com/cloud/network/CiscoNexusVSMDevice.java
+++ b/api/src/com/cloud/network/CiscoNexusVSMDevice.java
@@ -46,10 +46,6 @@ public interface CiscoNexusVSMDevice {
 
     public String getipaddr();
     
-    public String getvCenterIPAddr();
-    
-    public String getvCenterDCName();
-    
     public int getManagementVlan();
     
     public int getControlVlan();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java 
b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index c0a6ca3..db8ad87 100755
--- a/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -114,7 +114,7 @@ public class VmwareServerDiscoverer extends DiscovererBase 
implements Discoverer
         String guestTrafficLabel = null;
         Map<String, String> vsmCredentials = null;
         if (_vmwareMgr.getNexusVSwitchGlobalParameter()) {
-            if 
(_vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
+            if (_vmwareMgr.getPrivateVSwitchTypeGlobalParameter() != null && 
_vmwareMgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
                 // Get physical network label
                 privateTrafficLabel = 
_netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware);
                 if (privateTrafficLabel != null) {
@@ -125,7 +125,7 @@ public class VmwareServerDiscoverer extends DiscovererBase 
implements Discoverer
             DataCenterVO zone = _dcDao.findById(dcId);
             NetworkType zoneType = zone.getNetworkType();
 
-            if (zoneType != NetworkType.Basic && 
_vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
+            if (zoneType != NetworkType.Basic && 
_vmwareMgr.getPublicVSwitchTypeGlobalParameter() != null && 
_vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
                 // Get physical network label
                 publicTrafficLabel = 
_netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware);
                 if (publicTrafficLabel != null) {
@@ -136,7 +136,7 @@ public class VmwareServerDiscoverer extends DiscovererBase 
implements Discoverer
                 s_logger.info("Skipping detection of public traffic label as 
zone type is Basic.");
             }
 
-            if 
(_vmwareMgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
+            if (_vmwareMgr.getGuestVSwitchTypeGlobalParameter() != null && 
_vmwareMgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
                 // Get physical network label
                 guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, 
HypervisorType.VMware);
                 if (guestTrafficLabel != null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/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 2d7ef76..fec8a4a 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java
@@ -131,7 +131,7 @@ public abstract class CiscoNexusVSMDeviceManagerImpl 
extends AdapterBase {
 
        if (VSMObj == null) {                   
                // Create the VSM record. For now, we aren't using the vsmName 
field.
-               VSMObj = new CiscoNexusVSMDeviceVO(ipaddress, username, 
password, vCenterIpaddr, vCenterDcName);
+               VSMObj = new CiscoNexusVSMDeviceVO(ipaddress, username, 
password);
                Transaction txn = Transaction.currentTxn();
                try {
                                txn.start();

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java 
b/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
index b1f1954..6165ec1 100644
--- a/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
+++ b/server/src/com/cloud/network/CiscoNexusVSMDeviceVO.java
@@ -64,13 +64,6 @@ public class CiscoNexusVSMDeviceVO implements 
CiscoNexusVSMDevice, Identity{
     @Column(name = "ipaddr")
     private String ipaddr;
     
-    @Column(name = "vcenter_ipaddr")
-    private String vCenterIPAddr;
-    
-    // Name of the DataCenter (as seen in vCenter) that this VSM manages.
-    @Column(name = "vcenter_dc_name")
-    private String vCenterDCName;
-    
     @Column(name = "management_vlan")
     private int managementVlan;
 
@@ -120,14 +113,6 @@ public class CiscoNexusVSMDeviceVO implements 
CiscoNexusVSMDevice, Identity{
        return ipaddr;
     }
     
-    public String getvCenterIPAddr() {
-       return vCenterIPAddr;
-    }
-    
-    public String getvCenterDCName() {
-       return vCenterDCName;
-    }
-    
     public int getManagementVlan() {
        return managementVlan;
     }
@@ -186,14 +171,6 @@ public class CiscoNexusVSMDeviceVO implements 
CiscoNexusVSMDevice, Identity{
        this.ipaddr = ipaddr;
     }
     
-    public void setvCenterIPAddr(String ipaddr) {
-       this.vCenterIPAddr = ipaddr;
-    }
-    
-    public void setvCenterDCName(String dcname) {
-       this.vCenterDCName = dcname;
-    }
-    
     public void setManagementVlan(int vlan) {
        this.managementVlan = vlan;
     }
@@ -227,21 +204,9 @@ public class CiscoNexusVSMDeviceVO implements 
CiscoNexusVSMDevice, Identity{
     }
  
         
-    // Constructor methods.
-    
-    public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String 
password, String vCenterIpaddr, String vCenterDcName) {     
-       // Set all the VSM's properties here.
-        this.uuid = UUID.randomUUID().toString();
-        this.setMgmtIpAddr(vsmIpAddr);
-        this.setVsmUserName(username);
-        this.setVsmPassword(password);
-        this.setvCenterIPAddr(vCenterIpaddr);
-        this.setvCenterDCName(vCenterDcName);
-        // By default, enable a VSM.
-        this.setVsmDeviceState(VSMDeviceState.Enabled);
-    }
+    // Constructors.
     
-    public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String 
password, long dummy) {     
+    public CiscoNexusVSMDeviceVO(String vsmIpAddr, String username, String 
password) {         
        // Set all the VSM's properties here.
         this.uuid = UUID.randomUUID().toString();
         this.setMgmtIpAddr(vsmIpAddr);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/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 844d125..1156a26 100644
--- a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
+++ b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java
@@ -216,8 +216,6 @@ public class CiscoNexusVSMElement extends 
CiscoNexusVSMDeviceManagerImpl impleme
        response.setDeviceName(vsmDeviceVO.getvsmName());
        response.setDeviceState(vsmDeviceVO.getvsmDeviceState().toString());    
        
        response.setMgmtIpAddress(vsmDeviceVO.getipaddr());
-       response.setvCenterDcName(vsmDeviceVO.getvCenterDCName());      
-       response.setvCenterIpAddress(vsmDeviceVO.getvCenterIPAddr());
        // The following values can be null, so check for that.
        if(vsmDeviceVO.getvsmConfigMode() != null)
                
response.setVSMConfigMode(vsmDeviceVO.getvsmConfigMode().toString());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/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 77ca50a..478ae6f 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -420,8 +420,6 @@ 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;
@@ -435,7 +433,7 @@ public class ResourceManagerImpl implements 
ResourceManager, ResourceService, Ma
                        throw new CloudRuntimeException(msg);
                    }
                    // persist credentials to database
-                   CiscoNexusVSMDeviceVO vsm = new 
CiscoNexusVSMDeviceVO(vsmIp, vsmUser, vsmPassword, vCenterIpaddr, 
vCenterDcName);
+                   CiscoNexusVSMDeviceVO vsm = new 
CiscoNexusVSMDeviceVO(vsmIp, vsmUser, vsmPassword);
                    
                    Transaction txn = Transaction.currentTxn();
                    try {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql
index 51e4bf5..d7cd2d6 100755
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@ -2097,8 +2097,6 @@ CREATE TABLE `cloud`.`virtual_supervisor_module` (
   `username` varchar(255) NOT NULL,
   `password` varchar(255) NOT NULL,
   `ipaddr` varchar(80) NOT NULL,
-  `vcenter_ipaddr` varchar(80),
-  `vcenter_dc_name` varchar(255),
   `management_vlan` int(32),
   `control_vlan` int(32),
   `packet_vlan` int(32),

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a48a3bbf/setup/db/db/schema-302to303.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-302to303.sql b/setup/db/db/schema-302to303.sql
index 998d1c9..7573b94 100755
--- a/setup/db/db/schema-302to303.sql
+++ b/setup/db/db/schema-302to303.sql
@@ -145,8 +145,6 @@ CREATE TABLE `cloud`.`virtual_supervisor_module` (
   `username` varchar(255) NOT NULL,
   `password` varchar(255) NOT NULL,
   `ipaddr` varchar(80) NOT NULL,
-  `vcenter_ipaddr` varchar(80),
-  `vcenter_dc_name` varchar(255),
   `management_vlan` int(32),
   `control_vlan` int(32),
   `packet_vlan` int(32),

Reply via email to