mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
reserve first IP (after g/w) of subnet for router nic - NSX
This commit is contained in:
parent
58eb567b25
commit
be9e06f6af
@ -2044,6 +2044,9 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
if (requestedIp != null) {
|
||||
return this.acquireGuestIpAddress(network, requestedIp);
|
||||
}
|
||||
if ("NsxGuestNetworkGuru".equals(network.getGuruName())) {
|
||||
return getRouterIp(network.getGateway());
|
||||
}
|
||||
String placementConfig = VrouterRedundantTiersPlacement.valueIn(network.getAccountId());
|
||||
IpPlacement ipPlacement = IpPlacement.fromString(placementConfig);
|
||||
switch (ipPlacement) {
|
||||
@ -2055,6 +2058,13 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
|
||||
return this.acquireGuestIpAddress(network, null);
|
||||
}
|
||||
|
||||
private String getRouterIp(String gatewayIp) {
|
||||
int i = gatewayIp.lastIndexOf('.');
|
||||
String ipPart1 = gatewayIp.substring(0, i);
|
||||
int ipLastOctect = Integer.parseInt(gatewayIp.substring(i+1)) + 1;
|
||||
return ipPart1.concat("." + ipLastOctect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of public IPs that need to be applied for a static NAT enable/disable operation.
|
||||
* Manipulating only these ips prevents concurrency issues when disabling static nat at the same time.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user