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/08/05 12:13:48 UTC

[GitHub] [cloudstack] echoidcf opened a new issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

echoidcf opened a new issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247


   <!--
   Verify first that your issue/request is not already reported on GitHub.
   Also test if the latest release and master branch are affected too.
   Always add information AFTER of these HTML comments, but no need to delete the comments.
   -->
   
   ##### ISSUE TYPE
   <!-- Pick one below and delete the rest -->
    * Bug Report
   
   ##### COMPONENT NAME
   <!--
   Categorize the issue, e.g. API, VR, VPN, UI, etc.
   -->
   ~~~
   VR
   ~~~
   
   ##### CLOUDSTACK VERSION
   <!--
   New line separated list of affected versions, commit ID for issues on master branch.
   -->
   
   ~~~
   All version is affected
   ~~~
   
   ##### CONFIGURATION
   <!--
   Information about the configuration if relevant, e.g. basic network, advanced networking, etc.  N/A otherwise
   -->
   multiple public network like
   vlan 11, vlan 110, vlan 1100
   vmware
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   in this file
   cloudstack/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
   
   <pre>
                   String publicNeworkName = HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId);
                   Pair<Integer, VirtualDevice> publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
   </pre>
   You generate a public network name with a vlanId, and use this name to locate the nic device index.
   The problem is getPublicNetworkNamePrefix works like this
   <pre>
       public static String getPublicNetworkNamePrefix(String vlanId) {
           if (UNTAGGED_VLAN_NAME.equalsIgnoreCase(vlanId)) {
               return "cloud.public.untagged";
           } else {
               return "cloud.public." + vlanId;
           }
       }
   </pre>
   And will return something like "cloud.public.11" if vlan id is 11
   getNicDeviceIndex only match the public network name with startWith which means this will match a network which vlan id is 111 or 110 or something like that.
   
   You should return something like "cloud.public.11." to be safe.
   
   ##### STEPS TO REPRODUCE
   <!--
   For bugs, show exactly how to reproduce the problem, using a minimal test-case. Use Screenshots if accurate.
   
   For new features, show how the feature would be used.
   -->
   
   <!-- Paste example playbooks or commands between quotes below -->
   ~~~
   create multiple public network with vlan 11,110,1101 etc.
   and associate ip to vr.
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   ~~~
   should be normal
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   HIGH chance to associate ip to WRONG nic
   ~~~
   


----------------------------------------------------------------
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] echoidcf commented on issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
echoidcf commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-671738308


   > @echoidcf a pull request, sending code contribution to this repository
   Sounds cool, but I don't know much about java. I can read, but coding is another thing ^^.


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
rhtyd commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-673405227


   PR merged https://github.com/apache/cloudstack/pull/4254 - the fix will be in 4.15


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-669162443


   sounds like you have figured the code @echoidcf . will you submit a PR for this?


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
rhtyd commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-670376234


   @echoidcf a pull request, sending code contribution to this repository


----------------------------------------------------------------
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] echoidcf commented on issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
echoidcf commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-670349352


   > PR
   What is a PR? Sorry, I am just newbie.


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
rhtyd closed issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247


   


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
rhtyd commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-671205777


   @Pearl1594 instead of the fix you've proposed can you fix the usage of `getNicDeviceIndex` to find exact or most matching portgroup instead of startswith(), i.e. the search should be exact instead of wildcard based which may pick a portgroup ending with 111 (VLAN ID 111) instead of 11 (VLAN ID 11).


----------------------------------------------------------------
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] Pearl1594 commented on issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
Pearl1594 commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-670379603


   @rhtyd I can look into it


----------------------------------------------------------------
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 issue #4247: getPublicNetworkNamePrefix return UNSAFE public network name

Posted by GitBox <gi...@apache.org>.
rhtyd commented on issue #4247:
URL: https://github.com/apache/cloudstack/issues/4247#issuecomment-670376828


   Ping @Spaceman1984 @DaanHoogland or @Pearl1594 @shwstppr - can you have a look at this, we already have example code?


----------------------------------------------------------------
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