Passing correct gateway ip while creating vservice node and guest port profile in Nexus

This commit is contained in:
Koushik Das 2013-03-27 02:20:45 +05:30
parent 2c386c61ef
commit 48cbf34d3b
2 changed files with 10 additions and 7 deletions

View File

@ -1570,7 +1570,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
vmMo.getRunningHost(), vlanId, null, null, this._ops_timeout, true);
} else {
networkInfo = HypervisorHostHelper.prepareNetwork(this._publicTrafficInfo.getVirtualSwitchName(), "cloud.public",
vmMo.getRunningHost(), vlanId, null, null, this._ops_timeout, vSwitchType, _portsPerDvPortGroup, false);
vmMo.getRunningHost(), vlanId, null, null, this._ops_timeout, vSwitchType, _portsPerDvPortGroup, null, false);
}
int nicIndex = allocPublicNicIndex(vmMo);
@ -2517,7 +2517,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
}
else {
networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()),
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout, switchType, _portsPerDvPortGroup, configureVServiceInNexus);
nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout, switchType, _portsPerDvPortGroup, nicTo.getGateway(), configureVServiceInNexus);
}
return networkInfo;

View File

@ -163,7 +163,8 @@ public class HypervisorHostHelper {
}
public static void createPortProfile(VmwareContext context, String ethPortProfileName, String networkName,
Integer vlanId, Integer networkRateMbps, long peakBandwidth, long burstSize, boolean configureVServiceInNexus) throws Exception {
Integer vlanId, Integer networkRateMbps, long peakBandwidth, long burstSize,
String gateway, boolean configureVServiceInNexus) throws Exception {
Map<String, String> vsmCredentials = getValidatedVsmCredentials(context);
String vsmIp = vsmCredentials.get("vsmip");
String vsmUserName = vsmCredentials.get("vsmusername");
@ -233,14 +234,16 @@ public class HypervisorHostHelper {
s_logger.info("Adding port profile configured over untagged VLAN.");
netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, 0);
} else {
s_logger.info("Adding port profile configured over VLAN : " + vlanId.toString());
if (!configureVServiceInNexus) {
s_logger.info("Adding port profile configured over VLAN : " + vlanId.toString());
netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vlanId.intValue());
} else {
String tenant = "vlan-" + vlanId.intValue();
String vdc = "root/" + tenant + "/VDC-" + tenant;
String esp = "ESP-" + tenant;
netconfClient.addVServiceNode(vlanId.toString(), "10.1.1.1");
s_logger.info("Adding vservice node in Nexus VSM for VLAN : " + vlanId.toString());
netconfClient.addVServiceNode(vlanId.toString(), gateway);
s_logger.info("Adding port profile with vservice details configured over VLAN : " + vlanId.toString());
netconfClient.addPortProfile(networkName, PortProfileType.vethernet, BindingType.portbindingstatic, SwitchPortMode.access, vlanId.intValue(), vdc, esp);
}
}
@ -410,7 +413,7 @@ public class HypervisorHostHelper {
public static Pair<ManagedObjectReference, String> prepareNetwork(String physicalNetwork, String namePrefix,
HostMO hostMo, String vlanId, Integer networkRateMbps, Integer networkRateMulticastMbps, long timeOutMs,
VirtualSwitchType vSwitchType, int numPorts, boolean configureVServiceInNexus) throws Exception {
VirtualSwitchType vSwitchType, int numPorts, String gateway, boolean configureVServiceInNexus) throws Exception {
ManagedObjectReference morNetwork = null;
VmwareContext context = hostMo.getContext();
ManagedObjectReference dcMor = hostMo.getHyperHostDatacenter();
@ -524,7 +527,7 @@ public class HypervisorHostHelper {
if (!dataCenterMo.hasDvPortGroup(networkName)) {
s_logger.info("Port profile " + networkName + " not found.");
createPortProfile(context, physicalNetwork, networkName, vid, networkRateMbps, peakBandwidth, burstSize, configureVServiceInNexus);
createPortProfile(context, physicalNetwork, networkName, vid, networkRateMbps, peakBandwidth, burstSize, gateway, configureVServiceInNexus);
bWaitPortGroupReady = true;
} else {
s_logger.info("Port profile " + networkName + " found.");