mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
44b88e093f
commit
a48a3bbfbd
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,10 +46,6 @@ public interface CiscoNexusVSMDevice {
|
|||
|
||||
public String getipaddr();
|
||||
|
||||
public String getvCenterIPAddr();
|
||||
|
||||
public String getvCenterDCName();
|
||||
|
||||
public int getManagementVlan();
|
||||
|
||||
public int getControlVlan();
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
// Constructors.
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue