Skip to content

npe guard for get host info on vmware #11054

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

Draft
wants to merge 4 commits into
base: 4.19
Choose a base branch
from

Conversation

DaanHoogland
Copy link
Contributor

Description

This PR

Fixes: #10930

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?

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

Copy link

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

@DaanHoogland DaanHoogland changed the base branch from main to 4.19 June 18, 2025 17:35
if (aboutInfo == null) {
String msg = "no type info about host known"
s_logger.error(msg)
throw new Exception(msg);
Copy link
Member

Choose a reason for hiding this comment

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

can it be defaulted to VmwareHostType.ESXi ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what does it mean if the host does not have this info? Is it in a valid state then?

Copy link
Member

Choose a reason for hiding this comment

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

I never face this issue before, but I know some users have faced the issue.

If we throw an Exception with message, instead of NPE, I think it does not help, as user will still get an exception.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, but at least it will be clear they have an ill-configured host.

Copy link
Member

Choose a reason for hiding this comment

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

to be honest, I do not know what is misconfigured and any other issues caused by the misconfiguration.
I think we could consider the host as an ESXi host if the about info is not found.

anyone uses ESX host or other type of host ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, if y’all insist ;)

Copy link
Member

Choose a reason for hiding this comment

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

let's get more opinions

@nvazquez @harikrishna-patnala @sureshanaparti @shwstppr @rohityadavcloud
what's your opinion on it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what I meant @weizhouapache , is your argument makes sense, I yield. Please see my changed code fragment at #11054 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed, assuming ESXi seems to be a good option.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense

Copy link

codecov bot commented Jun 19, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 15.17%. Comparing base (cbd2b5a) to head (0524523).

Files with missing lines Patch % Lines
...in/java/com/cloud/hypervisor/vmware/mo/HostMO.java 20.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19   #11054      +/-   ##
============================================
- Coverage     15.17%   15.17%   -0.01%     
+ Complexity    11363    11357       -6     
============================================
  Files          5416     5416              
  Lines        475911   475915       +4     
  Branches      58096    58097       +1     
============================================
- Hits          72241    72229      -12     
- Misses       395584   395602      +18     
+ Partials       8086     8084       -2     
Flag Coverage Δ
uitests 4.28% <ø> (ø)
unittests 15.90% <20.00%> (-0.01%) ⬇️

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.

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

code LGTM

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.

code lgtm

thanks @DaanHoogland for the update

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

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

LGTM - haven't faced this issue before but it I think it makes sense to assume ESXi host type

@apache apache deleted a comment from blueorangutan Jun 23, 2025
@apache apache deleted a comment from blueorangutan Jun 23, 2025
@apache apache deleted a comment from blueorangutan Jun 23, 2025
@apache apache deleted a comment from blueorangutan Jun 23, 2025
@blueorangutan
Copy link

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

@apache apache deleted a comment from blueorangutan Jul 2, 2025
@DaanHoogland
Copy link
Contributor Author

@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 test result (tid-13662)
Environment: vmware-80u3 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 354160 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11054-t13662-vmware-80u3.zip
Smoke tests completed. 101 look OK, 32 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_CRUD_operations_guest_OS Error 0.06 test_guest_os.py
test_CRUD_operations_guest_OS_mapping Error 0.06 test_guest_os.py
test_guest_OS_mapping_check_with_hypervisor Error 0.06 test_guest_os.py
ContextSuite context=TestClusterDRS>:setup Error 0.00 test_cluster_drs.py
test_01_invalid_upgrade_kubernetes_cluster Failure 3667.91 test_kubernetes_clusters.py
test_02_upgrade_kubernetes_cluster Failure 3677.09 test_kubernetes_clusters.py
test_03_deploy_and_scale_kubernetes_cluster Failure 3679.87 test_kubernetes_clusters.py
test_04_autoscale_kubernetes_cluster Failure 3659.90 test_kubernetes_clusters.py
test_05_basic_lifecycle_kubernetes_cluster Failure 3672.11 test_kubernetes_clusters.py
test_06_delete_kubernetes_cluster Failure 3673.20 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 3758.49 test_kubernetes_clusters.py
test_10_vpc_tier_kubernetes_cluster Failure 4794.24 test_kubernetes_clusters.py
test_01_add_primary_storage_disabled_host Error 0.29 test_primary_storage.py
test_03_migration_options_storage_tags Error 0.03 test_primary_storage.py
test_01_vpc_privategw_acl Failure 1014.09 test_privategw_acl.py
test_02_vpc_privategw_static_routes Failure 1001.41 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 1002.14 test_privategw_acl.py
test_04_rvpc_privategw_static_routes Failure 1006.04 test_privategw_acl.py
test_09_project_suspend Error 1147.44 test_projects.py
test_deploy_vm_with_registered_userdata Error 1156.54 test_register_userdata.py
test_deploy_vm_with_registered_userdata Error 1156.60 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_append Error 1107.81 test_register_userdata.py
test_deploy_vm_with_registered_userdata_with_override_policy_append Error 1107.87 test_register_userdata.py
ContextSuite context=TestResetVmOnReboot>:setup Error 0.00 test_reset_vm_on_reboot.py
test_01_so_removal_resource_update Error 1137.68 test_resource_accounting.py
test_01_restore_vm Error 1150.29 test_restore_vm.py
test_02_restore_vm_allocated_root Error 65.45 test_restore_vm.py
ContextSuite context=TestRestoreVM>:teardown Error 78.99 test_restore_vm.py
ContextSuite context=TestRouterDHCPHosts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestRouterDHCPOpts>:setup Error 0.00 test_router_dhcphosts.py
ContextSuite context=TestRouterDns>:setup Error 0.00 test_router_dns.py
ContextSuite context=TestRouterDnsService>:setup Error 0.00 test_router_dnsservice.py
test_02_routervm_iptables_policies Error 1135.63 test_routers_iptables_default_policy.py
test_01_single_VPC_iptables_policies Error 1001.55 test_routers_iptables_default_policy.py
test_02_isolate_network_FW_PF_default_routes_egress_false Error 1096.13 test_routers_network_ops.py
test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true Error 1000.13 test_routers_network_ops.py
test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Error 1013.99 test_routers_network_ops.py
test_03_RVR_Network_check_router_state Error 1012.02 test_routers_network_ops.py
ContextSuite context=TestRouterServices>:setup Error 0.00 test_routers.py
ContextSuite context=TestServiceOfferings>:setup Error 1134.77 test_service_offerings.py
test_03_create_vpc_with_specified_source_nat_ip_address Error 1018.54 test_set_sourcenat.py
test_04_change_source_nat_ip_address_for_vpc Error 998.44 test_set_sourcenat.py
ContextSuite context=TestSnapshotRootDisk>:setup Error 0.00 test_snapshots.py
ContextSuite context=TestSnapshotStandaloneBackup>:setup Error 0.00 test_snapshots.py
test_02_list_cpvm_vm Failure 0.05 test_ssvm.py
test_04_cpvm_internals Failure 0.05 test_ssvm.py
test_06_stop_cpvm Failure 0.06 test_ssvm.py
test_11_destroy_ssvm Failure 924.48 test_ssvm.py
test_12_destroy_cpvm Failure 923.42 test_ssvm.py
test_01_import_storage_policies Error 39.46 test_storage_policy.py
ContextSuite context=TestVMWareStoragePolicies>:teardown Error 39.49 test_storage_policy.py
ContextSuite context=TestPublicIPUsage>:setup Error 1189.87 test_usage.py
ContextSuite context=TestSnapshotUsage>:setup Error 2377.22 test_usage.py
test_01_volume_usage Error 108.04 test_usage.py
test_01_scale_up_verify Failure 576.80 test_vm_autoscaling.py
test_02_update_vmprofile_and_vmgroup Error 2.30 test_vm_autoscaling.py
test_03_scale_down_verify Error 1.11 test_vm_autoscaling.py
test_04_stop_remove_vm_in_vmgroup Error 2.31 test_vm_autoscaling.py
test_06_autoscaling_vmgroup_on_project_network Failure 587.28 test_vm_autoscaling.py
test_06_autoscaling_vmgroup_on_project_network Error 587.29 test_vm_autoscaling.py
test_07_autoscaling_vmgroup_on_vpc_network Error 1012.64 test_vm_autoscaling.py
ContextSuite context=TestVmAutoScaling>:teardown Error 1026.88 test_vm_autoscaling.py
test_01_deploy_vm_on_specific_host Error 0.11 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 996.19 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 0.14 test_vm_deployment_planner.py
test_01_offline_migrate_VM_and_root_volume Error 1200.88 test_vm_life_cycle.py
test_02_offline_migrate_VM_with_two_data_disks Error 98.11 test_vm_life_cycle.py
test_03_live_migrate_VM_with_two_data_disks Error 106.29 test_vm_life_cycle.py
test_08_migrate_vm Error 0.07 test_vm_life_cycle.py
test_01_unmanage_vm_cycle Error 1015.46 test_vm_lifecycle_unmanage_import.py
ContextSuite context=TestUnmanageVM>:teardown Error 1015.49 test_vm_lifecycle_unmanage_import.py
test_04_deploy_vnf_appliance Error 1277.54 test_vnf_templates.py
test_04_deploy_vnf_appliance Error 1277.60 test_vnf_templates.py
test_05_delete_vnf_template Error 1.11 test_vnf_templates.py
ContextSuite context=TestVnfTemplates>:teardown Error 2.26 test_vnf_templates.py
ContextSuite context=TestCreateVolume>:setup Error 0.00 test_volumes.py
ContextSuite context=TestVolumes>:setup Error 1164.56 test_volumes.py
test_01_verify_ipv6_vpc Error 1015.18 test_vpc_ipv6.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Error 1003.55 test_vpc_redundant.py
test_02_redundant_VPC_default_routes Error 1005.26 test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers Error 1003.24 test_vpc_redundant.py
test_04_rvpc_network_garbage_collector_nics Error 1023.58 test_vpc_redundant.py
test_05_rvpc_multi_tiers Error 1004.10 test_vpc_redundant.py
test_01_VPC_nics_after_destroy Error 1001.26 test_vpc_router_nics.py
test_02_VPC_default_routes Error 998.59 test_vpc_router_nics.py
test_01_redundant_vpc_site2site_vpn Failure 1001.89 test_vpc_vpn.py
test_01_vpc_site2site_vpn_multiple_options Failure 998.45 test_vpc_vpn.py
test_01_vpc_remote_access_vpn Failure 1012.57 test_vpc_vpn.py
test_01_vpc_site2site_vpn Failure 1000.26 test_vpc_vpn.py

@blueorangutan
Copy link

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

Test Result Time (s) Test File
ContextSuite context=TestClusterDRS>:setup Error 0.00 test_cluster_drs.py
test_oobm_issue_power_cycle Error 1.29 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_off Error 1.27 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_on Error 1.27 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_reset Error 2.29 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_soft Error 1.27 test_outofbandmanagement_nestedplugin.py
test_oobm_issue_power_status Error 1.29 test_outofbandmanagement_nestedplugin.py
test_02_list_cpvm_vm Failure 0.05 test_ssvm.py
test_04_cpvm_internals Failure 0.06 test_ssvm.py
test_12_destroy_cpvm Error 6.35 test_ssvm.py

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@sureshanaparti sureshanaparti added this to the 4.19.4 milestone Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE when migrating VM in VMware and host not having 'config.product' property
6 participants