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

CP-48570: Load recommendations from config file when Xapi starts #5637

Conversation

BengangY
Copy link
Contributor

@BengangY BengangY commented May 20, 2024

  1. Add a field 'recommendations' in pool.
  2. The recommendations are read from files /etc/xapi.pool-recommendations.d/* and exposed to clients. They are read-only and only for clients, hence they don't impact the behavior of Xapi directly but only indirectly as they inform a client's behavior.
  3. When Xapi starts, it will read each file and update the recommendations into the database.
  4. If we need to add recommendations to other type objects e.g. host, VM, etc in the future, just add a similar xapi.*-recommendations.d directory and define the path in xapi_globs.

@BengangY BengangY marked this pull request as ready for review May 20, 2024 10:38
ocaml/xapi/xapi_globs.ml Outdated Show resolved Hide resolved
ocaml/xapi/dbsync.ml Outdated Show resolved Hide resolved
@psafont
Copy link
Member

psafont commented May 20, 2024

The recommendations are put in the config file '/etc/xapi.conf.d/recommendations.conf'. When Xapi starts, it will read this file and update the recommendations into each object.

This description doesn't seem accurate. To configure pool_recommendations, any .conf file in xapi.conf.d will suffice, with a line containing pool_recommendations, for example, pool_recommendations = boosters=2 carrots=tasty

ocaml/xapi/xapi_globs.ml Show resolved Hide resolved
ocaml/idl/datamodel_pool.ml Outdated Show resolved Hide resolved
ocaml/xapi/dbsync.ml Outdated Show resolved Hide resolved
ocaml/xapi/pool_recommendations.ml Outdated Show resolved Hide resolved
ocaml/xapi/pool_recommendations.ml Outdated Show resolved Hide resolved
@BengangY BengangY requested a review from lindig May 21, 2024 10:14
Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@                    Coverage Diff                     @@
##           feature/vm-anti-affinity   #5637     +/-   ##
==========================================================
- Coverage                      51.3%   45.5%   -5.9%     
==========================================================
  Files                            13      13             
  Lines                          1925    1624    -301     
==========================================================
- Hits                            988     739    -249     
+ Misses                          937     885     -52     

see 11 files with indirect coverage changes

Flag Coverage Δ
python2.7 45.5% <ø> (?)
python3.11 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@lindig
Copy link
Contributor

lindig commented May 21, 2024

In my earlier comments I misunderstood the purpose of the recommendations. My current understanding is:

  • they are read from a file and exposed to clients
  • they are read-only; hence the problem of storing large values that I mentioned before does not exist
  • the recommendations are for clients and don't impact the behaviour of xapi directly but only indirectly as they inform a client's behaviour

@BengangY
Copy link
Contributor Author

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files

Why does codecov/project/scripts decrease to 36.6%? This PR didn't change scripts or *.py. And I didn't find the commit with ID d6d9454.

ocaml/xapi/dbsync.ml Outdated Show resolved Hide resolved
ocaml/xapi/xapi_globs.ml Outdated Show resolved Hide resolved
ocaml/xapi/pool_recommendations.ml Outdated Show resolved Hide resolved
@BengangY BengangY requested a review from robhoes May 22, 2024 02:20
@minglumlu
Copy link
Member

In my earlier comments I misunderstood the purpose of the recommendations. My current understanding is:

  • they are read from a file and exposed to clients
  • they are read-only; hence the problem of storing large values that I mentioned before does not exist
  • the recommendations are for clients and don't impact the behaviour of xapi directly but only indirectly as they inform a client's behaviour

I think the above can be added into commit message.

The recommendations are read from files '/etc/xapi.pool-recommendations.d/*'
and exposed to clients. They are read-only and only for clients, hence they
don't impact the behavior of Xapi directly but only indirectly as they
inform a client's behavior.

Signed-off-by: Bengang Yuan <bengang.yuan@cloud.com>
ocaml/xapi/xapi_globs.ml Outdated Show resolved Hide resolved
@BengangY BengangY requested a review from robhoes May 22, 2024 09:29
ocaml/xapi/xapi_globs.ml Outdated Show resolved Hide resolved
ocaml/xapi/xapi_globs.ml Show resolved Hide resolved
The recommendations are read from '/etc/xapi.pool-recommendations.d/*.conf'.
When Xapi starts, it will read each file and update the recommendations into
the database. If we need to add recommendations to other type objects, e.g.
host, VM, etc in the future, just add a similar 'xapi.*-recommendations.d'
directory and define the path in xapi_globs.

Signed-off-by: Bengang Yuan <bengang.yuan@cloud.com>
@minglumlu minglumlu merged commit d03febe into xapi-project:feature/vm-anti-affinity May 23, 2024
14 checks passed
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.

6 participants