mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CS-9919 Support for Nexus Swiches (Cisco Vswitches)
Avoid detection of public traffic label for basic zones. Check switch types along with global parameter for enabling a particular vmware vswitch types. Move credentials information into resource and load during resource configuration. Cleanup. Conflicts: server/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
This commit is contained in:
parent
c65199cd8c
commit
67bfe23d28
@ -61,8 +61,6 @@ public interface VmwareManager {
|
||||
boolean beginExclusiveOperation(int timeOutSeconds);
|
||||
void endExclusiveOperation();
|
||||
|
||||
Map<String, String> getNexusVSMCredentials(String hostGuid);
|
||||
|
||||
boolean getNexusVSwitchGlobalParameter();
|
||||
|
||||
Map<String, String> getNexusVSMCredentialsByClusterId(Long clusterId);
|
||||
|
||||
@ -4032,16 +4032,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
|
||||
VmwareHypervisorHost hostMo = this.getHyperHost(context);
|
||||
_hostName = hostMo.getHyperHostName();
|
||||
_privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
_publicNetworkVSwitchName = mgr.getPublicVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
_guestNetworkVSwitchName = mgr.getGuestVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
|
||||
Map<String, String> vsmCredentials;
|
||||
if (mgr.getNexusVSwitchGlobalParameter()) {
|
||||
vsmCredentials = mgr.getNexusVSMCredentials(_guid);
|
||||
vsmCredentials = mgr.getNexusVSMCredentialsByClusterId(Long.parseLong(_cluster));
|
||||
if (vsmCredentials != null) {
|
||||
s_logger.info("Stocking credentials while configuring resource.");
|
||||
context.registerStockObject("vsmcredentials", vsmCredentials);
|
||||
}
|
||||
if (mgr.getPrivateVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
|
||||
_privateNetworkVSwitchName = mgr.getPrivateVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
if (mgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
|
||||
_publicNetworkVSwitchName = mgr.getPublicVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
if (mgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus"))
|
||||
_guestNetworkVSwitchName = mgr.getGuestVSwitchName(Long.parseLong(_dcId), HypervisorType.VMware);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
@ -4175,19 +4179,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
||||
} catch (Exception e) {
|
||||
s_logger.error("Unable to connect to vSphere server: " + _vCenterAddress, e);
|
||||
throw new CloudRuntimeException("Unable to connect to vSphere server: " + _vCenterAddress);
|
||||
}
|
||||
if(_nexusVSwitch)
|
||||
{
|
||||
VmwareManager mgr = _serviceContext.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
|
||||
Map<String, String> nexusVSwitchCredentials = mgr.getNexusVSMCredentials(_guid);
|
||||
if(nexusVSwitchCredentials != null)
|
||||
{
|
||||
_serviceContext.registerStockObject("vsmcredentials", nexusVSwitchCredentials);
|
||||
//_serviceContext.registerStockObject("vsmip", nexusVSwitchCredentials.get("vsmip"));
|
||||
//_serviceContext.registerStockObject("vsmusername", nexusVSwitchCredentials.get("vsmusername"));
|
||||
//_serviceContext.registerStockObject("vsmpassword", nexusVSwitchCredentials.get("vsmpassword"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return _serviceContext;
|
||||
}
|
||||
|
||||
@ -871,23 +871,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DB
|
||||
public Map<String, String> getNexusVSMCredentials(String hostGuid) {
|
||||
s_logger.info("Reading credentials from DB.");
|
||||
HostVO host = _hostDao.findByGuid(hostGuid);
|
||||
Map<String, String> vsmCredentials = null;
|
||||
long clusterId;
|
||||
if (host != null) {
|
||||
clusterId = host.getClusterId();
|
||||
s_logger.info("cluster is : " + clusterId);
|
||||
vsmCredentials = getNexusVSMCredentialsByClusterId(clusterId);
|
||||
}
|
||||
else {
|
||||
s_logger.info("Found invalid host object for hostGuid : " + hostGuid);
|
||||
}
|
||||
return vsmCredentials;
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public boolean processAnswers(long agentId, long seq, Answer[] answers) {
|
||||
|
||||
@ -31,7 +31,10 @@ import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.exception.DiscoveredWithErrorException;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.host.HostVO;
|
||||
@ -73,6 +76,9 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
|
||||
@Inject VMTemplateDao _tmpltDao;
|
||||
@Inject ClusterDetailsDao _clusterDetailsDao;
|
||||
@Inject HostDao _hostDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
|
||||
@Inject ResourceManager _resourceMgr;
|
||||
|
||||
@Inject CiscoNexusVSMDeviceDao _nexusDao;
|
||||
@ -118,13 +124,21 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
|
||||
s_logger.info("Detected private network label : " + privateTrafficLabel);
|
||||
}
|
||||
}
|
||||
if (_vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
|
||||
|
||||
DataCenterVO zone = _dcDao.findById(dcId);
|
||||
NetworkType zoneType = zone.getNetworkType();
|
||||
|
||||
if (zoneType != NetworkType.Basic && _vmwareMgr.getPublicVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
|
||||
// Get physical network label
|
||||
publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(dcId, HypervisorType.VMware);
|
||||
if (publicTrafficLabel != null) {
|
||||
s_logger.info("Detected public network label : " + publicTrafficLabel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s_logger.info("Skipping detection of public traffic label as zone type is Basic.");
|
||||
}
|
||||
|
||||
if (_vmwareMgr.getGuestVSwitchTypeGlobalParameter().equalsIgnoreCase("nexus")) {
|
||||
// Get physical network label
|
||||
guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);
|
||||
|
||||
@ -6514,7 +6514,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" + ex.getMessage());
|
||||
s_logger.debug("Failed to retrieve the default label for public traffic." + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -6542,7 +6542,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Failed to retrive the default label for management traffic:" + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to:" + ex.getMessage());
|
||||
s_logger.debug("Failed to retrieve the default label for guest traffic." + "zone: " + dcId + " hypervisor: " + hypervisorType + " due to: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user