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

Use subscription of the product class #1283

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

jesusbv
Copy link
Collaborator

@jesusbv jesusbv commented Feb 6, 2025

Description

Use add_on check that would return the real product class, instead of the wrong base product

With that add_on product class value, perform the query to fetch the proper subscription for the product

Do not compare product identifiers or based product classes but product class which belong to the right subscription

This Fixes bsc#1236816 and bsc#1236836

How to test

Migrate a Micro 5.5 -> Micro 6.1 should succeed

Change Type

Please select the correct option.

  • Bug Fix (a non-breaking change which fixes an issue)
  • New Feature (a non-breaking change which adds new functionality)
  • Documentation Update (a change which only updates documentation)

Checklist

Please check off each item if the requirement is met.

  • I have reviewed my own code and believe that it's ready for an external review.
  • I have provided comments for any hard-to-understand code.
  • I have documented the MANUAL.md file with any changes to the user experience.
  • If my changes are non-trivial, I have added a changelog entry to notify users at package/obs/rmt-server.changes.

Review

Please check out our review guidelines
and get in touch with the author to get a shared understanding of the change.

Use add_on check that would return the real product class,
instead of the wrong base product

With that add_on product class value, perform the query to fetch
the proper subscription for the product

Do not compare product identifiers or based product classes but
product class which belong to the right subscription

This Fixes bsc#1236816 and bsc#1236836
@jesusbv jesusbv self-assigned this Feb 6, 2025
@jesusbv jesusbv added the 2.22 label Feb 6, 2025
@@ -121,8 +143,12 @@ def verify_base_product_upgrade
return unless upgrade_product.base?

activated_bases = @system.products.where(product_type: 'base')
activated_bases.each do |base_product|
return true if (base_product.identifier == upgrade_product.identifier)
upgrade_product_subscription = find_subscription(upgrade_product, logger, request)
Copy link
Member

Choose a reason for hiding this comment

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

It would be more straight forward to check if the base_product_subscription includes the upgrade_product: base_product_subscription.products.include?(upgrade_product)

def add_on
# method to check if a system has an add on product
# based on the system metadata
# and if so, it returns its real product class
Copy link
Member

Choose a reason for hiding this comment

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

I cannot follow this comment, what does it mean that a system has an add on product, and what is the real product class? Also, add on product is not a term used in RMT, I assume you mean 'extension product'?

# i.e. in the case of SUMA, it would SUMA product class
# not the SUMA base product class (Micro)
product_class = add_on_product_class.presence || base_product.product_class
Subscription.joins(:product_classes).find_by(
Copy link
Member

Choose a reason for hiding this comment

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

The problem here is, that this code (find_by) returns randomly the first subscription that matches this criteria. But there can be multiple subscriptions that include a certain product class.
Some examples from the pubcloud account:

> Organization.find(500276).subscriptions.map{|s| "#{s.name}, product_classes: #{s.product_classes.map(&:name).join(',')}"}
=> 
["RES Expanded Support, product_classes: HPC-X86-ALPHA,RES,7261-BETA,7261-ALPHA,RES-ALPHA,OPENSUSE-BETA,OPENSUSE-ALPHA,HPC-X86-BETA,HPC-X86,OPENSUSE,7261",
 "SLES + HPC LTSS aarch64, product_classes: SLES12-SP3-LTSS-ARM64,SLES15-LTSS-ARM64,HPC15-LTSS-ARM64,SLES12-SP4-LTSS-ARM64,HPC15-SP2-LTSS-ARM64,SLES15-SP1-LTSS-ARM64,HPC15-SP1-LTSS-ARM64,SLES15-SP2-LTSS-ARM64,HPC15-SP3-LTSS-ARM64,HPC15-SP4-LTSS-ARM64,SLES15-SP3-LTSS-ARM64,HPC15-SP5-LTSS-ARM64,SLES15-SP4-LTSS-ARM64,SLES15-SP5-LTSS-ARM64,SLES12-SP5-LTSS-ARM64",
 "SUSE Linux Enterprise Server x86_64, product_classes: 7261-BETA,HPC-X86-BETA,HPC-X86,7261",
 "SUSE Linux Enterprise Server aarch64, product_classes: SLES-ARM64-BETA,SLES-ARM64,HPC-ARM64-BETA,HPC-ARM64,OPENSUSE",
 "SLES for SAP + Live Patching x86_64 (special setup for public cloud), product_classes: SLE-LP,SLE-HAE-X86,SLE-HAE-X86-BETA,AiO-BETA,SLE-LP-BETA,AiO",
 "SLES + HPC LTSS x86_64, product_classes: SLES15-SP4-LTSS-X86,SLES12-GA-LTSS-X86,SLES12-SP1-LTSS-X86,SLES15-GA-LTSS-X86,HPC15-LTSS-X86,SLES12-SP2-LTSS-X86,SLES12-SP3-LTSS-X86,SLES12-SP4-LTSS-X86-ALPHA,SLES12-SP4-LTSS-X86,HPC15-SP2-LTSS-X86,SLES15-SP1-LTSS-X86-ALPHA,SLES15-SP1-LTSS-X86,HPC15-SP1-LTSS-X86,HPC15-SP3-LTSS-X86,SLES15-SP2-LTSS-X86,HPC15-SP4-LTSS-X86,SLES15-SP3-LTSS-X86,SLES12-SP5-LTSS-X86,AiO,7261,HPC15-SP5-LTSS-X86,SLES15-SP5-LTSS-X86",
 "SUSE Manager x86_64, product_classes: HPC-X86-ALPHA,SMP,SMS-X86,7261-BETA,SMS-X86-BETA,SMP-BETA,7261-ALPHA,SLE-M-T,SMP-ALPHA,OPENSUSE-BETA,OPENSUSE-ALPHA,HPC-X86-BETA,HPC-X86,SLE-M-T-BETA,SMS-X86-ALPHA,SLE-M-T-ALPHA,OPENSUSE,MICROOS-X86-BETA,MICROOS-X86,7261",
 "SUSE Manager aarch64, product_classes: SM_ENT_MGM_S,SM_ENT_PROV_S,SLE-M-T,OPENSUSE,MICROOS-ARM64-ALPHA,MICROOS-ARM64-BETA,MICROOS-ARM64,SMS-ARM64,SMP-ARM64",
 "SLE Micro aarch64, product_classes: MICROOS-ARM64-BETA,MICROOS-ARM64",
 "SLE Micro x86_64, product_classes: SLE-LP,HPC-X86-ALPHA,7261-BETA,7261-ALPHA,SLE-LP-BETA,SLE-LP-ALPHA,OPENSUSE-BETA,OPENSUSE-ALPHA,HPC-X86-BETA,HPC-X86,OPENSUSE,MICROOS-X86-ALPHA,MICROOS-X86-BETA,MICROOS-X86,7261"]

You can see that the 7261 (sles x86) product class is included in multiple subscriptions. It might be required to configure which client instance data product is supposed to use which subscription in the pubcloud RMTs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants