You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/06/12 05:03:19 UTC

[GitHub] [cloudstack] ustcweizhou opened a new pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

ustcweizhou opened a new pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902


   ## Description
   <!--- Describe your changes in detail -->
   
   This PR aims to fix the issue below
   
   1. Create a network offering for isolated network, services: Dns/Dhcp/Userdata, and enable it
   2. create a isolated network with the new offering
   3. create a vm
   4. check the guest IP of virtual router, 
   5. restart network with cleanup
   6. check the guest IP of new virtual router
   7. The IP in step4 and step6 should be the same, but they are different actually.
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ## Screenshots (if appropriate):
   
   ## How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   
   tested with steps above, the IPs are same in step 7.
   change network to another offering with public ip, the placeholder ip is removed from database.
   
   tested with shared networks and L2 network as well.
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-673393497


   ping @ustcweizhou @weizhouapache 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-652896263


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-653723908


   @blueorangutan test
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643078557


   Packaging result: ✔centos7 ✔debian. JID-1357


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643538511


   @blueorangutan package
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643066680


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643539520


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-653784103


   <b>Trillian test result (tid-1968)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 36702 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr3902-t1968-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_supported_versions.py
   Smoke tests completed. 82 look OK, 1 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_add_delete_kubernetes_supported_version | `Error` | 1807.15 | test_kubernetes_supported_versions.py
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd merged pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643066463


   @blueorangutan package


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-652896492


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-682420455


   I'll merge this looks like we'll have to get the code refactored to smaller methods some other time.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd closed pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd closed pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd closed pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd closed pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] rhtyd commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-668395545


   @ustcweizhou can you address comments? Thnx


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-643550938


   Packaging result: ✖centos7 ✖debian. JID-1369


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] DaanHoogland commented on a change in pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on a change in pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#discussion_r461593221



##########
File path: server/src/main/java/com/cloud/network/guru/ExternalGuestNetworkGuru.java
##########
@@ -261,6 +265,17 @@ public NicProfile allocate(Network config, NicProfile nic, VirtualMachineProfile
             profile.setIPv4Netmask(null);
         }
 
+        if (config.getVpcId() == null && vm.getType() == VirtualMachine.Type.DomainRouter) {
+            boolean isPublicNetwork = _networkModel.isProviderSupportServiceInNetwork(config.getId(), Service.SourceNat, Provider.VirtualRouter);
+            if (!isPublicNetwork) {
+                Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(config, null);
+                if (placeholderNic == null) {
+                    s_logger.debug("Saving placeholder nic with ip4 address " + profile.getIPv4Address() +
+                            " and ipv6 address " + profile.getIPv6Address() + " for the network " + config);
+                    _networkMgr.savePlaceholderNic(config, profile.getIPv4Address(), profile.getIPv6Address(), VirtualMachine.Type.DomainRouter);
+                }
+            }
+        }

Review comment:
       `allocateRegularVrNic(...)`

##########
File path: server/src/main/java/com/cloud/network/guru/GuestNetworkGuru.java
##########
@@ -372,15 +373,25 @@ public NicProfile allocate(final Network network, NicProfile nic, final VirtualM
 
                 if (isGateway) {
                     guestIp = network.getGateway();
-                } else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
-                    guestIp = _ipAddrMgr.acquireGuestIpAddressByPlacement(network, nic.getRequestedIPv4());
                 } else {
-                    guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4());
-                }
-
-                if (!isGateway && guestIp == null && network.getGuestType() != GuestType.L2 && !_networkModel.listNetworkOfferingServices(network.getNetworkOfferingId()).isEmpty()) {
-                    throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,
-                            dc.getId());
+                    if (network.getGuestType() != GuestType.L2 && vm.getType() == VirtualMachine.Type.DomainRouter) {
+                        Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, null);
+                        if (placeholderNic != null) {
+                            s_logger.debug("Nic got an ip address " + placeholderNic.getIPv4Address() + " stored in placeholder nic for the network " + network);
+                            guestIp = placeholderNic.getIPv4Address();
+                        }
+                    }
+                    if (guestIp == null) {
+                        if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
+                            guestIp = _ipAddrMgr.acquireGuestIpAddressByPlacement(network, nic.getRequestedIPv4());
+                        } else {
+                            guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4());
+                        }
+                    }
+                    if (guestIp == null && network.getGuestType() != GuestType.L2 && !_networkModel.listNetworkOfferingServices(network.getNetworkOfferingId()).isEmpty()) {
+                        throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,
+                                dc.getId());
+                    }

Review comment:
       `allocateRegularVrNic(...)`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-652925631


   Packaging result: ✔centos7 ✔debian. JID-1507


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [cloudstack] blueorangutan commented on pull request #3902: vrouter: Save PlaceHolder nic for VR if network does not have source nat

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #3902:
URL: https://github.com/apache/cloudstack/pull/3902#issuecomment-653723949


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org