mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	vpc: reuse private gateway ip for non redundant VPC (#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 <rohit.yadav@shapeblue.com>
This commit is contained in:
		
							parent
							
								
									f02e402ebb
								
							
						
					
					
						commit
						52b02de43f
					
				@ -21,6 +21,7 @@ import java.net.URI;
 | 
			
		||||
 | 
			
		||||
import javax.inject.Inject;
 | 
			
		||||
 | 
			
		||||
import com.cloud.utils.exception.CloudRuntimeException;
 | 
			
		||||
import org.cloud.network.router.deployment.RouterDeploymentDefinition;
 | 
			
		||||
 | 
			
		||||
import com.cloud.network.IpAddressManager;
 | 
			
		||||
@ -30,7 +31,6 @@ import com.cloud.network.Networks.AddressFormat;
 | 
			
		||||
import com.cloud.network.Networks.BroadcastDomainType;
 | 
			
		||||
import com.cloud.network.vpc.PrivateIpAddress;
 | 
			
		||||
import com.cloud.network.vpc.PrivateIpVO;
 | 
			
		||||
import com.cloud.network.vpc.Vpc;
 | 
			
		||||
import com.cloud.network.vpc.VpcGateway;
 | 
			
		||||
import com.cloud.network.vpc.VpcManager;
 | 
			
		||||
import com.cloud.network.vpc.dao.PrivateIpDao;
 | 
			
		||||
@ -65,9 +65,11 @@ public class NicProfileHelperImpl implements NicProfileHelper {
 | 
			
		||||
        PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
 | 
			
		||||
 | 
			
		||||
        final Long vpcId = privateGateway.getVpcId();
 | 
			
		||||
        final Vpc activeVpc = _vpcMgr.getActiveVpc(vpcId);
 | 
			
		||||
        if (activeVpc.isRedundant() && ipVO == null) {
 | 
			
		||||
        if (ipVO == null) {
 | 
			
		||||
            ipVO = _privateIpDao.findByIpAndVpcId(vpcId, privateGateway.getIp4Address());
 | 
			
		||||
            if (ipVO == null) {
 | 
			
		||||
                throw new CloudRuntimeException("cannot find IP address " + privateGateway.getIp4Address() + " to reuse for private gateway on vpc (id==" + vpcId + ")");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        Nic privateNic = null;
 | 
			
		||||
 | 
			
		||||
@ -720,7 +720,7 @@ class TestPrivateGwACL(cloudstackTestCase):
 | 
			
		||||
        succeeded_pings = 0
 | 
			
		||||
        minimum_vms_to_pass = 2
 | 
			
		||||
        for vm_ip in vms_ips:
 | 
			
		||||
            ssh_command = "ping -c 5 %s" % vm_ip
 | 
			
		||||
            ssh_command = "ping -c 10 %s" % vm_ip
 | 
			
		||||
 | 
			
		||||
            # Should be able to SSH VM
 | 
			
		||||
            packet_loss = 100
 | 
			
		||||
 | 
			
		||||
@ -692,7 +692,7 @@ class TestVPCRedundancy(cloudstackTestCase):
 | 
			
		||||
    def do_default_routes_test(self):
 | 
			
		||||
        for o in self.networks:
 | 
			
		||||
            for vmObj in o.get_vms():
 | 
			
		||||
                ssh_command = "ping -c 3 8.8.8.8"
 | 
			
		||||
                ssh_command = "ping -c 10 8.8.8.8"
 | 
			
		||||
 | 
			
		||||
                # Should be able to SSH VM
 | 
			
		||||
                packet_loss = 100
 | 
			
		||||
 | 
			
		||||
@ -451,7 +451,7 @@ class TestVPCNics(cloudstackTestCase):
 | 
			
		||||
    def do_default_routes_test(self):
 | 
			
		||||
        for o in self.networks:
 | 
			
		||||
            for vmObj in o.get_vms():
 | 
			
		||||
                ssh_command = "ping -c 5 8.8.8.8"
 | 
			
		||||
                ssh_command = "ping -c 10 8.8.8.8"
 | 
			
		||||
 | 
			
		||||
                # Should be able to SSH VM
 | 
			
		||||
                packet_loss = 100
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user