Thanks to visit codestin.com
Credit goes to github.com

Skip to content

server: fix available hypervisors listing for a zone #10738

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

Merged
merged 2 commits into from
Apr 24, 2025

Conversation

shwstppr
Copy link
Contributor

Description

In the absence of a SYSTEM type template for a zone, listing of templates can break.
Behaviour was change in #9840 but it would be better to find available hypervisors using existing hosts.

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?

In the absence of a SYSTEM type template for a zone, listing of
templates can break.
Behaviour was change in apache#9840 but it would be better to find available
hypervisors using existing hosts.
@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

Copy link

codecov bot commented Apr 16, 2025

Codecov Report

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

Project coverage is 16.02%. Comparing base (a09354d) to head (4c6aa55).
Report is 23 commits behind head on 4.20.

Files with missing lines Patch % Lines
...n/java/com/cloud/resource/ResourceManagerImpl.java 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               4.20   #10738   +/-   ##
=========================================
  Coverage     16.01%   16.02%           
  Complexity    13123    13123           
=========================================
  Files          5652     5652           
  Lines        495921   495921           
  Branches      60053    60053           
=========================================
+ Hits          79446    79451    +5     
+ Misses       407611   407607    -4     
+ Partials       8864     8863    -1     
Flag Coverage Δ
uitests 4.00% <ø> (ø)
unittests 16.86% <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.

@rohityadavcloud
Copy link
Member

Re-kicking smoketests in Github Actions.

@blueorangutan package

@blueorangutan
Copy link

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

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.

I remember there is a similar method, so looked for it

public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
List<ClusterVO> clusters = listBy(sc);
return clusters.stream()
.map(ClusterVO::getHypervisorType)
.distinct()
.collect(Collectors.toList());
}

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13077

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13076

@DaanHoogland
Copy link
Contributor

I remember there is a similar method, so looked for it

public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
List<ClusterVO> clusters = listBy(sc);
return clusters.stream()
.map(ClusterVO::getHypervisorType)
.distinct()
.collect(Collectors.toList());
}

nice find @weizhouapache , do you mean we should make a template method?

@rohityadavcloud
Copy link
Member

@shwstppr can you review and fix the build/CI failures?

Signed-off-by: Abhishek Kumar <[email protected]>
@shwstppr
Copy link
Contributor Author

I remember there is a similar method, so looked for it

public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
List<ClusterVO> clusters = listBy(sc);
return clusters.stream()
.map(ClusterVO::getHypervisorType)
.distinct()
.collect(Collectors.toList());
}

@weizhouapache are you suggesting using ClusterDao method here or in the callers itself?

@shwstppr
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@shwstppr 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
Copy link
Member

I remember there is a similar method, so looked for it

public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
if (zoneId != null) {
sc.setParameters("zoneId", zoneId);
}
List<ClusterVO> clusters = listBy(sc);
return clusters.stream()
.map(ClusterVO::getHypervisorType)
.distinct()
.collect(Collectors.toList());
}

@weizhouapache are you suggesting using ClusterDao method here or in the callers itself?

if the method returns the same result, we can use it.
the code can be simple as

    @Override
    public List<HypervisorType> listAvailHypervisorInZone(final Long zoneId) {
        return _clusterDao.getAvailableHypervisorInZone(zoneId);
    }

if there is a cluster without any host, then the results will be different ..

@blueorangutan
Copy link

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

@shwstppr
Copy link
Contributor Author

shwstppr commented Apr 17, 2025

Thanks @weizhouapache . It seems HostDao and ClusterDao can return different results. Maybe we can have a separate refactor to consolidate this or should I make the change here to use ClusterDao?

@shwstppr
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@shwstppr 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-13072)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 51906 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10738-t13072-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

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

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

Copy link
Contributor

@vladimirpetrov vladimirpetrov left a comment

Choose a reason for hiding this comment

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

LGTM based on manual testing

@DaanHoogland
Copy link
Contributor

@shwstppr , this looks ready to merge, do you feel it is ready?

@shwstppr shwstppr marked this pull request as ready for review April 23, 2025 20:26
@shwstppr
Copy link
Contributor Author

@DaanHoogland yes. Marked it ready for review

@rohityadavcloud rohityadavcloud merged commit 603cd84 into apache:4.20 Apr 24, 2025
25 of 26 checks passed
@rohityadavcloud rohityadavcloud deleted the fix-resourcemgr-hyplist branch April 24, 2025 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants