Skip to content

Commit 52b02de

Browse files
DaanHooglandrohityadavcloud
authored andcommitted
vpc: reuse private gateway ip for non redundant VPC (apache#2712)
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. In crease ping counts to reduce intermittent failures in smoketests. Signed-off-by: Rohit Yadav <[email protected]>
1 parent f02e402 commit 52b02de

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

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

+5-3
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;

test/integration/smoke/test_privategw_acl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def check_pvt_gw_connectivity(self, virtual_machine, public_ip, vms_ips):
720720
succeeded_pings = 0
721721
minimum_vms_to_pass = 2
722722
for vm_ip in vms_ips:
723-
ssh_command = "ping -c 5 %s" % vm_ip
723+
ssh_command = "ping -c 10 %s" % vm_ip
724724

725725
# Should be able to SSH VM
726726
packet_loss = 100

test/integration/smoke/test_vpc_redundant.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def do_vpc_test(self, expectFail):
692692
def do_default_routes_test(self):
693693
for o in self.networks:
694694
for vmObj in o.get_vms():
695-
ssh_command = "ping -c 3 8.8.8.8"
695+
ssh_command = "ping -c 10 8.8.8.8"
696696

697697
# Should be able to SSH VM
698698
packet_loss = 100

test/integration/smoke/test_vpc_router_nics.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def check_ssh_into_vm(self):
451451
def do_default_routes_test(self):
452452
for o in self.networks:
453453
for vmObj in o.get_vms():
454-
ssh_command = "ping -c 5 8.8.8.8"
454+
ssh_command = "ping -c 10 8.8.8.8"
455455

456456
# Should be able to SSH VM
457457
packet_loss = 100

0 commit comments

Comments
 (0)