Skip to content

Commit 8d45f5a

Browse files
author
Daan Hoogland
committed
reuse ip for non redundant VPC
As rolling restart does not deallocate an IP before configuring it on a new VR, the code must allow it to be reused on a non-redundant VPCs gateway nic.
1 parent 4afdee9 commit 8d45f5a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

server/src/com/cloud/network/router/NicProfileHelperImpl.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import javax.inject.Inject;
2323

24+
import com.cloud.utils.exception.CloudRuntimeException;
2425
import org.cloud.network.router.deployment.RouterDeploymentDefinition;
2526

2627
import com.cloud.network.IpAddressManager;
@@ -30,7 +31,6 @@
3031
import com.cloud.network.Networks.BroadcastDomainType;
3132
import com.cloud.network.vpc.PrivateIpAddress;
3233
import com.cloud.network.vpc.PrivateIpVO;
33-
import com.cloud.network.vpc.Vpc;
3434
import com.cloud.network.vpc.VpcGateway;
3535
import com.cloud.network.vpc.VpcManager;
3636
import com.cloud.network.vpc.dao.PrivateIpDao;
@@ -65,9 +65,11 @@ public NicProfile createPrivateNicProfileForGateway(final VpcGateway privateGate
6565
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
6666

6767
final Long vpcId = privateGateway.getVpcId();
68-
final Vpc activeVpc = _vpcMgr.getActiveVpc(vpcId);
69-
if (activeVpc.isRedundant() && ipVO == null) {
68+
if (ipVO == null) {
7069
ipVO = _privateIpDao.findByIpAndVpcId(vpcId, privateGateway.getIp4Address());
70+
if (ipVO == null) {
71+
throw new CloudRuntimeException("cannot find IP address " + privateGateway.getIp4Address() + " to reuse for private gateway on vpc (id==" + vpcId + ")");
72+
}
7173
}
7274

7375
Nic privateNic = null;

0 commit comments

Comments
 (0)