Bug 1648121

Summary: [6.4]After unregistering hypervisor, unable to view subscriptions on activation key via Satellite WebUI
Product: Red Hat Satellite Reporter: wclark
Component: Activation KeysAssignee: Samir Jha <sajha>
Status: CLOSED ERRATA QA Contact: Perry Gagne <pgagne>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.4CC: ehelms, redhat
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.10.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:38:41 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:
Attachments:
Description Flags
screenshot1 showing normal/expected behavior when viewing 'list/remove subscriptions' for an activation key
none
screenshot2 showing the error behavior on 'list/remove subscriptions' when a single hypervisor was unregistered none

Description wclark 2018-11-08 21:46:30 UTC
Initial setup is an activation key with one or more derived entitlements attached.

[root@iridium ~]# hammer activation-key subscriptions --id 4 --organization-id 1
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
ID | NAME                                                                             | ATTACHED | QUANTITY | START DATE          | END DATE            | SUPPORT  | CONTRACT | ACCOUNT
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
9  | Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard |          |          | 2017/02/07 05:00:00 | 2021/12/31 23:59:59 | Standard | 11288968 | 540155 
8  | Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard |          |          | 2017/02/07 05:00:00 | 2021/12/31 23:59:59 | Standard | 11288968 | 540155 
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
[root@iridium ~]# 

One the Satellite WebUI, when viewing 'list/remove subscriptions' for the activation key, this appears as in screenshot1.png.

Then the issue is reproduced by unregistering one hypervisor associated with one of the derived entitlements on the key. At this point, when viewing 'list/remove subscriptions' on the WebUI, this appears in the broken state as in screenshot2.png.

However using Hammer, I am still able to view the one remaining subscription on the key:

[root@iridium ~]# hammer activation-key subscriptions --id 4 --organization-id 1
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
ID | NAME                                                                             | ATTACHED | QUANTITY | START DATE          | END DATE            | SUPPORT  | CONTRACT | ACCOUNT
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
8  | Red Hat Enterprise Linux for Virtual Datacenters with Smart Management, Standard |          |          | 2017/02/07 05:00:00 | 2021/12/31 23:59:59 | Standard | 11288968 | 540155 
---|----------------------------------------------------------------------------------|----------|----------|---------------------|---------------------|----------|----------|--------
[root@iridium ~]# 

When I re-register the hypervisor by re-running virt-who, then attach the physical VDC subscription to the hypervisor again, then attach the derived VDC subscription to the activation key, suddenly *all* subscriptions are showing again on the activation key under 'list/remove subscriptions'.

I have verified this behavior on 6.3.1 and 6.4. It appears to be reproducible 100% of the time.

Comment 1 wclark 2018-11-08 21:48:01 UTC
Expected Behavior:

WebUI is able to show all subscriptions on the key.

Actual Behavior:

Unable to view any subscriptions on the key until the missing virtual VDC subscription is recreated and re-added to the key, at which point all subscriptions become visible again.

Comment 2 wclark 2018-11-08 21:50:45 UTC
Created attachment 1503485 [details]
screenshot1 showing normal/expected behavior when viewing 'list/remove subscriptions' for an activation key

Comment 3 wclark 2018-11-08 21:51:51 UTC
Created attachment 1503486 [details]
screenshot2 showing the error behavior on 'list/remove subscriptions' when a single hypervisor was unregistered

Comment 4 wclark 2018-11-08 22:09:57 UTC
I have reproduced the issue without unregistering the hypervisor, it's sufficient to simply remove the physical subscription from the hypervisor and then no subscriptions will be visible under 'list/remove subscriptions' for the activation key.

Additionally I'm unclear whether this is filed under the correct component. I chose WebUI since I am able to view the proper subscriptions for the key using hammer.

Checking the Candlepin database directly, I can see the single pool on the activation key:

// getting the activation key ID

[root@iridium ~]# su - postgres -c "psql -d candlepin -c 'select id,name from cp_activation_key;'"
                id                |                 name                 
----------------------------------+--------------------------------------
 8a8c54d666cfc71e0166f53e036100aa | bcc8bad4-863a-4ec9-92ff-12c195fcdd83
(1 row)

[root@iridium ~]# 

// finding all pool_ids associated with the activation key

[root@iridium ~]# su - postgres -c "psql -d candlepin -c 'select pool_id from cp_activationkey_pool where key_id = '\''8a8c54d666cfc71e0166f53e036100aa'\'';'"
             pool_id              
----------------------------------
 8a8c54d666cfc71e0166f53d5098009d
(1 row)

[root@iridium ~]#

Comment 7 Samir Jha 2018-12-03 01:54:59 UTC
Created redmine issue http://projects.theforeman.org/issues/25604 from this bug

Comment 8 Samir Jha 2018-12-07 18:26:18 UTC
An immediate fix for this would be to run `foreman rake katello:import_subscriptions`

We are working on a long term fix for this. Thanks!

Comment 9 Satellite Program 2018-12-07 19:02:52 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25604 has been resolved.

Comment 10 Perry Gagne 2019-01-24 21:50:18 UTC
Verified fix in 6.5 snap 12

1. Configured virt-who to get hypervisors.
2. Attached VDC "physical" sub to 2 hypervisors
3. Created activation key with VDC "derived" subscription for both hypervisors and other subscriptions. 
4. Removed "physical" sub from one of the hypervisor. 

The Activation key lists the correct subs. One for the remaining hypervisor, and the custom products.

Comment 13 errata-xmlrpc 2019-05-14 12:38:41 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.

https://access.redhat.com/errata/RHSA-2019:1222