Bug 767754

Summary: Invalid certificate status when stacked entitlements have overlapping start/end dates
Product: Red Hat Enterprise Linux 7 Reporter: Michael Stead <mstead>
Component: subscription-managerAssignee: Carter Kozak <ckozak>
Status: CLOSED CURRENTRELEASE QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.0CC: bkearney, ckozak, fsharath, jgalipea, jsefler, syeghiay
Target Milestone: betaKeywords: TestBlocker
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-0.98.9-1.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 13:27:27 UTC Type: ---
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: 863175    
Attachments:
Description Flags
overlapping subscriptions none

Description Michael Stead 2011-12-14 20:02:56 UTC
Description of problem:
An invalid certificate status is shown when stacked entitlements have overlapping start/end dates.

Version-Release number of selected component (if applicable):
subscription-manager-0.98.8-1.git.3.112af88.fc15.x86_64
subscription-manager-migration-0.98.8-1.git.3.112af88.fc15.x86_64
subscription-manager-firstboot-0.98.8-1.git.3.112af88.fc15.x86_64
subscription-manager-debuginfo-0.98.8-1.git.3.112af88.fc15.x86_64
subscription-manager-gnome-0.98.8-1.git.3.112af88.fc15.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Start out with a single multi-entitled product cert in /etc/pki/product (100000000000002.pem)

2. Ensure registered machine has 2 sockets. I used a custom facts to achieve.

[mstead@boogady ~]$ cat /etc/rhsm/facts/custom.facts 
{
    "cpu.cpu_socket(s)": "2"
}

3. From the "All Available Subs" tab, show subscriptions active on TODAY.

4. Subscribe to 'Awesome OS for x86_64' with a QUANTITY of 1.

5. Cert status should now be partial (yellow).

6. From the "All Available Subs" tab, show subscriptions active on (TODAY + 1 year + 1 day). Uncheck "have no overlap with existing subscriptions".

7. Again, subscribe to 'Awesome OS for x86_64' with a QUANTITY of 1.

  
Actual results:
Compliance status shows valid (green).

Expected results:
Compliance status should remain yellow because the future entitlement has not yet started.

Additional info:

Comment 2 John Sefler 2011-12-21 16:50:16 UTC
Verifying Version...
[root@jsefler-onprem-5server ~]# rpm -qa | grep subscription-manager
subscription-manager-migration-0.98.9-1.git.2.5113757.el5_7
subscription-manager-0.98.9-1.git.2.5113757.el5_7
subscription-manager-gnome-0.98.9-1.git.2.5113757.el5_7
subscription-manager-firstboot-0.98.9-1.git.2.5113757.el5_7

