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-49147: Reduce size of the pool record (uefi_certificates) #6182

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edwintorok
Copy link
Contributor

This field is very big and part of every pool.get_all_records() call (done by SM), which is currently >64KiB in size.

TODO: the Changed field needs to match the (future!) tag that this will receive. Hence draft.

Copy link
Contributor

@lindig lindig left a comment

Choose a reason for hiding this comment

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

The idea is that very few clients will need the certificate and can use a new API call to obtain it. The existing field is replaced by a digest.

This seems fine with me as long as we control the relevant clients.

@lindig
Copy link
Contributor

lindig commented Jan 9, 2025

I would like to see this merged because UEFI takes up a lot of data in records.

Copy link
Contributor

@contificate contificate left a comment

Choose a reason for hiding this comment

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

I'd also like to see this change merged.

Copy link
Contributor

@contificate contificate left a comment

Choose a reason for hiding this comment

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

Upon a second look over this PR, I am concerned about the change to "internal only". My understanding is that internal only fields affect what is seen in snapshots.

image

The API records manipulated internally comprise every field, but my understanding is that DB actions (generated) for get_record etc. exclude those fields (since they're typically things like related session references).

We should change the meaning of the field, but not its visibility to API users (which I fear this PR may have done accidentally).

@robhoes
Copy link
Member

robhoes commented Jan 22, 2025

I agree with @contificate. Making existing fields internal_only:true is similar to removing the field from the API and is backwards incompatible. It may also break rolling updates.

@edwintorok
Copy link
Contributor Author

I'll need to find another method than internal_only:true to allow overriding get_. DynamicRO doesn't work either.
Might need to add another bool to field to allow overriding get.

@contificate
Copy link
Contributor

I'll need to find another method than internal_only:true to allow overriding get_. DynamicRO doesn't work either. Might need to add another bool to field to allow overriding get.

A simpler semantics may be to make it so that overloading just works: if you specify a custom implementation, it will avoid endowing the object with implicitly-generated messages of the same name.

@robhoes
Copy link
Member

robhoes commented Feb 6, 2025

Is this field is present on each host, with the same (large) content?

So we can't simply remove the pool field completely, as it will break many things (clients and server), even when clients are not interested in the field at all. A more limited way of breaking compatibility is to change the contents of a single field, as you have done by hashing the value. I think we should leave it at that, and not try to fake the API getter of the field, which would be inconsistent with what you get back from pool.get_record, event.from etc. We'll just have to take the hit of the change in semantics of that field.

If this makes it somehow hard for a client to get the right data, then we can still add a function to the pool class, but with a name that is different from the default getter.

@edwintorok
Copy link
Contributor Author

edwintorok commented Feb 6, 2025

w hard for a client to get the right data

We've deprecated the per-host field though, pointing to the Pool field instead, so it is a bit awkward, not sure whether you can change them per host anymore. In fact we raise an exception if you try to set it per host, pointing you to use 'Pool.set_custom_uefi_certificates instead'.
Pool.set_uefi_certificates is deprecated too, pointing to Pool.set_custom_uefi_certificates.

So actually one solution here would be to replace this field with the static value deprecated. If someone sets a custom uefi certificate that will be present in custom_uefi_certificates field, not this one.

And normally you wouldn't have custom uefi certificates set, and just use the defaults.

You can still query what the UEFI certificate actually is by quering the host object.

We need to be careful that internally we don't accidentally fetch the certificate from the pool (where we only have the digest) instead of the host (where we have the real value), otherwise the VM won't actually have something valid.
I've done that in Helpers.ml though.

; ( Changed
, "25.6.0"
, "Field replaced with a digest. You can still get the actual \
value by calling Host.get_uefi_certificates"
Copy link
Member

Choose a reason for hiding this comment

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

Then we should revert the deprecation status of host.uefi_certificates.

@robhoes
Copy link
Member

robhoes commented Feb 7, 2025

Do you want to replace the contents of the field when updating the pool?

@edwintorok
Copy link
Contributor Author

There was a bug here when the host certificate was empty, the pool certificate was still set to non-empty string, that should be fixed now.

I don't think we need any special upgrade code, because this seems to be called from the startup steps of XAPI on each host, so a toolstack restart suffices to get the new values.

@edwintorok edwintorok requested a review from contificate March 4, 2025 18:11
Copy link
Contributor

@contificate contificate left a comment

Choose a reason for hiding this comment

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

Appears to have pulled in other commits, but the relevant one (ba202ba) seems like it ought to work.

@edwintorok edwintorok force-pushed the pr/CP-49147 branch 2 times, most recently from 2606bbd to e862c4c Compare March 11, 2025 09:42
@edwintorok edwintorok changed the base branch from feature/perf to master March 11, 2025 09:42
This field is very big and part of every pool.get_all_records() call
(done by SM), which is currently >64KiB in size.

TODO: the Changed field needs to match the (future!) tag that this will receive.

Signed-off-by: Edwin Török <[email protected]>
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.

4 participants