Bug 983193

Summary: Order->Quantity and Order->Virt Limit reported by rct cat-cert for an entitlement from a subpool feel wrong
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: alikins, bkearney, ckozak, dgoodwin, jesusr, jgalipea, wpoteat
Target Milestone: rc   
Target Release: 7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:49:13 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: 863175    

Description John Sefler 2013-07-10 16:55:08 UTC
Description of problem:
The quantities listed as available for generated subpools are often unlimited.  However after attaching an entitlement from the pool and running it through rct cat-cert, the report will show the quantity from the parent pool rather than the subpool.  This feels wrong especially for the case of a DataCenter SKU where the Name of the Order will show the name of the derivedProduct.  Nevertheless, in the example below, the Quantity reported feels like it should be "Unlimited" and the Virt Limit was left blank when I think it should report the virt_limit attribute from the pool (see Additional Info for the pool's json).


Version-Release number of selected component (if applicable):
[root@jsefler-5 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.16-1
subscription-manager: 1.8.11-1.el5
python-rhsm: 1.8.12-1.el5


How reproducible:


Steps to Reproduce:
Using candlepin deployed with the TESTDATA...
[root@jsefler-5 ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with unlimited virtual guests
SKU:               awesomeos-virt-unlimited
Pool ID:           8a90f8203fc4ca73013fc4cc6c650759
Quantity:          Unlimited
Service Level:     
Service Type:      
Multi-Entitlement: No
Ends:              07/08/2014
System Type:       Virtual

[root@jsefler-5 ~]# subscription-manager attach --pool 8a90f8203fc4ca73013fc4cc6c650759
Successfully attached a subscription for: Awesome OS with unlimited virtual guests

[root@jsefler-5 ~]# rct cat-cert --no-content /etc/pki/entitlement/4771208844300953895.pem

+-------------------------------------------+
	Entitlement Certificate
+-------------------------------------------+

Certificate:
	Path: /etc/pki/entitlement/4771208844300953895.pem
	Version: 3.2
	Serial: 4771208844300953895
	Start Date: 2013-07-09 00:00:00+00:00
	End Date: 2014-07-09 00:00:00+00:00
	Pool ID: 8a90f8203fc4ca73013fc4cc6c650759

Subject:
	CN: 8a90f8203fc4ca73013fc95b3d471cf5

Issuer:
	C: US
	CN: jsefler-f14-candlepin.usersys.redhat.com
	L: Raleigh

Product:
	ID: 37060
	Name: Awesome OS Server Bits
	Version: 6.1
	Arch: ALL
	Tags: 

Order:
	Name: Awesome OS with unlimited virtual guests
	Number: order-8675309
	SKU: awesomeos-virt-unlimited
	Contract: 145
	Account: 12331131231
	Service Level: 
	Service Type: 
	Quantity: 10       <========= Expected "Unlimited" (10 was the parent pool)
	Quantity Used: 1
	Socket Limit: 
	RAM Limit: 
	Core Limit: 
	Virt Limit:        <========= Expected 0 since the pool's json attribute value is 0
	Virt Only: True
	Subscription: 
	Stacking ID: 
	Warning Period: 0
	Provides Management: False

[root@jsefler-5 ~]# 




Additional info:
[root@jsefler-5 ~]# curl -k --stderr /dev/null -u testuser1:password https://jsefler-f14-candlepin.usersys.redhat.com:8443/candlepin/pools/8a90f8203fc4ca73013fc4cc6c650759 | python -m simplejson/tool
{
    "accountNumber": "12331131231", 
    "activeSubscription": true, 
    "attributes": [
        {
            "created": "2013-07-09T18:58:18.863+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c6f075a", 
            "name": "requires_consumer_type", 
            "updated": "2013-07-09T18:58:18.863+0000", 
            "value": "system"
        }, 
        {
            "created": "2013-07-09T18:58:18.863+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c70075b", 
            "name": "virt_limit", 
            "updated": "2013-07-09T18:58:18.863+0000", 
            "value": "0"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c70075d", 
            "name": "pool_derived", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "true"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c70075c", 
            "name": "virt_only", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "true"
        }
    ], 
    "calculatedAttributes": {}, 
    "consumed": 1, 
    "contractNumber": "145", 
    "created": "2013-07-09T18:58:18.853+0000", 
    "derivedProductAttributes": [], 
    "derivedProductId": null, 
    "derivedProductName": null, 
    "derivedProvidedProducts": [], 
    "endDate": "2014-07-09T00:00:00.000+0000", 
    "exported": 0, 
    "href": "/pools/8a90f8203fc4ca73013fc4cc6c650759", 
    "id": "8a90f8203fc4ca73013fc4cc6c650759", 
    "orderNumber": "order-8675309", 
    "owner": {
        "displayName": "Admin Owner", 
        "href": "/owners/admin", 
        "id": "8a90f8203fc4ca73013fc4ca93080002", 
        "key": "admin"
    }, 
    "productAttributes": [
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c70075e", 
            "name": "virt_limit", 
            "productId": "awesomeos-virt-unlimited", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "unlimited"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c70075f", 
            "name": "type", 
            "productId": "awesomeos-virt-unlimited", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "MKT"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c700760", 
            "name": "arch", 
            "productId": "awesomeos-virt-unlimited", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c700761", 
            "name": "variant", 
            "productId": "awesomeos-virt-unlimited", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "ALL"
        }, 
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c700762", 
            "name": "version", 
            "productId": "awesomeos-virt-unlimited", 
            "updated": "2013-07-09T18:58:18.864+0000", 
            "value": "6.1"
        }
    ], 
    "productId": "awesomeos-virt-unlimited", 
    "productName": "Awesome OS with unlimited virtual guests", 
    "providedProducts": [
        {
            "created": "2013-07-09T18:58:18.864+0000", 
            "id": "8a90f8203fc4ca73013fc4cc6c700763", 
            "productId": "37060", 
            "productName": "Awesome OS Server Bits", 
            "updated": "2013-07-09T18:58:18.864+0000"
        }
    ], 
    "quantity": -1, 
    "restrictedToUsername": null, 
    "sourceEntitlement": null, 
    "startDate": "2013-07-09T00:00:00.000+0000", 
    "subscriptionId": "8a90f8203fc4ca73013fc4cb9be7029a", 
    "subscriptionSubKey": "derived", 
    "updated": "2013-07-10T16:12:47.303+0000"
}

Comment 1 RHEL Program Management 2013-07-10 17:18:08 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 2 Adrian Likins 2013-07-10 18:13:49 UTC
We don't seem to ever populate the 'virt_limit' attribute when generated entitlement certs. 

Even if we did, the v3 client stuff doesn't populate the Order object with it, so I suspect we can just remove showing 'virt_limit' attribute in 'rct cat-cert'.

Comment 4 Adrian Likins 2013-07-22 20:37:59 UTC
commit 196c2ef2b598d13e817d82360b9201b79a290e70
Author: Adrian Likins <alikins>
Date:   Mon Jul 22 15:28:26 2013 -0400

    983193: remove unused 'Virt Limit' cat-cert field

Comment 6 John Sefler 2013-07-30 20:31:18 UTC
Moving back to NEW: Also need resolution on what the entitlement should report for Order->Quantity for an entitlement of a derivedProduct.

Comment 7 Devan Goodwin 2013-08-01 14:50:34 UTC
Server side bug, moving component and product.

Comment 10 William Poteat 2014-01-27 18:18:18 UTC
Confirmed correct in current release.

Master commit a4c8e23f003ae863449fb0a2f6a7830e44655e3f

Comment 11 John Sefler 2014-02-20 20:24:03 UTC
Verifying Version...
[root@jsefler-7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.3-1
subscription-manager: 1.10.14-2.el7
python-rhsm: 1.10.12-1.el7

[root@jsefler-7 ~]# subscription-manager list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with unlimited virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-unlimited
Contract:          4
Pool ID:           8a9087e344508780014450886bea108f
Available:         Unlimited
Suggested:         1
Service Level:     
Service Type:      
Subscription Type: Standard
Ends:              02/19/2015
System Type:       Virtual

[root@jsefler-7 ~]# subscription-manager attach --pool 8a9087e344508780014450886bea108f
Successfully attached a subscription for: Awesome OS with unlimited virtual guests

[root@jsefler-7 ~]# subscription-manager list --consumed | grep Serial
Serial:            14693411540664820

[root@jsefler-7 ~]# rct cat-cert --no-content /etc/pki/entitlement/14693411540664820.pem 

+-------------------------------------------+
	Entitlement Certificate
+-------------------------------------------+

Certificate:
	Path: /etc/pki/entitlement/14693411540664820.pem
	Version: 3.2
	Serial: 14693411540664820
	Start Date: 2014-02-20 00:00:00+00:00
	End Date: 2015-02-20 00:00:00+00:00
	Pool ID: 8a9087e344508780014450886bea108f

Subject:
	CN: 8a9087e344508780014450cd24331b56

Issuer:
	C: US
	CN: jsefler-f14-candlepin.usersys.redhat.com
	L: Raleigh

Product:
	ID: 37060
	Name: Awesome OS Server Bits
	Version: 6.1
	Arch: ALL
	Tags: 
	Brand Type: OS

Order:
	Name: Awesome OS with unlimited virtual guests
	Number: order-8675309
	SKU: awesomeos-virt-unlimited
	Contract: 4
	Account: 12331131231
	Service Level: 
	Service Type: 
	Quantity: Unlimited    <======= VERIFIED
	Quantity Used: 1
	Socket Limit: 
	RAM Limit: 
	Core Limit: 
	Virt Only: True
	Stacking ID: 
	Warning Period: 0
	Provides Management: False


VERIFIED: rct cat-cert report for Order>Virt Limit has been removed per comment 2
VERIFIED: Order>Quantity is unlimited which matches the originating list --available pool report

Comment 12 Ludek Smid 2014-06-13 10:49:13 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.