Skip to content

Conversation

@nvazquez
Copy link
Contributor

@nvazquez nvazquez commented Jan 20, 2026

Description

This PR allows filtering hosts and management servers by version through their listing APIs

(localcloud) 🐱 > list hosts version=4.20.3.0-SNAPSHOT filter=id,name,state,version type=routing
{
  "count": 2,
  "host": [
    {
      "id": "4a7b573c-8b7d-4da9-be86-20f4a4640c91",
      "name": "ref-trl-10590-k-Mr8-nicolas-vazquez-kvm1",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "24b4a589-8df5-453a-a882-a87fc6949356",
      "name": "ref-trl-10590-k-Mr8-nicolas-vazquez-kvm2",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

(localcloud) 🐱 > list managementservers version=4.20.3.0-SNAPSHOT filter=id,state,osdistribution,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "a44c9027-3909-441c-a792-b63d5799ac00",
      "osdistribution": "Rocky Linux 8.4 (Green Obsidian)",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

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?

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 16.24%. Comparing base (8db7cab) to head (fbc86b6).
⚠️ Report is 23 commits behind head on 4.20.

Files with missing lines Patch % Lines
...ain/java/com/cloud/api/query/QueryManagerImpl.java 0.00% 12 Missing ⚠️
...loudstack/api/command/admin/host/ListHostsCmd.java 0.00% 3 Missing ⚠️
...ack/api/command/admin/management/ListMgmtsCmd.java 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #12472   +/-   ##
=========================================
  Coverage     16.24%   16.24%           
- Complexity    13393    13398    +5     
=========================================
  Files          5657     5658    +1     
  Lines        499107   499204   +97     
  Branches      60574    60587   +13     
=========================================
+ Hits          81069    81100   +31     
- Misses       409001   409063   +62     
- Partials       9037     9041    +4     
Flag Coverage Δ
uitests 4.03% <ø> (-0.01%) ⬇️
unittests 17.10% <0.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

@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
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@sureshanaparti 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 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16451

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File

sc.addAnd("name", SearchCriteria.Op.EQ, name);
}
if (version != null) {
sc.addAnd("version", SearchCriteria.Op.EQ, version);
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we use "LIKE" for better usage like simply searching for 4.20.3 without "-snapshot".

Copy link
Contributor

Choose a reason for hiding this comment

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

also for searching 4.20 or 22.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@harikrishna-patnala @DaanHoogland I think passing the parameter must be an exact search to match the other parameters behaviour. However, this API supports the keyword parameter and uses LIKE for name, status and type - we can include version as well here

@RosiKyu RosiKyu self-assigned this Jan 22, 2026
Copy link
Collaborator

@RosiKyu RosiKyu left a comment

Choose a reason for hiding this comment

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

LGTM

Key Findings

  • Version filter is case-insensitive (TC7)
  • Partial versions don't match - uses EQ operator for exact match only (TC6, TC12)
  • Filter combines correctly with other parameters (TC3, TC4, TC10)
  • Backward compatible - APIs return all results when version parameter is omitted (TC5, TC11)

Note on review comments: As suggested by @harikrishna-patnala and @DaanHoogland, using LIKE instead of EQ would allow more flexible searches (e.g., version=4.20 to match all 4.20.x versions). Current implementation requires exact version string.

Test Case Summary

TC Description Path Result
TC1 listHosts - Filter by exact version API PASSED
TC2 listHosts - Filter by non-existent version API PASSED
TC3 listHosts - Combine version + state filter API PASSED
TC4 listHosts - Combine version + zoneid filter API PASSED
TC5 listHosts - No version parameter (baseline) API PASSED
TC6 listHosts - Partial version (EQ behavior) API PASSED
TC7 listHosts - Case sensitivity check API PASSED
TC8 listMgmtServers - Filter by exact version API PASSED
TC9 listMgmtServers - Filter by non-existent version API PASSED
TC10 listMgmtServers - Combine version + id filter API PASSED
TC11 listMgmtServers - No version parameter (baseline) API PASSED
TC12 listMgmtServers - Partial version (EQ behavior) API PASSED

Detailed Test Execution Results:

TC1: listHosts - Filter by exact version

Objective: Verify version filter returns hosts matching exact version string

Expected Result: Returns both KVM hosts (count: 2)

Actual Result:

(localcloud) 🐱 > list hosts version=4.20.3.0-SNAPSHOT type=routing filter=id,name,state,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC2: listHosts - Filter by non-existent version

Objective: Verify filter returns empty when version doesn't exist

Expected Result: Empty result

Actual Result:

(localcloud) 🐱 > list hosts version=9.99.99.0 type=routing filter=id,name,state,version
(no output - empty result)

TC3: listHosts - Combine version + state filter

Objective: Verify version filter works combined with state filter

Expected Result: Returns both KVM hosts

Actual Result:

(localcloud) 🐱 > list hosts version=4.20.3.0-SNAPSHOT state=Up type=routing filter=id,name,state,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC4: listHosts - Combine version + zoneid filter

Objective: Verify version filter works combined with zoneid filter

Expected Result: Returns both KVM hosts

Actual Result:

(localcloud) 🐱 > list hosts version=4.20.3.0-SNAPSHOT zoneid=de53c48f-9137-4de9-84aa-931ce6eb3999 type=routing filter=id,name,state,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC5: listHosts - No version parameter (baseline)

Objective: Verify existing behavior unchanged without version parameter

Expected Result: Returns both hosts

Actual Result:

(localcloud) 🐱 > list hosts type=routing filter=id,name,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC6: listHosts - Partial version (EQ behavior)

Objective: Verify partial version doesn't match (EQ operator)

Expected Result: Empty result

Actual Result:

(localcloud) 🐱 > list hosts version=4.20.3 type=routing filter=id,name,version
(no output - empty result)

TC7: listHosts - Case sensitivity check

Objective: Test if version filter is case-sensitive

Expected Result: Test behavior

Actual Result:

(localcloud) 🐱 > list hosts version=4.20.3.0-snapshot type=routing filter=id,name,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

Note: Filter is case-insensitive


TC8: listMgmtServers - Filter by exact version

Objective: Verify version filter returns management servers matching exact version

Expected Result: Returns 1 management server

Actual Result:

(localcloud) 🐱 > list managementservers version=4.20.3.0-SNAPSHOT filter=id,name,state,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "ae59e241-6c54-46de-9391-b75aebd1578c",
      "name": "ref-trl-10697-k-mol9-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC9: listMgmtServers - Filter by non-existent version

Objective: Verify filter returns empty when version doesn't exist

Expected Result: Empty result

Actual Result:

(localcloud) 🐱 > list managementservers version=9.99.99.0 filter=id,name,state,version
(no output - empty result)

TC10: listMgmtServers - Combine version + id filter

Objective: Verify version filter works combined with id filter

Expected Result: Returns the management server

Actual Result:

(localcloud) 🐱 > list managementservers version=4.20.3.0-SNAPSHOT id=ae59e241-6c54-46de-9391-b75aebd1578c filter=id,name,state,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "ae59e241-6c54-46de-9391-b75aebd1578c",
      "name": "ref-trl-10697-k-mol9-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC11: listMgmtServers - No version parameter (baseline)

Objective: Verify existing behavior unchanged without version parameter

Expected Result: Returns 1 management server

Actual Result:

(localcloud) 🐱 > list managementservers filter=id,name,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "ae59e241-6c54-46de-9391-b75aebd1578c",
      "name": "ref-trl-10697-k-mol9-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC12: listMgmtServers - Partial version (EQ behavior)

Objective: Verify partial version doesn't match (EQ operator)

Expected Result: Empty result

Actual Result:

(localcloud) 🐱 > list managementservers version=4.20 filter=id,name,version
(no output - empty result)

@apache apache deleted a comment from blueorangutan Jan 26, 2026
@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@nvazquez 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.

@nvazquez
Copy link
Contributor Author

Thanks for the reviews @harikrishna-patnala @DaanHoogland @RosiKyu - I have addressed the remaining review comment by adding the version as part of the keyword parameter search:

(localcloud) 🐱 > list hosts filter=id,name,state,version type=routing keyword=4.20
{
  "count": 2,
  "host": [
    {
      "id": "4a7b573c-8b7d-4da9-be86-20f4a4640c91",
      "name": "ref-trl-10590-k-Mr8-nicolas-vazquez-kvm1",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "24b4a589-8df5-453a-a882-a87fc6949356",
      "name": "ref-trl-10590-k-Mr8-nicolas-vazquez-kvm2",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}
(localcloud) 🐱 > list managementservers keyword=4.20 filter=id,state,osdistribution,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "a44c9027-3909-441c-a792-b63d5799ac00",
      "osdistribution": "Rocky Linux 8.4 (Green Obsidian)",
      "state": "Up",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

@blueorangutan
Copy link

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

@nvazquez
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

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

Copy link
Collaborator

@RosiKyu RosiKyu left a comment

Choose a reason for hiding this comment

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

LGTM

  • version parameter uses exact match (EQ operator) - TC6, TC12
  • keyword parameter now includes version in LIKE search - TC13, TC14, TC15, TC16
  • Version filter is case-insensitive (TC7)
  • Filter combines correctly with other parameters
  • Backward compatible - APIs return all results when version parameter is omitted

Review comment addressed: Users can now use keyword=4.20 to find all 4.20.x versions as suggested by @harikrishna-patnala and @DaanHoogland.

Additional Test Cases (after review comment addressed)

TC Description Path Result
TC13 listHosts - keyword with partial version (LIKE) API PASSED
TC14 listHosts - keyword with "SNAPSHOT" (LIKE) API PASSED
TC15 listMgmtServers - keyword with partial version (LIKE) API PASSED
TC16 listMgmtServers - keyword with "SNAPSHOT" (LIKE) API PASSED

Overall: 16/16 tests PASSED


TC13: listHosts - keyword with partial version (LIKE)

Objective: Verify keyword parameter searches version using LIKE

Expected Result: Returns hosts matching partial version

Actual Result:

(localcloud) 🐱 > list hosts keyword=4.20.3 type=routing filter=id,name,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC14: listHosts - keyword with "SNAPSHOT" (LIKE)

Objective: Verify keyword parameter matches version suffix

Expected Result: Returns hosts with SNAPSHOT in version

Actual Result:

(localcloud) 🐱 > list hosts keyword=SNAPSHOT type=routing filter=id,name,version
{
  "count": 2,
  "host": [
    {
      "id": "7e760736-6211-4fc7-9fec-e0203994d859",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm1",
      "version": "4.20.3.0-SNAPSHOT"
    },
    {
      "id": "f60b9127-0823-4049-90bc-7f0b1079aac7",
      "name": "ref-trl-10697-k-Mol9-rositsa-kyuchukova-kvm2",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC15: listMgmtServers - keyword with partial version (LIKE)

Objective: Verify keyword parameter searches version using LIKE

Expected Result: Returns mgmt servers matching partial version

Actual Result:

(localcloud) 🐱 > list managementservers keyword=4.20.3 filter=id,name,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "ae59e241-6c54-46de-9391-b75aebd1578c",
      "name": "ref-trl-10697-k-mol9-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

TC16: listMgmtServers - keyword with "SNAPSHOT" (LIKE)

Objective: Verify keyword parameter matches version suffix

Expected Result: Returns mgmt servers with SNAPSHOT in version

Actual Result:

(localcloud) 🐱 > list managementservers keyword=SNAPSHOT filter=id,name,version
{
  "count": 1,
  "managementserver": [
    {
      "id": "ae59e241-6c54-46de-9391-b75aebd1578c",
      "name": "ref-trl-10697-k-mol9-rositsa-kyuchukova-mgmt1.sofia.shapeblue.com",
      "version": "4.20.3.0-SNAPSHOT"
    }
  ]
}

@blueorangutan
Copy link

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

Test Result Time (s) Test File
all_test_vpc_redundant Skipped --- test_vpc_redundant.py
all_test_vpc_router_nics Skipped --- test_vpc_router_nics.py
all_test_vpc_vpn Skipped --- test_vpc_vpn.py
all_test_webhook_delivery Skipped --- test_webhook_delivery.py
all_test_webhook_lifecycle Skipped --- test_webhook_lifecycle.py
all_test_host_maintenance Skipped --- test_host_maintenance.py
all_test_hostha_kvm Skipped --- test_hostha_kvm.py

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.

thanks @nvazquez LGTM

@harikrishna-patnala harikrishna-patnala merged commit ff0cfc9 into apache:4.20 Jan 27, 2026
25 of 26 checks passed
@harikrishna-patnala harikrishna-patnala deleted the 420-hosts-mgmtservers-filter branch January 27, 2026 07:15
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.

6 participants