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:05:00 UTC

[GitHub] [cloudstack] echoidcf opened a new issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   <!--
   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 networks
   
   ##### OS / ENVIRONMENT
   <!--
   Information about the environment if relevant, N/A otherwise
   -->
   
   
   ##### SUMMARY
   <!-- Explain the problem/feature briefly -->
   in this file
   /plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
   
   if (addVif) {
                       plugPublicNic(vmMo, vlanId, ip);
                       publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
                       if (publicNicInfo.first().intValue() >= 0) {
                           networkUsage(controlIp, "addVif", "eth" + publicNicInfo.first());
                       }
                   }
   Whenever a new public nic in VR is needed, plugPublicNic is called.
   and plugPublicNic get nic infos via vmware API and did not sort the result. (should be vmMo.getNicDevices(true))
   VirtualDevice[] nicDevices = vmMo.getNicDevices();
   
   You sort the nic devices in vmMo.getNicDeviceIndex(publicNeworkName); like below, why not in plugPublicNic()???
   List<VirtualDevice> nics = getNicDevices(true);
   
   In our environment, some VR devices looks like this (via vmware mob browser), which should not be a problem.
   But cloudstack will attach the the new network to the 4th virtualethernetcard device which is 4002, and cut down everything in public network.
    
   NAME	TYPE	VALUE
   device	VirtualDevice[]	
   device[200]	VirtualIDEController
   device[201]	VirtualIDEController
   device[300]	VirtualPS2Controller
   device[100]	VirtualPCIController
   device[400]	VirtualSIOController
   device[600]	VirtualKeyboard
   device[700]	VirtualPointingDevice
   device[500]	VirtualMachineVideoCard
   device[12000]	VirtualMachineVMCIDevice
   device[1000]	VirtualLsiLogicController
   device[3000]	VirtualCdrom
   device[4006]	VirtualVmxnet3
   device[4005]	VirtualVmxnet3
   device[4003]	VirtualVmxnet3
   device[4002]	VirtualVmxnet3
   device[4000]	VirtualVmxnet3
   device[2000]	VirtualDisk
   device[4001]	VirtualVmxnet3
   device[4004]	VirtualVmxnet3
   
   ##### 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 -->
   ~~~
   We do not have exactly way to make esxi/vcenter return result like this.
   Maybe a upgrade and restart the vcenter.
   ~~~
   
   <!-- You can also paste gist.github.com links for larger files -->
   
   ##### EXPECTED RESULTS
   <!-- What did you expect to happen when running the steps above? -->
   
   ~~~
   4003 SHOULD be connected to 2nd public network
   ~~~
   
   ##### ACTUAL RESULTS
   <!-- What actually happened? -->
   
   <!-- Paste verbatim command output between quotes below -->
   ~~~
   2nd is connected to 4002 and original 4002 configuration is overwrited.
   ~~~
   


----------------------------------------------------------------
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] Spaceman1984 commented on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @rhtyd, I'm on this one


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   Thanks @echoidcf 
   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



[GitHub] [cloudstack] rhtyd commented on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   I did static code analysis and see no harm in including the change as long as regression tests pass. I'll raise a PR


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @Spaceman1984 please liase with @Pearl1594 as to who may be picking this up, thanks.


----------------------------------------------------------------
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] Spaceman1984 commented on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @echoidcf These are the steps I took to try to reproduce this error and was unsuccessful:
   
   * Place a breakpoint in code on the first line inside plugPublicNic() method.
   * Deploy a vmware zone.
   * Wait for the system VMs to come up, connect and the built-in template to download and install.
   * Deploy a new instance using the built-in template.
   * Wait for the instance to get deployed.
   
   * Create a new account with admin privileges.
   * Create a new public ip range and assign to newly created account.
   * Log out and log in with new user.
   * Deploy an instance.
   * Wait for the instance to get deployed.
   
   In this process the plugPublicNic() method was never called because addVif was always false at the point when the new instance was deployed.
   
   Please post steps how to reproduce.


----------------------------------------------------------------
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] Spaceman1984 commented on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @rhtyd I'll take a look


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @echoidcf can you share details on which specific version of CloudStack you're using?


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   Cloudstack 4.7 (but all version should be affected)
   Vmware/vcenter 6.5
   
   The problem is we don't know the exact procedure to make VCenter change the device order like I showed. Maybe a upgrade or   a restart or a failover or something like that. But it do happened (in our production environment about 8k VRs looks like this ).
   And cloudstack can simply use 
   ~~~
   VirtualDevice[] nicDevices = vmMo.getNicDevices(true);
   ~~~
   to prevent the problem without side effects.


----------------------------------------------------------------
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] Spaceman1984 edited a comment on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

