Bug 1048530

Summary: [RFE] Missing migration paths and broken handling in rhn-migrate-classic-to-rhsm
Product: Red Hat Enterprise Linux 6 Reporter: Robert Scheck <redhat-bugzilla>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: awood, bkearney, dgregor, jesusr, pmutha, robert.scheck, xdmoon, yjog
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
no documentation required
Story Points: ---
Clone Of:
: 1088156 (view as bug list) Environment:
Last Closed: 2014-10-14 07:46:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1014343, 1056252, 1088156    

Description Robert Scheck 2014-01-04 21:41:54 UTC
Description of problem:
I am sorry to say that, but IMHO rhn-migrate-classic-to-rhsm is just bad:

1. rhn-migrate-classic-to-rhsm(1) is provided by subscription-manager-migration
   RPM. Running rhn-migrate-classic-to-rhsm(1) fails but complains that the RPM 
   package subscription-manager-migration-data is not installed. However there
   is no dependency between subscription-manager-migration and -data. Why also
   two packages if rhn-migrate-classic-to-rhsm anyway requires -data package?
   Okay, two packages might make sense from a technical view, however there is
   still no RPM package dependency which really should exist.
2. Running rhn-migrate-classic-to-rhsm(1) complains about the channels:
   - rhel-x86_64-workstation-fastrack-6
   - rhel-x86_64-workstation-optional-fastrack-6
   - rhn-tools-rhel-x86_64-workstation-6
   And it suggests to use --force.
3. Running 'rhn-migrate-classic-to-rhsm --force' also fails like this:
   You are subscribed to channels that have conflicting product certificates.
   The following channels map to product ID 71:
           rhel-x86_64-workstation-6
           rhel-x86_64-workstation-optional-6
           rhel-x86_64-workstation-supplementary-6
   Reduce the number of channels per product ID to 1 and run migration again.
   To remove a channel, use
     'rhn-channel --remove --channel=<conflicting_channel>'.
4. Running 'rhn-channel --remove --channel=rhel-x86_64-workstation-optional-6 
   --channel=rhel-x86_64-workstation-supplementary-6' seems to work.
5. Afterwards at least 'rhn-migrate-classic-to-rhsm --force' works somehow.

What the heck? Okay. Now my system is on the subscription manager stuff. To
get my channels back I need to run:

subscription-manager repos \
  --enable=rhel-6-workstation-optional-fastrack-rpms
  --enable=rhel-6-workstation-fastrack-rpms \
  --enable=rhel-6-workstation-supplementary-rpms \
  --enable=rhel-6-workstation-optional-rpms \
  --disable=rhel-6-workstation-rhev-agent-rpms

Oh? Where did my previously enabled supplementary channel end? And why does
the migration tool automagically enable RHEV-related stuff that I never did
use before?

Version-Release number of selected component (if applicable):
subscription-manager-migration-1.9.11-1.el6.x86_64
subscription-manager-migration-data-2.0.5-1.el6.noarch

How reproducible:
Take e.g. Red Hat Enterprise Linux Workstation (v. 6 for x86_64) with the
channels:

 - RHEL Workstation Supplementary (v. 6 for x86_64)
 - RHEL Workstation Optional FasTrack (v. 6 for x86_64)
 - RHEL Workstation FasTrack (v. 6 for x86_64)
 - RHEL Workstation Optional (v. 6 for x86_64)
 - RHN Tools for RHEL Workstation (v. 6 for 64-bit x86_64)

Run commands from above.

Actual results:
The migration path is incomplete and includes broken default handling and
also requires manual interaction.

Expected results:
Proper complete migration using rhn-migrate-classic-to-rhsm(1) only. If it
is not able to migrate I seriously question its reason to exist, sorry.

Additional info:
Ticket results from initially missing fastrack channel as per bug #818202.

Comment 2 John Sefler 2014-01-06 13:36:49 UTC
(In reply to Robert Scheck from comment #0)
For the sake of reference, I'm adding links to former bugs that help explain (right or wrong) why the rhn-migrate-classic-to-rhsm tool is responding as is...

> Description of problem:
> 
> 1. rhn-migrate-classic-to-rhsm(1) is provided by subscription-manager-migration
Reference bug 967863
Reference bug 811779

> 2. Running rhn-migrate-classic-to-rhsm(1) complains about the channels:
>    - rhel-x86_64-workstation-fastrack-6
>    - rhel-x86_64-workstation-optional-fastrack-6
>    - rhn-tools-rhel-x86_64-workstation-6
>    And it suggests to use --force.
The suggestion to use --force is designed to occur when no consumingRhnClassicChannel:rhsmProductCert.pem mapping is found in the channel-cert-mapping.txt file that is provided by the subscription-manager-migration-data package.

> 3. Running 'rhn-migrate-classic-to-rhsm --force' also fails like this:
>    You are subscribed to channels that have conflicting product certificates.
Reference bug 1006985

> 4. Running 'rhn-channel --remove
> --channel=rhel-x86_64-workstation-optional-6 
> --channel=rhel-x86_64-workstation-supplementary-6' seems to work.
> 5. Afterwards at least 'rhn-migrate-classic-to-rhsm --force' works somehow.
> 
> What the heck? Okay. Now my system is on the subscription manager stuff. To
> get my channels back I need to run:
> 
> subscription-manager repos \
>   --enable=rhel-6-workstation-optional-fastrack-rpms
>   --enable=rhel-6-workstation-fastrack-rpms \
>   --enable=rhel-6-workstation-supplementary-rpms \
>   --enable=rhel-6-workstation-optional-rpms \
>   --disable=rhel-6-workstation-rhev-agent-rpms
https://bugzilla.redhat.com/show_bug.cgi?id=818202#c35

> Oh? Where did my previously enabled supplementary channel end? And why does
> the migration tool automagically enable RHEV-related stuff that I never did
> use before?
The migration tool did not automagically enable RHEV-related stuff.  That's a function of the default yum repo enablement from the CDN that the autosubscribed subscription entitles this system to.

Comment 3 Robert Scheck 2014-01-06 19:07:34 UTC
I am very sorry, but I do not see how one of the above mentioned bug reports
would really solve these issues. rhn-migrate-classic-to-rhsm actually does not
really what is name says: It does unregister from RHN, register with RHSM but
does not properly migrate any channel except for the base one. Why yet another
tool for such an incomplete functionality?

Cross-filed case 01005878 on the Red Hat customer portal.

Comment 4 Alex Wood 2014-01-06 20:07:24 UTC
Robert,

You are absolutely correct about putting in the conditional dependency (suggested in Bug #811779).  I will work on fixing this ASAP.

Comment 5 John Sefler 2014-01-06 21:18:07 UTC
(In reply to Robert Scheck from comment #3)
> I am very sorry, but I do not see how one of the above mentioned bug reports
> would really solve these issues.
They don't solve these issues.  I simply pasted them here as a reference trail to help show how we got to the currently deficient behavior.

Comment 6 John Sefler 2014-01-06 21:21:50 UTC
(In reply to Alex Wood from comment #4)

Bug 1049037 has been opened to track the conditional dependency.

Comment 10 Alex Wood 2014-07-28 19:42:12 UTC
The following channels have been added to migration data:
   - rhel-x86_64-workstation-fastrack-6
   - rhel-x86_64-workstation-optional-fastrack-6
   - rhn-tools-rhel-x86_64-workstation-6

Comment 11 Robert Scheck 2014-07-28 20:33:25 UTC
How about server vs. workstation? How about supplementary?

Comment 12 Alex Wood 2014-07-31 14:50:40 UTC
> 3. Running 'rhn-migrate-classic-to-rhsm --force' also fails like this:
>    You are subscribed to channels that have conflicting product certificates.
>    The following channels map to product ID 71:
>            rhel-x86_64-workstation-6
>            rhel-x86_64-workstation-optional-6
>            rhel-x86_64-workstation-supplementary-6
>    Reduce the number of channels per product ID to 1 and run migration again.
>    To remove a channel, use
>      'rhn-channel --remove --channel=<conflicting_channel>'.

> How about server vs. workstation? How about supplementary?

Robert,

The server, workstation, and supplementary channels will be included in the next release; however, the problem you're running into in item 3 was not cause by missing certs.

Instead, the issue was that the same product ID (71) in this case was pointing to different product certificates due to some limitations within subscription-manager the product certificates are currently just referenced by ID.  With multiple certs pointing to the same ID, the migration script doesn't know what to do.  Rather than guess, we abort the migration.

I've verified that the ambiguity has been resolved in the upcoming release.

Comment 14 John Sefler 2014-08-29 18:38:03 UTC
> 3. Running 'rhn-migrate-classic-to-rhsm --force' also fails like this:
>    You are subscribed to channels that have conflicting product certificates.
>    The following channels map to product ID 71:
>            rhel-x86_64-workstation-6
>            rhel-x86_64-workstation-optional-6
>            rhel-x86_64-workstation-supplementary-6
>    Reduce the number of channels per product ID to 1 and run migration again.
>    To remove a channel, use
>      'rhn-channel --remove --channel=<conflicting_channel>'.

Let me try to re-explain comment 12 and verify the fix...
The issue was that these three channels were all mapped to product certs with the same product id (71).  However the product certs were actually three different product certs, hence the migration script did not know which one of the three to install in order to complete the migration.  Hence the script aborted rather than guess.  As designed, rhn-migrate-classic-to-rhsm is doing the correct thing.  Note that "--force" option was not intended to address this issue.  The --force option will "ignore channels not available on RHSM".  This was issue encountered in point 2...

> 2. Running rhn-migrate-classic-to-rhsm(1) complains about the channels:
>    - rhel-x86_64-workstation-fastrack-6
>    - rhel-x86_64-workstation-optional-fastrack-6
>    - rhn-tools-rhel-x86_64-workstation-6
>    And it suggests to use --force.

With this explanation, the defects were actually in the RHEL6.5 delivered version of subscription-manager-migration-data.  I will demonstrate...

[root@jsefler-6 ~]# rpm -q subscription-manager-migration-data
subscription-manager-migration-data-2.0.5-1.el6.noarch

[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-fastrack-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-optional-fastrack-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
[root@jsefler-6 ~]# egrep ^rhn-tools-rhel-x86_64-workstation-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
[root@jsefler-6 ~]# 

^^ Notice that these three channels were not mapped to any product cert in subscription-manager-migration-data-2.0.5-1.  That's the problem with issue 2.
Now lets look at issue 3...


[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-6: Workstation-Workstation-x86_64-c566f140b1ae-71.pem
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-optional-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-optional-6: Workstation-Workstation-x86_64-62603c09b9f4-71.pem
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-supplementary-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-supplementary-6: Workstation-Workstation-x86_64-7eded4a44883-71.pem
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# rct cat-cert /usr/share/rhsm/product/RHEL-6/Workstation-Workstation-x86_64-c566f140b1ae-71.pem | grep -A8 Product:
Product:
	ID: 71
	Name: Red Hat Enterprise Linux Workstation
	Version: 6.5
	Arch: x86_64
	Tags: rhel-6,rhel-6-workstation
	Brand Type: 
	Brand Name: 

[root@jsefler-6 ~]# rct cat-cert /usr/share/rhsm/product/RHEL-6/Workstation-Workstation-x86_64-62603c09b9f4-71.pem | grep -A8 Product:
Product:
	ID: 71
	Name: Red Hat Enterprise Linux Workstation
	Version: 6.4
	Arch: x86_64
	Tags: rhel-6,rhel-6-workstation
	Brand Type: 
	Brand Name: 

[root@jsefler-6 ~]# rct cat-cert /usr/share/rhsm/product/RHEL-6/Workstation-Workstation-x86_64-7eded4a44883-71.pem | grep -A8 Product:
Product:
	ID: 71
	Name: Red Hat Enterprise Linux Workstation
	Version: 6.3 Beta
	Arch: x86_64
	Tags: rhel-6,rhel-6-workstation
	Brand Type: 
	Brand Name: 

[root@jsefler-6 ~]# 

^^ Notice that all three *-71.pem files came from different/older versions of RHEL Workstation.  That's the problem with issue 3.



Verifying the next version of subscription-manager-migration-data targeted for release with RHEL6.6...

[root@jsefler-6 ~]# rpm -q subscription-manager-migration-data
subscription-manager-migration-data-2.0.12-1.el6.noarch

[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-fastrack-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-fastrack-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-optional-fastrack-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-optional-fastrack-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# egrep ^rhn-tools-rhel-x86_64-workstation-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhn-tools-rhel-x86_64-workstation-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# 

VERIFIED: All three of these workstation channels now mapped to product certs.  This fixes issue 2.


[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-optional-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-optional-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# egrep ^rhel-x86_64-workstation-supplementary-6: /usr/share/rhsm/product/RHEL-6/channel-cert-mapping.txt
rhel-x86_64-workstation-supplementary-6: Workstation-x86_64-7ea5bf9e611c-71.pem
[root@jsefler-6 ~]# rct cat-cert /usr/share/rhsm/product/RHEL-6/Workstation-x86_64-7ea5bf9e611c-71.pem | grep -A8 Product: 
Product:
	ID: 71
	Name: Red Hat Enterprise Linux Workstation
	Version: 6.6
	Arch: x86_64
	Tags: rhel-6,rhel-6-workstation
	Brand Type: 
	Brand Name: 

VERIFIED: All three of these workstation channels now map to the same product cert version for product id 71.  This fixes issue 3.

Comment 15 errata-xmlrpc 2014-10-14 07:46:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1384.html