mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Merge release branch 4.7 to master
* 4.7: CLOUDSTACK-9222 Prevent cloud.log.1 filling up the disk Add integration test for restartVPC with cleanup, and Private Gateway enabled. Nullpointer Exception in NicProfileHelperImpl
This commit is contained in:
commit
24818af23a
@ -63,6 +63,7 @@ public class NicProfileHelperImpl implements NicProfileHelper {
|
||||
@DB
|
||||
public NicProfile createPrivateNicProfileForGateway(final VpcGateway privateGateway, final VirtualRouter router) {
|
||||
final Network privateNetwork = _networkModel.getNetwork(privateGateway.getNetworkId());
|
||||
|
||||
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
|
||||
|
||||
final Long vpcId = privateGateway.getVpcId();
|
||||
@ -71,7 +72,11 @@ public class NicProfileHelperImpl implements NicProfileHelper {
|
||||
ipVO = _privateIpDao.findByIpAndVpcId(vpcId, privateGateway.getIp4Address());
|
||||
}
|
||||
|
||||
final Nic privateNic = _nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), privateNetwork.getId());
|
||||
Nic privateNic = null;
|
||||
|
||||
if (ipVO != null) {
|
||||
privateNic = _nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), privateNetwork.getId());
|
||||
}
|
||||
|
||||
NicProfile privateNicProfile = new NicProfile();
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
# CLOUDSTACK-9155: We cannot tell the processes that are writing to this
|
||||
# file to use the new inode, so instead we copy the original file, truncate
|
||||
# it and keep the same inode.
|
||||
|
||||
@ -253,7 +253,19 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
self.performVPCTests(vpc_off)
|
||||
|
||||
@attr(tags=["advanced"], required_hardware="true")
|
||||
def test_03_rvpc_privategw_static_routes(self):
|
||||
def test_03_vpc_privategw_restart_vpc_cleanup(self):
|
||||
self.logger.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"])
|
||||
|
||||
self.logger.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.performVPCTests(vpc_off, True)
|
||||
|
||||
@attr(tags=["advanced"], required_hardware="true")
|
||||
def test_04_rvpc_privategw_static_routes(self):
|
||||
self.logger.debug("Creating a Redundant VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
@ -264,7 +276,7 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
|
||||
self.performVPCTests(vpc_off)
|
||||
|
||||
def performVPCTests(self, vpc_off):
|
||||
def performVPCTests(self, vpc_off, restart_with_cleanup = False):
|
||||
self.logger.debug("Creating VPCs with offering ID %s" % vpc_off.id)
|
||||
vpc_1 = self.createVPC(vpc_off, cidr = '10.0.1.0/24')
|
||||
vpc_2 = self.createVPC(vpc_off, cidr = '10.0.2.0/24')
|
||||
@ -312,6 +324,13 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
self.check_pvt_gw_connectivity(vm1, public_ip_1, vm2.nic[0].ipaddress)
|
||||
self.check_pvt_gw_connectivity(vm2, public_ip_2, vm1.nic[0].ipaddress)
|
||||
|
||||
if restart_with_cleanup:
|
||||
self.reboot_vpc_with_cleanup(vpc_1, True)
|
||||
self.reboot_vpc_with_cleanup(vpc_2, True)
|
||||
|
||||
self.check_pvt_gw_connectivity(vm1, public_ip_1, vm2.nic[0].ipaddress)
|
||||
self.check_pvt_gw_connectivity(vm2, public_ip_2, vm1.nic[0].ipaddress)
|
||||
|
||||
def createVPC(self, vpc_offering, cidr = '10.1.1.1/16'):
|
||||
try:
|
||||
self.logger.debug("Creating a VPC network in the account: %s" % self.account.name)
|
||||
@ -539,3 +558,14 @@ class TestPrivateGwACL(cloudstackTestCase):
|
||||
1,
|
||||
"Ping to outside world from VM should be successful"
|
||||
)
|
||||
|
||||
def reboot_vpc_with_cleanup(self, vpc, cleanup = True):
|
||||
self.logger.debug("Restarting VPC %s with cleanup" % vpc.id)
|
||||
|
||||
# Reboot the router
|
||||
cmd = restartVPC.restartVPCCmd()
|
||||
cmd.id = vpc.id
|
||||
cmd.cleanup = cleanup
|
||||
cmd.makeredundant = False
|
||||
self.api_client.restartVPC(cmd)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user