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
This commit is contained in:
Vijayendra Bhamidipati 2012-05-16 19:46:10 -07:00
parent c5aba77927
commit 187d32057e
6 changed files with 19 additions and 40 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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");
}
}

View File

@ -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) {

View File

@ -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

View File

@ -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 {