Posted by GitBox <gi...@apache.org>.
Spaceman1984 edited a comment on issue #4246:
URL: https://github.com/apache/cloudstack/issues/4246#issuecomment-677192035


   @echoidcf These are the steps I took to try to reproduce this error and was unsuccessful:
   
   * Place a breakpoint in code on the first line inside plugPublicNic() method.
   * Deploy a vmware zone.
   * Wait for the system VMs to come up, connect and the built-in template to download and install.
   * Deploy a new instance using the built-in template.
   * Wait for the instance to get deployed.
   
   * Create a new account with admin privileges.
   * Create a new public ip range and assign to newly created account.
   * Log out and log in with new user.
   * Deploy an instance.
   * Wait for the instance to get deployed.
   
   In this process the plugPublicNic() method was never called because addVif was always false at the point when the new instance was deployed.
   
   I have tested with version 4.14 and master branch.
   
   Please post steps how to reproduce.


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   I did static code analysis and see no harm in including the change as long as regression tests pass. I'll raise a PR


----------------------------------------------------------------
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 edited a comment on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

Posted by GitBox <gi...@apache.org>.
rhtyd edited a comment on issue #4246:
URL: https://github.com/apache/cloudstack/issues/4246#issuecomment-681855809


   @echoidcf can you share details on which specific version of CloudStack you're using? And the VMware/vcenter version?


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   > From the code it seems as if plugPublicNic() is called when there are no public networks on vsphere.
   
   When associate a new IP and this IP belongs to a new public network, 
   ~~~
   vmMo.getNicDeviceIndex(publicNeworkName);
   ~~~
   will return -1 and addVif is true, then plugPublicNic() is called.
   


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @Spaceman1984
   I think there is some misunderstanding here.
   How to call plugPublicNic() is not the concern here, and it is not the problem.
   The problem is something wrong happened AFTER the plugPublicNic is called, not how to call it.
   
   If you want to trigger plugPublicNic(), you may try process below
   1. add at least TWO public networks in cloudstack
   2. associate new IP to VR UNTIL it begin to use IP from second network. (small networks may help)
   and voila, plugPublicNic is called.
   
   The real problem is vcenter return [config.hardware.device] may not in original order as I showed above. To fix that, in plugPublicNic() you should use
   
   ~~~
   VirtualDevice[] nicDevices = vmMo.getNicDevices(true);
   ~~~
   instead of
   ~~~
   VirtualDevice[] nicDevices = vmMo.getNicDevices();
   ~~~


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   


----------------------------------------------------------------
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] Spaceman1984 edited a comment on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

Posted by GitBox <gi...@apache.org>.
Spaceman1984 edited a comment on issue #4246:
URL: https://github.com/apache/cloudstack/issues/4246#issuecomment-677192035


   @echoidcf These are the steps I took to try to reproduce this error and was unsuccessful:
   
   * Place a breakpoint in code on the first line inside plugPublicNic() method.
   * Deploy a vmware zone.
   * Wait for the system VMs to come up, connect and the built-in template to download and install.
   * Deploy a new instance using the built-in template.
   * Wait for the instance to get deployed.
   
   * Create a new account with admin privileges.
   * Create a new public ip range and assign to newly created account.
   * Log out and log in with new user.
   * Deploy an instance.
   * Wait for the instance to get deployed.
   
   In this process the plugPublicNic() method was never called because addVif was always false at the point when the new instance was deployed.
   
   I have tested with 4.14 and master branch.
   
   Please post steps how to reproduce.


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   cc @Pearl1594 can you review @Spaceman1984 's comment and create a PR


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   @echoidcf I formatted your description somewhat, but am not entirely clear on the issue yet. sounds seriour can you try to edit your description to be conclusive for anyone picking this up, please?


----------------------------------------------------------------
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] Spaceman1984 commented on issue #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   > But after something (maybe vcenter restart or esxi host upgrade or etc, we are not sure the exact trigger), it changed like
   
   @echoidcf I need to know how to get it into this state^^ (restarting the host didn't change the order).
   I have found the piece of code you mentioned inside prepareNetworkElementCommand() which is called when a VR is started.
   I'm not sure how to get plugPublicNic() called, is there a specific action you take to have addVif be set to true? 
   
   ```
   if (addVif) {
       plugPublicNic(vmMo, vlanId, ip);
       ...
   }
   ```
   
   From the code it seems as if plugPublicNic() is called when there are no public networks on vsphere.


----------------------------------------------------------------
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 #4246: plugPublicNic forgot to sort the nic devices before plug a new public network

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


   > @echoidcf I formatted your description somewhat, but am not entirely clear on the issue yet. sounds seriour can you try to edit your description to be conclusive for anyone picking this up, please?
   
   Thank you. I edit the post and add some image, should be better now.


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