mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8759 - Destroying VPC router results in a new unusable VPC routerHow to reproduce the problem: 1. Stop/Destroy the VPC router 2. Add a virtual machine to one of the VPC tier - it will trigger a VPC router creation 3. Router is created, but the NICs are not configured How to recover without this fix: 1. Stop/destroy the VPC router and restart the VPC Side effects: private gateways could be misconfigured. Root cause: In the VpcNetworkHelperImpl.configureDefaultNics() method, the guest network nic was added in the map prior to the control and public NICs. The order in the map should not matter, however in the LibvirtComputingResource.createVifs() method, there is a logic that relies on the device index - the array index - in order to create the control nic. I advise a refactor on the data model in order to be able to identify the NIC type instead of relying in the array index. An integration test was added to cover the fix: * test_vpc_router_nics.py Environment: Management Server running on CentOS 7.1 KVM host running on CentOS 7.1 CloudStack Agent/Common 4.6.0-SNAPSHOT Executing the test: ``` nosetests --with-marvin --marvin-config=/data/shared/marvin/mct-zone2-kvm2-ISOLATED.cfg -s -a tags=advanced,required_hardware=true component/test_vpc_router_nics.py ``` Remark: during the SSH there might be stack traces on the console due to the connection retry. It takes some time to get the PF rules in place and reach the VMs. So, just let the test run until the end. ``` Test results: Create a vpc with two networks with two vms in each network ... === TestName: test_01_VPC_nics_after_destroy | Status : SUCCESS === ok ---------------------------------------------------------------------- Ran 1 test in 774.020s OK /tmp//MarvinLogs/test_vpc_router_nics_VH6E9S/results.txt (END) ``` * pr/773: CLOUDSTACK-8759 - Fix guets nic allocation CLOUDSTACK-8759 - Adding a marvin test in order to cover the fix CLOUDSTACK-8759 - The guest nic has to be added after the control nic Signed-off-by: Remi Bergsma <github@remi.nl>