Bug 740788

Summary: Getting error with quantity subscribe using subscription-assistance page .
Product: Red Hat Enterprise Linux 5 Reporter: spandey
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.7CC: bkearney, dgoodwin, jmolet, jsefler, kbanerje, spandey, syeghiay
Target Milestone: rc   
Target Release: 5.8   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 0.98.5-1.el5 Doc Type: Bug Fix
Doc Text:
No description necessary
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-21 06:41:35 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: 715031, 769266    
Attachments:
Description Flags
error screenshot
none
subscription manager assistant claims not enough free entitlements when two pools are needed to satisfy the quantity none

Description spandey 2011-09-23 10:49:05 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:
3/3

Prerequisite:
Rhel6.2 client with following rpm and product cert for  “Awesome od for x86_64 Bits”
[root@rhserver6 ~]# rpm -qa | grep subscription-manager

subscription-manager-gnome-0.97.1-1.git.48.8c519a3.el6.x86_64

subscription-manager-0.97.1-1.git.48.8c519a3.el6.x86_64

subscription-manager-firstboot-0.97.1-1.git.48.8c519a3.el6.x86_64

[root@rhserver6 ~]# 

Candlepin : on-premises 

Steps to verify : 
Generate “Awesome od for x86_64 Bits” activation key with 5 quantity .
Register client using above activation key.
Change client cpu facts for 6 cpu 
Unsubscribe “Awesome od for x86_64 Bits” and update certificate using subscription assistance page .

Expected Result : 
“Awesome od for x86_64 Bits” should resubscribe with 6 quantity . 

Actual Result : 
Subscribe process is getting  failed with error “No free entitlement available”

Note : In this scenario process is using first contract which contains only 5 quantity .
Scenario is working with 5 quantity and getting failed with 6 quantity.



Additional info:
Attached screenshot Selection_009.png

Comment 1 spandey 2011-09-23 11:09:34 UTC
Created attachment 524590 [details]
error screenshot

Comment 2 Devan Goodwin 2011-09-23 13:11:44 UTC
Probably a dupe of bug #740377 but I'm not confident enough to close this as duplicate. Yellow detection is currently very broken.

Comment 3 James Bowes 2011-09-30 19:11:05 UTC
Reproducable on master branch by putting the awesome os for 64 bits product cert in your certs dir, and using subscription assistant, but bumping the quantity up to 6 before hitting subscribe. No need to use an activation key or override facts.

Whats going on here is we have two pools that provide the same product, one with 5 available subs, and the other with 10. Candlepin is trying to get them all from the pool that only has 5 in it, so it fails.

This is fixed in the healing branch, which will be merged to master soon enough.

Comment 4 John Sefler 2011-10-13 22:17:38 UTC
Created attachment 528117 [details]
subscription manager assistant claims not enough free entitlements when two pools are needed to satisfy the quantity

STILL FAILING....

[root@jsefler-onprem-62server ~]# rpm -q subscription-manager
subscription-manager-0.96.14-1.git.3.b926c9e.el6.x86_64
[root@jsefler-onprem-62candlepin candlepin]# git branch
  0.3
* master
[root@jsefler-onprem-62candlepin candlepin]# git show-ref | grep master
2fe099e481ebfca893b5384a8e1d1e6de8973a70 refs/heads/master
2fe099e481ebfca893b5384a8e1d1e6de8973a70 refs/remotes/origin/master


[root@jsefler-onprem-62server ~]# subscription-manager facts --list | grep cpu.socket
cpu.cpu_socket(s): 6
lscpu.cpu_socket(s): 6
[root@jsefler-onprem-62server ~]# ls /etc/pki/product/
100000000000002.pem
[root@jsefler-onprem-62server ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: f1d934a4-8ced-4aba-8d6d-f385d642d34b 
[root@jsefler-onprem-62server ~]# subscription-manager list --avail | grep awesomeos-x86_64 -B1 -A5 | grep Yes -A2 -B4
ProductName:       	Awesome OS for x86_64    
ProductId:         	awesomeos-x86_64         
PoolId:            	8a90f8c632f985e40132f9877cfc0552
Quantity:          	5                        
Multi-Entitlement: 	Yes                      
Expires:           	10/10/2012               
MachineType:       	physical                 
--
ProductName:       	Awesome OS for x86_64    
ProductId:         	awesomeos-x86_64         
PoolId:            	8a90f8c632f985e40132f9877cce0547
Quantity:          	10                       
Multi-Entitlement: 	Yes                      
Expires:           	10/10/2012               
MachineType:       	physical   


^^^ THESE ARE THE TWO MULTI-ENTITLEMENT POOLS THAT PROVIDE THE 15 QUANTITY SEEN IN THE SCREENSHOT

Switch to the subscription-manager-gui and attempt to use the Subscription Assistant.  SEE THE ERROR IN THE SCREENSHOT.

moving back to NEW/FailedQA

Comment 5 John Sefler 2011-10-13 22:23:01 UTC
Note for retesting...  Also configure the system with 12 sockets instead of 6 to force the subscription assistant to consume from two pools instead of possibly consuming from one pool (the one with a quantity of 10, which is what candlepin should have done in the scenario outlined in comment 4).

Comment 6 John Sefler 2011-10-13 22:28:12 UTC
(In reply to comment #3)
> .... No need to use an activation key or override facts.

Agreed. Manually bumping the quantity to 6 and to 12 are two good re-create tests.

Comment 7 James Bowes 2011-10-14 16:50:56 UTC
this new (at least to me) issue is client side, i'm afraid. the client attempts to bind by entitlement pool rather than product. it only asks for entitlements from a single pool though, even if it should really be using more than one pool.

Comment 12 John Sefler 2011-12-07 18:10:53 UTC
Verifying Version...
[root@jsefler-onprem-5server ~]# rpm -q subscription-manager
subscription-manager-0.98.5-1.el5


Overriding my system's socket count...
[root@jsefler-onprem-5server ~]# vi /etc/rhsm/facts/sockets.facts 
[root@jsefler-onprem-5server ~]# cat /etc/rhsm/facts/sockets.facts
{"cpu.cpu_socket(s)": 8 , "lscpu.cpu_socket(s)": 8}
[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep cpu.socket
cpu.cpu_socket(s): 8
lscpu.cpu_socket(s): 8
[root@jsefler-onprem-5server ~]#

[root@jsefler-onprem-5server ~]# ls /etc/pki/product/
100000000000002_.pem  69.pem
[root@jsefler-onprem-5server ~]# subscription-manager register --username testuser1 --password password --org admin
The system has been registered with id: 717a8653-4ea7-4694-934a-7b42d5c1c84e 
[root@jsefler-onprem-5server ~]# subscription-manager list --avail | grep awesomeos-x86_64 -B1 -A5 | grep Yes -A2 -B4
ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f85734160df30134160ed5a402ac
Quantity:             	10                       
Multi-Entitlement:    	Yes                      
Expires:              	01/04/2013               
MachineType:          	physical                 
--
ProductName:          	Awesome OS for x86_64    
ProductId:            	awesomeos-x86_64         
PoolId:               	8a90f85734160df30134160ed5cd02b8
Quantity:             	5                        
Multi-Entitlement:    	Yes                      
Expires:              	01/04/2013               
MachineType:          	physical                 
[root@jsefler-onprem-5server ~]# 

Demonstrating that product awesomeos-x86_64 covers 1 socket...
[root@jsefler-onprem-5server ~]# curl -k -u testuser1:password https://jsefler-f14-5candlepin.usersys.redhat.com:8443/candlepin/products/awesomeos-x86_64 | python -m simplejson/tool | grep sockets -A2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1183    0  1183    0     0  22944      0 --:--:-- --:--:-- --:--:--     0
            "name": "sockets", 
            "updated": "2011-12-07T01:06:24.749+0000", 
            "value": "1"
[root@jsefler-onprem-5server ~]# 



Switching to the subscription-manager-gui and starting up the Subscription Assistant...
Verified that for the "Awesome OS for x86_64 Bits, the default quantity presented was 8 (exactly enough to cover my system's sockets) and pressed "Subscribe"

Now in the cli...
[root@jsefler-onprem-5server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+

ProductName:          	Awesome OS for x86_64 Bits
ContractNumber:       	23                       
AccountNumber:        	12331131231              
SerialNumber:         	7796071529114781486      
Active:               	True                     
QuantityUsed:         	8                        
Begins:               	11/05/2011               
Expires:              	01/04/2013  

^^^^
THE NEEDED/EXPECTED QUANTITY OF 8 WAS CONSUMED FROM A SINGLE POOL THAT CONTAINED ENOUGH ENTITLEMENTS FOR MY 8 SOCKET SYSTEM.  THE SELECTION OF THIS POOL DID NOT HAPPEN IN comment 4.  THIS VERIFICATION IS GOOD!

Now let's try a harder test as suggested in comment 5 - setting the socket count such that the entitlements granted must come from multiple pools...


[root@jsefler-onprem-5server ~]# subscription-manager unsubscribe --all
[root@jsefler-onprem-5server ~]# vi /etc/rhsm/facts/sockets.facts 
[root@jsefler-onprem-5server ~]# cat /etc/rhsm/facts/sockets.facts
{"cpu.cpu_socket(s)": 12 , "lscpu.cpu_socket(s)": 12}
[root@jsefler-onprem-5server ~]# subscription-manager facts --list | grep cpu_socket
cpu.cpu_socket(s): 12
lscpu.cpu_socket(s): 12
[root@jsefler-onprem-5server ~]# subscription-manager facts --update
Successfully updated the system facts.


Restarting the subscription-manager-gui and starting up the Subscription Assistant...
This time the suggested quantity correctly defaulted to 12 "Awesome OS for x86_64" subscriptions as expected.  This is good. And then I clicked "Subscribe" and no error dialogs were presented as expected.
 
Now in the cli...
[root@jsefler-onprem-5server ~]# subscription-manager list --consumed
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+

ProductName:          	Awesome OS for x86_64 Bits
ContractNumber:       	23                       
AccountNumber:        	12331131231              
SerialNumber:         	4442474968076001781      
Active:               	True                     
QuantityUsed:         	10                       
Begins:               	11/05/2011               
Expires:              	01/04/2013               

ProductName:          	Awesome OS for x86_64 Bits
ContractNumber:       	22                       
AccountNumber:        	12331131231              
SerialNumber:         	2954620087294091371      
Active:               	True                     
QuantityUsed:         	2                        
Begins:               	11/05/2011               
Expires:              	01/04/2013               

[root@jsefler-onprem-5server ~]# 

^^^ VERIFIED! THE NEEDED QUANTITY WAS CONSUMED FROM MULTIPLE POOLS.

Moving to VERIFIED

Comment 13 William Poteat 2012-01-20 20:08:39 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No description necessary

Comment 14 errata-xmlrpc 2012-02-21 06:41:35 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-2012-0154.html