Skip to content

VMware: match nic mac for ip address fetch #10641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 4.20
Choose a base branch
from

Conversation

alexandru-bagu
Copy link
Contributor

@alexandru-bagu alexandru-bagu commented Mar 29, 2025

Description

This PR fixes #10640

The main solution for the issue here would be to make sure that we are getting the IP for the correct NIC which we can do based on the MAC of the NIC. Additionally, a null IP is also a valid response because a NIC can have no IP assigned.

It's up for discussion whether we should pull any IP even if it does not match the network subnet because the user can in fact use the NIC with another subnet as well, but that is not necessarily relevant to this issue.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • 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)
  • build/CI
  • test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

I am in the process of testing on my dev environment then going to push in prod once I am happy with the results.

How did you try to break this feature and the system with this change?

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good

A related pr for l2 network #10431

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@@ -788,12 +793,6 @@ protected void runInContext() {
}
}
} else {
//previously vm has ip and nic table has ip address. After vm restart or stop/start
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, if we cannot know if the VM still has the IP assigned or not then we should not modify the database. In other words, we should be sure that the VM's NIC does not have an IP assigned before updating the database.

@alexandru-bagu
Copy link
Contributor Author

overall looks good

A related pr for l2 network #10431

Interesting. I see your PR has more changes than this PR. Feel free to grab my code for VMware and close this PR.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 12924

Copy link

codecov bot commented Mar 29, 2025

Codecov Report

Attention: Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.

Project coverage is 16.14%. Comparing base (0648d00) to head (5f0e76f).
Report is 19 commits behind head on 4.20.

Files with missing lines Patch % Lines
...oud/hypervisor/vmware/resource/VmwareResource.java 0.00% 10 Missing ⚠️
.../src/main/java/com/cloud/vm/UserVmManagerImpl.java 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              4.20   #10641       +/-   ##
============================================
+ Coverage     4.00%   16.14%   +12.13%     
- Complexity       0    13240    +13240     
============================================
  Files          400     5656     +5256     
  Lines        32555   497589   +465034     
  Branches      5770    60336    +54566     
============================================
+ Hits          1305    80311    +79006     
- Misses       31101   408328   +377227     
- Partials       149     8950     +8801     
Flag Coverage Δ
uitests 4.00% <ø> (-0.01%) ⬇️
unittests 16.99% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@weizhouapache weizhouapache linked an issue Mar 29, 2025 that may be closed by this pull request
@Pearl1594 Pearl1594 added this to the 4.21.0 milestone Apr 3, 2025
@weizhouapache weizhouapache self-assigned this Apr 10, 2025
@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@weizhouapache weizhouapache changed the title match nic mac for ip address fetch VMware: match nic mac for ip address fetch Apr 17, 2025
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13098

@weizhouapache weizhouapache changed the base branch from main to 4.20 April 25, 2025 06:27
@weizhouapache weizhouapache changed the base branch from 4.20 to main April 25, 2025 06:27
@weizhouapache
Copy link
Member

@alexandru-bagu
can you rebase with 4.20 branch so it will be included into 4.20.1.0 release ?

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
Copy link
Contributor

@alexandru-bagu , i fixed some conflict eagerly on you PR. I hope you’ll forgive someday soon. Please have a check?

@DaanHoogland
Copy link
Contributor

And when I say check, please also check if #10431 already suffices for you and close this one if so?

@alexandru-bagu
Copy link
Contributor Author

Daan, #10431 handles kvm. This PR properly handles IPs detected using vmtools for VMware. This bit should be merged either way.

What I leave up for discussion is the case where the GetVmIpAddressCommand returns false or true with a null ip. In my opinion, if the command returns false (as in there was an error) the IP should not be released - basically the code I wrote in server/src/main/java/com/cloud/vm/UserVmManagerImpl.java.

@DaanHoogland
Copy link
Contributor

Daan, #10431 handles kvm. This PR properly handles IPs detected using vmtools for VMware. This bit should be merged either way.

sorry, I did not read the code well enough :|

What I leave up for discussion is the case where the GetVmIpAddressCommand returns false or true with a null ip. In my opinion, if the command returns false (as in there was an error) the IP should not be released - basically the code I wrote in server/src/main/java/com/cloud/vm/UserVmManagerImpl.java.

@weizhouapache , Can you chime in? This is to be resolved before merging!
cc @Pearl1594 , I think this would be good to have if we resolve this question.

@weizhouapache
Copy link
Member

What I leave up for discussion is the case where the GetVmIpAddressCommand returns false or true with a null ip. In my opinion, if the command returns false (as in there was an error) the IP should not be released - basically the code I wrote in server/src/main/java/com/cloud/vm/UserVmManagerImpl.java.

@weizhouapache , Can you chime in? This is to be resolved before merging! cc @Pearl1594 , I think this would be good to have if we resolve this question.

@DaanHoogland
I agree with @alexandru-bagu
the new logic seems good to me

Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13364

@DaanHoogland
Copy link
Contributor

@blueorangutan test ol8 vmware-70u3

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + vmware-70u3) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-13289)
Environment: vmware-70u3 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 99146 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10641-t13289-vmware-70u3.zip
Smoke tests completed. 135 look OK, 6 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_08_upgrade_kubernetes_ha_cluster Failure 3684.32 test_kubernetes_clusters.py
test_list_vms_metrics_admin Error 8.32 test_metrics_api.py
test_list_vms_metrics_history Error 8.06 test_metrics_api.py
test_list_volumes_metrics_history Error 5.85 test_metrics_api.py
test_01_deployVMInSharedNetwork Failure 3.50 test_network.py
ContextSuite context=TestSharedNetworkWithConfigDrive>:teardown Error 4.59 test_network.py
test_01_restore_vm Error 3605.31 test_restore_vm.py
test_02_restore_vm_with_disk_offering Error 7.71 test_restore_vm.py
test_03_restore_vm_with_disk_offering_custom_size Error 4.48 test_restore_vm.py
test_04_restore_vm_allocated_root Error 3626.72 test_restore_vm.py
test_01_isolate_network_FW_PF_default_routes_egress_true Failure 163.03 test_routers_network_ops.py
test_02_restore_vm_strict_tags_failure Error 64.95 test_vm_strict_host_tags.py

@DaanHoogland
Copy link
Contributor

@blueorangutan test ol8 vmware-80u3

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + vmware-80u3) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-13309)

@alexandru-bagu
Copy link
Contributor Author

Reviewing the code I observed that the IP usage was still being decremented even though no action has been done due to an error being returned by the fetcher thread. In case of errors, since we don't actually do anything, we should not make any changes to the current state.

@weizhouapache
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment