Skip to content

Replace Hashtable with LinkedHashMap in createIsoResponse#7844

Merged
weizhouapache merged 3 commits into
apache:4.18from
leaseweb:isoorderfix
Aug 16, 2023
Merged

Replace Hashtable with LinkedHashMap in createIsoResponse#7844
weizhouapache merged 3 commits into
apache:4.18from
leaseweb:isoorderfix

Conversation

@CharlesQueiroz

Copy link
Copy Markdown
Contributor

Description

This change replaces Hashtable with LinkedHashMap in the createIsoResponse method of ViewResponseHelper.
This modification is to maintain the insertion order of entries, which isn't the case with Hashtable.

This solves the problem described here:

#7278

Related to the ordering of the ISOs table in CloudStack.
Currently, the order is not maintained because, when using a Hashtable, the insertion order gets lost when it tries to create the list on the API side.

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)

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

This change replaces the use of Hashtable with LinkedHashMap in the `createIsoResponse` method of `ViewResponseHelper`.
 The reason for this modification is to maintain the insertion order of entries, which isn't the case with Hashtable.
  This could lead to more predictable results and behaviors in calling methods.
@weizhouapache

weizhouapache commented Aug 10, 2023

Copy link
Copy Markdown
Member

thanks @CharlesQueiroz for the fix

Hashtable is used many times in same class. can you fix the others as well ?

@kiranchavala can you please verify it ?

@kiranchavala

Copy link
Copy Markdown
Member

@blueorangutan package

@kiranchavala kiranchavala self-assigned this Aug 10, 2023
@blueorangutan

Copy link
Copy Markdown

@kiranchavala a [SF] 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.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clgtm

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapache

Copy link
Copy Markdown
Member

thanks @CharlesQueiroz for the update
it looks there is still one in the class

Hashtable<Long, UserVmResponse> vmDataList = new Hashtable<Long, UserVmResponse>();

Changed Hashtable to LinkedHashMap in various response creation methods within ViewResponseHelper class.
This modification ensures an ordered iteration which is beneficial for scenarios where the insertion order of responses needs to be maintained consistently.
@codecov

codecov Bot commented Aug 10, 2023

Copy link
Copy Markdown

Codecov Report

Merging #7844 (6a14be0) into 4.18 (19aacad) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@             Coverage Diff              @@
##               4.18    #7844      +/-   ##
============================================
- Coverage     13.02%   13.02%   -0.01%     
+ Complexity     9040     9039       -1     
============================================
  Files          2720     2720              
  Lines        257094   257094              
  Branches      40092    40092              
============================================
- Hits          33491    33489       -2     
- Misses       219398   219401       +3     
+ Partials       4205     4204       -1     
Files Changed Coverage Δ
...n/java/com/cloud/api/query/ViewResponseHelper.java 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SF] 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
Copy Markdown

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

@kiranchavala kiranchavala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM , Tested manually, the order of the ISO is maintained, able to move to the top/bottom and move one row up/down

@weizhouapache weizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test rocky8 kvm-rocky8

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SF] Trillian-Jenkins test job (rocky8 mgmt + kvm-rocky8) has been kicked to run smoke tests

@yadvr yadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, didn't test it myself but changes and description makes sense.
I'm not sure if manual testing is needed, but any integration/marvin test would be great. Also I'm not sure of any consequences/side effects of this.

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7374)
Environment: kvm-rocky8 (x2), Advanced Networking with Mgmt server r8
Total time taken: 53134 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7374-kvm-rocky8.zip
Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_list_vms_metrics_admin Error 3607.97 test_metrics_api.py
test_list_vms_metrics_history Error 4.57 test_metrics_api.py
test_list_volumes_metrics_history Error 5.50 test_metrics_api.py
test_01_deploy_vm_on_specific_host Error 4.39 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 4.36 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 4.41 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 4.43 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 4.42 test_vm_deployment_planner.py

@DaanHoogland

Copy link
Copy Markdown
Contributor

@blueorangutan test matrix

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SF] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7391)
Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41247 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7391-xenserver-71.zip
Smoke tests completed. 106 look OK, 2 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
ContextSuite context=TestUnmanageVM>:setup Error 0.00 test_vm_lifecycle_unmanage_import.py
ContextSuite context=TestChangeServiceOfferingForVmWithSnapshots>:setup Error 0.00 test_vm_snapshots.py

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7393)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 46159 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7393-kvm-centos7.zip
Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_migrate_VM_and_root_volume Error 79.81 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 51.43 test_vm_life_cycle.py

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7392)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
Total time taken: 57452 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7392-vmware-67u3.zip
Smoke tests completed. 105 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=TestVMWareStoragePolicies>:setup Error 0.00 test_storage_policy.py
test_01_deploy_vm_on_specific_host Error 13.66 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 3601.88 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 1.37 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 2.37 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 2.33 test_vm_deployment_planner.py
test_09_expunge_vm Failure 425.71 test_vm_life_cycle.py

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test matrix

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SF] Trillian-Jenkins matrix job (centos7 mgmt + xenserver71, rocky8 mgmt + vmware67u3, centos7 mgmt + kvmcentos7) has been kicked to run smoke tests

@github-actions

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7410)
Environment: xenserver-71 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43004 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7410-xenserver-71.zip
Smoke tests completed. 108 look OK, 0 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7412)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 45766 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7412-kvm-centos7.zip
Smoke tests completed. 107 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_migrate_VM_and_root_volume Error 79.70 test_vm_life_cycle.py
test_02_migrate_VM_with_two_data_disks Error 54.43 test_vm_life_cycle.py

@soreana

soreana commented Aug 15, 2023

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@soreana a [SF] 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
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-7411)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server r8
Total time taken: 66847 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7844-t7411-vmware-67u3.zip
Smoke tests completed. 104 look OK, 4 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_upgrade_kubernetes_cluster Failure 141.54 test_kubernetes_clusters.py
test_07_deploy_kubernetes_ha_cluster Failure 184.60 test_kubernetes_clusters.py
test_08_upgrade_kubernetes_ha_cluster Failure 0.07 test_kubernetes_clusters.py
test_09_delete_kubernetes_ha_cluster Failure 0.05 test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardown Error 526.93 test_kubernetes_clusters.py
test_01_deploy_vm_on_specific_host Error 15.68 test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster Error 3603.26 test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod Error 28.01 test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster Error 3602.64 test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod Error 1.32 test_vm_deployment_planner.py
test_09_expunge_vm Failure 424.68 test_vm_life_cycle.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Failure 145.55 test_vpc_redundant.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACL Error 145.56 test_vpc_redundant.py
test_02_redundant_VPC_default_routes Error 429.73 test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers Failure 343.97 test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers Error 343.99 test_vpc_redundant.py

@weizhouapache weizhouapache merged commit e8b4911 into apache:4.18 Aug 16, 2023
@boring-cyborg

boring-cyborg Bot commented Aug 16, 2023

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request!

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.

Unable to order the ISO/templates in the UI

7 participants