Skip to content
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

Filter list VMs by IP address #9547

Merged
merged 5 commits into from
Oct 8, 2024
Merged

Filter list VMs by IP address #9547

merged 5 commits into from
Oct 8, 2024

Conversation

Pearl1594
Copy link
Contributor

Description

This PR fixes: #9486

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

List VMs without any filter:
image

Listing VMs with a specific IP:
image

Listing VMs with a part of an IP used as filter:
image

Listing VMs with an IP that doesn't match:
image

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

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

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

Project coverage is 15.24%. Comparing base (6e6a276) to head (b910bfe).
Report is 57 commits behind head on 4.19.

Files with missing lines Patch % Lines
...c/main/java/com/cloud/utils/db/GenericDaoBase.java 0.00% 22 Missing ⚠️
...ain/java/com/cloud/api/query/QueryManagerImpl.java 0.00% 13 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9547      +/-   ##
============================================
+ Coverage     15.08%   15.24%   +0.15%     
- Complexity    11184    11572     +388     
============================================
  Files          5406     5406              
  Lines        472889   489497   +16608     
  Branches      57738    66537    +8799     
============================================
+ Hits          71352    74641    +3289     
- Misses       393593   406562   +12969     
- Partials       7944     8294     +350     
Flag Coverage Δ
uitests 5.10% <ø> (+0.79%) ⬆️
unittests 15.90% <0.00%> (+0.10%) ⬆️

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.

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 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 10699

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@rohityadavcloud rohityadavcloud added this to the 4.19.2.0 milestone Sep 4, 2024
@DaanHoogland
Copy link
Contributor

@vishesh92 @Pearl1594 is this ready or does it need more work?

@Pearl1594
Copy link
Contributor Author

@DaanHoogland It works in the current state, but I wasn't able to address @vishesh92's comment, and am awaiting his response on it.

@Pearl1594 Pearl1594 marked this pull request as draft September 20, 2024 14:53
@vishesh92
Copy link
Member

Every search with keyword param will become too expensive. We will be doing a join of user_vm table with user_vm_view which isn't a good idea. Let me spend some time on this next week.

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 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 11240

@Pearl1594 Pearl1594 marked this pull request as ready for review September 30, 2024 12:01
@DaanHoogland
Copy link
Contributor

@blueorangutan test keepEnv

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@Pearl1594
Copy link
Contributor Author

@vishesh92 could you please help review the changes made to address the discussed issue in the searchBuilder. Thanks!

@vishesh92
Copy link
Member

Changes look good and it's working as expected. Just one case required to handle to prevent issues in future.

SQL query before

SELECT
    DISTINCT(user_vm.id)
FROM
    user_vm
    INNER JOIN vm_instance ON user_vm.id = vm_instance.id
    INNER JOIN account accountSearch ON vm_instance.account_id = accountSearch.id
    INNER JOIN vm_template vmTemplate ON vm_instance.vm_template_id = vmTemplate.id
WHERE
    vm_instance.type = 'User'
    AND vm_instance.display_vm = ?
    AND (
        user_vm.display_name LIKE ?
        OR vm_instance.name LIKE ?
        OR vm_instance.state = ?
        OR vm_instance.instance_name LIKE ?
    )
    AND vm_instance.removed IS NULL
    AND (accountSearch.type != ?)
    AND (vmTemplate.type != ?)
ORDER BY
    vm_instance.id ASC
LIMIT
    0, 20

after:

SELECT
    DISTINCT(user_vm.id)
FROM
    user_vm
    INNER JOIN vm_instance ON user_vm.id = vm_instance.id
    LEFT JOIN user_ip_address ipAddressSearch ON user_vm.id = ipAddressSearch.vm_id
    INNER JOIN vm_template vmTemplate ON vm_instance.vm_template_id = vmTemplate.id
    LEFT JOIN nics nicSearch ON user_vm.id = nicSearch.instance_id
    AND nicSearch.removed IS NULL
    INNER JOIN account accountSearch ON vm_instance.account_id = accountSearch.id
WHERE
    vm_instance.type = 'User'
    AND vm_instance.display_vm = ?
    AND (
        user_vm.display_name LIKE ?
        OR vm_instance.name LIKE ?
        OR vm_instance.state = ?
        OR vm_instance.instance_name LIKE ?
        OR ipAddressSearch.public_ip_address LIKE ?
        OR nicSearch.ip4_address LIKE ?
        OR nicSearch.ip4_address LIKE ?
    )
    AND vm_instance.removed IS NULL
    AND (vmTemplate.type != ?)
    AND (accountSearch.type != ?)
ORDER BY
    vm_instance.id ASC
LIMIT
    0, 20

@vishesh92
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

@vishesh92 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 11298

@Pearl1594
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@Pearl1594 a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

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

Test Result Time (s) Test File

Copy link
Member

@vishesh92 vishesh92 left a comment

Choose a reason for hiding this comment

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

clgtm. Tested locally with simulator and it's working as expected.

@DaanHoogland DaanHoogland merged commit 9c86c4d into 4.19 Oct 8, 2024
40 of 48 checks passed
@DaanHoogland DaanHoogland deleted the fix-filter-vms-ip branch October 8, 2024 16:05
weizhouapache pushed a commit that referenced this pull request Oct 15, 2024
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Oct 24, 2024
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.

5 participants