[root@jsefler-onprem-5server ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: bfbb27b8-7ef1-4691-ac3e-8078c15ea36a 

[root@jsefler-onprem-5server ~]# ls /etc/pki/product/
100000000000002.pem

[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Not Subscribed           
Starts:               	None                     
Expires:              	None                     

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep cpu_socket
cpu.cpu_socket(s): 2

[root@jsefler-onprem-5server ~]# subscription-manager list --avail | egrep "Awesome OS for x86_64 *$" -A7
ProductName:          	Stackable with Awesome OS for x86_64
ProductId:            	stackable-with-awesomeos-x86_64
PoolId:               	8a90f857345e267001345e2769c102e4
Quantity:             	5                        
Multi-Entitlement:    	No                       
Expires:              	01/18/2013               
MachineType:          	physical                 

ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f857345e267001345e2769fd02f9
Quantity:             	10                       
Multi-Entitlement:    	Yes                      
Expires:              	01/18/2013               
MachineType:          	physical                 

ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f857345e267001345e276a210304
Quantity:             	5                        
Multi-Entitlement:    	Yes                      
Expires:              	01/18/2013               
MachineType:          	physical                 

--
ProductName:          	Stackable with Awesome OS for x86_64
ProductId:            	stackable-with-awesomeos-x86_64
PoolId:               	8a90f857345e267001345e2769a102da
Quantity:             	10                       
Multi-Entitlement:    	No                       
Expires:              	01/18/2013               
MachineType:          	physical                 

[root@jsefler-onprem-5server ~]# subscription-manager subscribe --pool 8a90f857345e267001345e2769fd02f9 --quantity 1
Successfully consumed a subscription from the pool with id 8a90f857345e267001345e2769fd02f9

[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Partially Subscribed     
Starts:               	11/19/2011               
Expires:              	01/18/2013               

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep entitlements
system.entitlements_valid: partial

[root@jsefler-onprem-5server ~]# subscription-manager list --avail --ondate 2013-01-19 | egrep "Awesome OS for x86_64 *$" -A7
ProductName:          	Stackable with Awesome OS for x86_64
ProductId:            	stackable-with-awesomeos-x86_64
PoolId:               	8a90f857345e267001345e27698602d0
Quantity:             	15                       
Multi-Entitlement:    	No                       
Expires:              	12/08/2013               
MachineType:          	physical                 

--
ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f857345e267001345e2769e202ee
Quantity:             	15                       
Multi-Entitlement:    	Yes                      
Expires:              	12/08/2013               
MachineType:          	physical  

[root@jsefler-onprem-5server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
ProductName:          	Awesome OS for x86_64 Bits
Version:              	3.11                     
Arch:                 	x86_64                   
Status:               	Future Subscription      
Starts:               	11/19/2011               
Expires:              	01/18/2013               

[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep entitlements
system.entitlements_valid: partial
[root@jsefler-onprem-5server ~]# 

[root@jsefler-onprem-5server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+

ProductName:          	Awesome OS for x86_64 Bits
ContractNumber:       	23                       
AccountNumber:        	12331131231              
SerialNumber:         	5235465471794109296      
Active:               	True                     
QuantityUsed:         	1                        
Begins:               	12/08/2012               
Expires:              	12/08/2013               

ProductName:          	Awesome OS for x86_64 Bits
ContractNumber:       	23                       
AccountNumber:        	12331131231              
SerialNumber:         	6074340507651301901      
Active:               	True                     
QuantityUsed:         	1                        
Begins:               	11/19/2011               
Expires:              	01/18/2013   


IN SUMMARY...
THE GOOD...
1. The overlapping time for entitlements no longer makes the system valid/green today.
2. The overall system status now remains yellow/partial despite the successful bind to a future subscription that provides for the same installed product.
3. The Start/End dates on the installed product properly span the two entitlements.
THE BAD...
1. The status of the installed product is now "Future Subscription" when it should remain "Partially Subscribed"
THE UGLY...
1. Because there are two entitlements contributing to the same installed product's compliance, the one whose valid date range overlaps today should trump the status contributed by the entitlement(s) that do not overlap today.  In this example, the status should therefore remain "Partially Subscribed".

Yes - the original bug is VERIFIED, but the issues above are so closely tied to the test scenario, I'd like to keep it tied to this bug...

Moving Back to NEW/FailedQA

Comment 3 Michael Stead 2011-12-21 18:25:25 UTC
This *may* have been addressed in another bug fix. I will confirm and update as required.

Comment 4 Michael Stead 2011-12-21 18:33:14 UTC
Verified that this has not been addressed. Keeping as is.

Comment 7 RHEL Program Management 2012-07-10 07:57:25 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 8 RHEL Program Management 2012-07-11 02:08:45 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 9 RHEL Program Management 2012-12-14 08:48:19 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 10 Carter Kozak 2013-09-19 19:45:51 UTC
This seems to have diverged a bit from the original bug.  This fixes the overlap filter when the date is not today.

commit ae8f735be0fc75ce34c2973cf4fa3ade150ecd50
Author: ckozak <ckozak>
Date:   Fri Sep 13 09:32:52 2013 -0400

    remove call on filter change, use None instead of now

commit 5830d62d3471092e3f69ab2f37b17e3f1f26e6b7
Author: ckozak <ckozak>
Date:   Mon Sep 9 14:51:34 2013 -0400

    767754: overlap filter ondate

Comment 13 Sharath Dwaral 2013-11-08 19:18:03 UTC
Created attachment 821743 [details]
overlapping subscriptions

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.31-1
subscription-manager: 1.10.6-1.el7
python-rhsm: 1.10.6-1.el7


# subscription-manager list --installed 
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS for x86_64 Bits
Product ID:     100000000000002
Version:        3.11
Arch:           x86_64
Status:         Not Subscribed
Status Details: Not covered by a valid subscription.
Starts:         
Ends:           

# subscription-manager list --avail | egrep "Awesome OS for x86_64 *$" -A7
Subscription Name: Stackable with Awesome OS for x86_64
Provides:          Stackable with Awesome OS for x86_64 Bits
SKU:               stackable-with-awesomeos-x86_64
Contract:          2
Pool ID:           8a8d01e0423801710142380201620a14
Available:         5
Suggested:         1
Service Level:     
--
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          2
Pool ID:           8a8d01e0423801710142380205f50b4f
Available:         5
Suggested:         5
Service Level:     
--
Subscription Name: Stackable with Awesome OS for x86_64
Provides:          Stackable with Awesome OS for x86_64 Bits
SKU:               stackable-with-awesomeos-x86_64
Contract:          3
Pool ID:           8a8d01e0423801710142380201110a00
Available:         9
Suggested:         1
Service Level:     
--
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          3
Pool ID:           8a8d01e0423801710142380205440b16
Available:         9
Suggested:         9
Service Level:     

# subscription-manager subscribe --pool 8a8d01e0423801710142380205f50b4f --quantity 1
Successfully attached a subscription for: Awesome OS for x86_64

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS for x86_64 Bits
Product ID:     100000000000002
Version:        3.11
Arch:           x86_64
Status:         Partially Subscribed
Status Details: Only covers 1 of 20 sockets.
Starts:         11/07/2013
Ends:           11/07/2014

# subscription-manager list --avail --ondate 2014-07-12 | egrep "Awesome OS for x86_64 *$" -A7
Subscription Name: Stackable with Awesome OS for x86_64
Provides:          Stackable with Awesome OS for x86_64 Bits
SKU:               stackable-with-awesomeos-x86_64
Contract:          2
Pool ID:           8a8d01e0423801710142380201620a14
Available:         5
Suggested:         1
Service Level:     
--
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          2
Pool ID:           8a8d01e0423801710142380205f50b4f
Available:         4
Suggested:         4
Service Level:     
--
Subscription Name: Stackable with Awesome OS for x86_64
Provides:          Stackable with Awesome OS for x86_64 Bits
SKU:               stackable-with-awesomeos-x86_64
Contract:          3
Pool ID:           8a8d01e0423801710142380201110a00
Available:         9
Suggested:         1
Service Level:     
--
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          3
Pool ID:           8a8d01e0423801710142380205440b16
Available:         9
Suggested:         9
Service Level:     

[root@sharath-70server ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS for x86_64 Bits
Product ID:     100000000000002
Version:        3.11
Arch:           x86_64
Status:         Partially Subscribed
Status Details: Only covers 1 of 20 sockets.
Starts:         11/07/2013
Ends:           10/28/2015

[root@sharath-70server ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          2
Account:           12331131231
Serial:            126733019683233352
Pool ID:           8a8d01e0423801710142380205f50b4f
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    Only covers 1 of 20 sockets.
Starts:            11/07/2013
Ends:              11/07/2014
System Type:       Physical

Subscription Name: Awesome OS for x86_64
Provides:          Awesome OS for x86_64 Bits
SKU:               awesomeos-x86_64
Contract:          3
Account:           12331131231
Serial:            3308080455578081213
Pool ID:           8a8d01e0423801710142380204330ac2
Active:            False
Quantity Used:     15
Service Level:     
Service Type:      
Status Details:    
Starts:            10/28/2014
Ends:              10/28/2015
System Type:       Physical


The status of the installed product is now "Partially Subscribed" 

There are two entitlements contributing to the same installed product's compliance, the one whose valid date range overlaps today trumps the status contributed by the entitlement(s) that do not overlap today.  In this example, the status therefore remain "Partially Subscribed".

See attachment for GUI verification

VERIFIED

Comment 14 Ludek Smid 2014-06-13 13:27:27 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.