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

Override quota calculation methods #469

Closed

Conversation

jaywcarman
Copy link
Member

Depends on:
ManageIQ/manageiq#22680

PowerVS uses the more typical Flavor style of cpu allocation for SAP
profiles. For non SAP profiles, the Flavor only set the host type and
the user is allowed to request any number of cpus using the
entitled_processors form option.

@@ -59,6 +59,15 @@ def raw_delete_image
_log.error("image=[#{name}], error: #{e}")
end

def number_of_cpus_for_request(request)
flavor_obj = Flavor.find_by(:name => request.options[:sys_type][1])
Copy link
Member

Choose a reason for hiding this comment

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

I think you want request.get_option(:sys_type) here. Also we'll need to include the EMS ID so we don't find a flavor from another EMS

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you want request.get_option(:sys_type) here.

That wasn't working for me, because we're not using the flavors table index as the index for this form.

(byebug) request.options[:sys_type]
[1, "s922"]
(byebug) Flavor.find(request.get_option(:sys_type)).name
  Flavor Load (93.2ms)  SELECT "flavors".* FROM "flavors" WHERE "flavors"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  Flavor Inst Including Associations (0.2ms - 1rows)
"e980"
(byebug) Flavor.find_by(:ems_id => ems_id, :name => "s922").name
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 2, in use: 2, waiting_in_queue: 0
  Flavor Load (42.8ms)  SELECT "flavors".* FROM "flavors" WHERE "flavors"."ems_id" = $1 AND "flavors"."name" = $2 LIMIT $3  [["ems_id", 3], ["name", "s922"], ["LIMIT", 1]]
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 3, in use: 3, waiting_in_queue: 0
  Flavor Inst Including Associations (0.3ms - 1rows)
  TRANSACTION (20.1ms)  BEGIN
"s922"
(byebug) Flavor.find_by(:ems_id => ems_id, :name => "s922").id
  TRANSACTION (5508.8ms)  BEGIN
  Flavor Load (13.9ms)  SELECT "flavors".* FROM "flavors" WHERE "flavors"."ems_id" = $1 AND "flavors"."name" = $2 LIMIT $3  [["ems_id", 3], ["name", "s922"], ["LIMIT", 1]]
  Flavor Inst Including Associations (0.6ms - 1rows)
2

This list is generated here, where it looks like the index is just an enumeration instead of mapping to the Flavor ID.

Also we'll need to include the EMS ID so we don't find a flavor from another EMS

Nice catch, I'll fix this

@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch from 28c5bfe to 12e019e Compare August 31, 2023 10:51
@jaywcarman jaywcarman requested a review from Fryguy as a code owner August 31, 2023 10:51
@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch 2 times, most recently from e61272b to 448f3a6 Compare August 31, 2023 20:32
@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch from 448f3a6 to 66c9348 Compare October 2, 2023 18:38
@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch 2 times, most recently from 93c7aaa to 25fd85a Compare October 18, 2023 16:43
@jaywcarman jaywcarman changed the title [WIP] Override number_of_cpus_for_request [WIP] Override quota calculation methods Oct 18, 2023
@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch from 25fd85a to 09e6a9a Compare October 18, 2023 18:28
@jaywcarman jaywcarman changed the title [WIP] Override quota calculation methods Override quota calculation methods Oct 18, 2023
PowerVS uses the more typical Flavor style of cpu allocation for SAP
profiles. For non SAP profiles, the Flavor only sets the host type and
the user is allowed to request any number of cpus using the
entitled_processors form option.
PowerVS uses the more typical Flavor style of memory allocation for SAP
profiles. For non SAP profiles, the Flavor only sets the host type and
the user is allowed to request any amount of memory.
@jaywcarman jaywcarman force-pushed the pluggable_request_quota_counts branch from 09e6a9a to 62de0a0 Compare October 27, 2023 15:37
@miq-bot
Copy link
Member

miq-bot commented Oct 31, 2023

Checked commits jaywcarman/manageiq-providers-ibm_cloud@9846926~...62de0a0 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint
1 file checked, 0 offenses detected
Everything looks fine. ⭐

@miq-bot miq-bot removed the wip label Oct 31, 2023
@miq-bot miq-bot added the stale label Feb 19, 2024
@miq-bot
Copy link
Member

miq-bot commented Feb 19, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

3 similar comments
@miq-bot
Copy link
Member

miq-bot commented May 20, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

@miq-bot
Copy link
Member

miq-bot commented Aug 26, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

@miq-bot
Copy link
Member

miq-bot commented Dec 9, 2024

This pull request has been automatically marked as stale because it has not been updated for at least 3 months.

If these changes are still valid, please remove the stale label, make any changes requested by reviewers (if any), and ensure that this issue is being looked at by the assigned/reviewer(s).

@jaywcarman jaywcarman closed this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants