diff --git a/api/src/com/cloud/api/commands/AddClusterCmd.java b/api/src/com/cloud/api/commands/AddClusterCmd.java index 28b38abedad..c8f7eae7811 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; } diff --git a/client/tomcatconf/cisconexusvsm_commands.properties.in b/client/tomcatconf/cisconexusvsm_commands.properties.in index aba8e00a8d2..f6894600f09 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 diff --git a/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/server/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java index e09eee68e9d..64d8dc32f84 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"); } } diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElement.java b/server/src/com/cloud/network/element/CiscoNexusVSMElement.java index f0fc3622c05..5bcbb7b5846 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 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) { diff --git a/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java b/server/src/com/cloud/network/element/CiscoNexusVSMElementService.java index c1c5a07f950..1810c3e6ca6 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 diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 99008b06dcb..62653c016b3 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 {