-
Notifications
You must be signed in to change notification settings - Fork 293
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
Fixes #37888 - add host bootc information to API #11175
Conversation
def image_mode_host? | ||
bootc_booted_image.present? | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May also think about adding this to scoped_search in host_managed_extensions. I would want to be able to see a list of all my image-mode hosts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added!
f003ca4
to
0a1577d
Compare
I'm thinking the bootc facts should be removed from the content facet and put on the host itself instead. The content facet is more useful for connecting Katello content to hosts. However, the bootc facts are 'physical' facts about the machine, like installed packages. We associate installed packages directly to the host. The bootc facts might be different from content that is synced in Katello. Edit: I realized for attributes like installed packages, the connection to host is through a joins table, so the table didn't need to be edited directly. Turns out we don't have precedent for altering the hosts table from Katello, so a facet is likely a better alternative. |
I'm going to also add autocompleted searching on the images and their digests to help users filter image mode hosts. |
Might be out of scope for this PR but we are still planning to add the relational models to tie host to katello managed manifest/list based on the stored digest, right? |
0a1577d
to
fd1b623
Compare
Yes, I was thinking we'd do that when we implement fact fetching from sub-man. |
I pushed an update that gets autocomplete working with the image_mode scoped_search. I also added searching for the other bootc fact fields. |
4f67f3e
to
cf5650a
Compare
TODO: Test performance querying all bootc_booted_image + bootc_booted_digest and making the list unique for ~50K hosts. |
if hosts.empty? | ||
{ :conditions => "1=0" } | ||
else | ||
{ :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.pluck(:id).join(',')})" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be fixed, the plucking of the ID is unnecessary and slow. It also introduces duplicate problems in the IN condition.
It was taking too long to register that many hosts, so I stuck to 6574 hosts with content facets. Query results: [7] pry(main)> Benchmark.measure do
[7] pry(main)* ::Katello::Host::ContentFacet.where.not(bootc_booted_image: nil).select(:bootc_booted_image, :bootc_booted_digest).distinct.pluck(:bootc_booted_image, :bootc_booted_digest)
[7] pry(main)* end
=> #<Benchmark::Tms:0x00007f91beaa6a20
@cstime=0.0,
@cutime=0.0,
@label="",
@real=0.02300092700170353,
@stime=0.0,
@total=0.009263999999999939,
@utime=0.009263999999999939>
[9] pry(main)> ::Katello::Host::ContentFacet.count
=> 6574 Results when making a potential hash for the image mode images page: [79] pry(main)>
Benchmark.measure do
results = ::Katello::Host::ContentFacet.select(:bootc_booted_image, :bootc_booted_digest, 'COUNT(hosts.id) as host_count').joins(:host).group(:bootc_booted_image, :bootc_booted_digest)
image_mode_map = Hash.new { |h,k| h[k] = [] }
results.each do |host_image|
image_mode_map[host_image.bootc_booted_image] << { bootc_booted_digest: host_image.bootc_booted_digest, host_count: host_image.host_count.to_i }
end
end
=> #<Benchmark::Tms:0x00007f91b8716140
@cstime=0.0,
@cutime=0.0,
@label="",
@real=0.022486373025458306,
@stime=0.0,
@total=0.013446000000000069,
@utime=0.013446000000000069> |
cf5650a
to
8fc61f6
Compare
8fc61f6
to
cae8bc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack..The setup looks good..Able to see the new fields on the model and API correctly. Merge it..
I realized I have one small todo -- we need to add something to the host index API view for bootc. Either a "image mode" true/false or the image information itself. |
cae8bc9
to
528876d
Compare
Todo is done, I added the full values. We may want to display some more of that eventually I suppose. Let me know if you think otherwise. |
528876d
to
b69ddda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack * 2 🎉
What are the changes introduced in this pull request?
Considerations taken when implementing this change?
^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?/)?([a-z0-9]+(?:[._-][a-z0-9]+)*/)*[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[a-zA-Z0-9._-]+)?(?:@[A-Fa-f0-9]+:[A-Fa-f0-9]{64})?$
What are the testing steps for this pull request?