Bug 639434

Summary: attempts to unregister a person consumer while his system consumers are subscribed should be blocked
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: medium Docs Contact:
Priority: low    
Version: 0.5CC: bkearney, whayutin
Target Milestone: ---Keywords: QA-Closed
Target Release: ---   
Hardware: All   
OS: Solaris   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-23 21:51:29 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: 639436    

Description John Sefler 2010-10-01 18:20:33 UTC
Description of problem:
After client1 has registered as type=person and has subscribed to RHEL Personal to open its subpool and client2 has consumed the  RHEL Personal bits, attempts to unregister the person consumer while the subpool bits are being consumed should get blocked with:

"Cannot unregister due to outstanding entitlement: {#}"


Version-Release number of selected component (if applicable):
[root@jsefler-f12-candlepin ruby]# git show-ref master
356a3bcea08bfee15f7089757ddbe72295d4179e refs/heads/master
356a3bcea08bfee15f7089757ddbe72295d4179e refs/remotes/origin/master
[root@jsefler-rhel6-client01 ~]# rpm -q subscription-manager
subscription-manager-0.83-1.git.26.31d0d84.fc12.i386


How reproducible:


Steps to Reproduce:

ON CLIENT 1...
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli register --username=testuser1 --password=password --type=person
19bff816-4600-4a79-b0ee-da13d7d398cc testuser1
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	RHEL Personal            
ProductId:         	RH09XYU34                
PoolId:            	ff8080812b672058012b6721b85d00cd
Quantity:          	10                       
Expires:           	2011-09-30               

[root@jsefler-rhel6-client01 ~]# subscription-manager-cli subscribe --pool=ff8080812b672058012b6721b85d00cd
[root@jsefler-rhel6-client01 ~]#


ON CLIENT 2...
[root@jsefler-rhel6-client02 ~]# subscription-manager-cli register --username=testuser1 --password=password --type=system
8e373362-e9ec-4aa0-86e4-0955a48c854b testuser1
[root@jsefler-rhel6-client02 ~]# subscription-manager-cli list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	RHEL Personal Bits       
ProductId:         	1144                     
PoolId:            	ff8080812b672058012b68e0db880265
Quantity:          	unlimited                
Expires:           	2011-09-30               

[root@jsefler-rhel6-client02 ~]# subscription-manager-cli subscribe --pool=ff8080812b672058012b68e0db880265


BACK ON CLIENT 1...
[root@jsefler-rhel6-client01 ~]# subscription-manager-cli unsubscribe --all
[root@jsefler-rhel6-client01 ~]# 

^^^^ REGRESSION At this point, the unregister used to get blocked with this
Cannot unregister due to outstanding entitlement: {#}


This is the expected behavior based on prior bugzilla comments:
https://bugzilla.redhat.com/show_bug.cgi?id=624063#c4
https://bugzilla.redhat.com/show_bug.cgi?id=624063#c2

Comment 1 Ajay Kumar Nadathur Sreenivasan 2010-11-18 15:52:59 UTC
Fix in 
 candlepin            : 0aeff3553ea3630e9e04e6aeae365b29e3fd008e
 subscription-manager : 21b1cccdcddb410c125dc36607c48418bfcd94c5

behaviour of candlepin/subscription manager after the fix:


CLIENT1:
---------
[ajay@garuda-rh src{master}]$ alias sm='sudo ./subscription-manager-cli'
[ajay@garuda-rh src{master}]$ sm register --username admin --password admin --type=person --force
a8c6ed00-288e-479a-8ddf-a3bb0b447f17 admin
[ajay@garuda-rh src{master}]$ sm list --ava
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:            RHEL Personal            
ProductId:              RH09XYU34                
PoolId:                 ff8080812c5f8cbc012c5f8d84ed0188
Quantity:               5                        
Expires:                2011-11-17               


ProductName:            RHEL Personal            
ProductId:              RH09XYU34                
PoolId:                 ff8080812c5f8cbc012c5f8d850f018a
Quantity:               10                       
Expires:                2011-11-17               


ProductName:            RHEL Personal            
ProductId:              RH09XYU34                
PoolId:                 ff8080812c5f8cbc012c5f8d8538018c
Quantity:               15                       
Expires:                2012-11-06               

[ajay@garuda-rh src{master}]$ sm subscribe --pool ff8080812c5f8cbc012c5f8d84ed0188
[ajay@garuda-rh src{master}]$ sm list --con
+-------------------------------------------+
    Consumed Product Subscriptions
+-------------------------------------------+


ProductName:            RHEL Personal            
ContractNumber:         39                       
AccountNumber:          12331131231              
SerialNumber:           1129009424633831         
Active:                 True                     
Begins:                 2010-11-17               
Expires:                2011-11-17               

[ajay@garuda-rh src{master}]$ sm unsubscribe --all
Cannot unbind due to outstanding sub-pool entitlements in ff8080812c5f8cbc012c5f9bf99b09a7
[ajay@garuda-rh src{master}]$ sm unsubscribe --serial 1129009424633831
Cannot unbind due to outstanding sub-pool entitlements in ff8080812c5f8cbc012c5f9bf99b09a7
[ajay@garuda-rh src{master}]$ sm unregister
Cannot unregister due to outstanding sub-pool entitlements in ff8080812c5f8cbc012c5f9bf99b09a7

CLIENT 2:
---------
[ajay@localhost src{master}]$ sudo ./subscription-manager-cli register --username admin --password admin --type=system --force
56966b51-828e-4f3c-8b33-5026d810381c admin

[ajay@localhost src{master}]$ sm list --available | grep -A 3 Personal

ProductName:            RHEL Personal Bits       
ProductId:              1144                     
PoolId:                 ff8080812c5f8cbc012c5f9bf9a809a8
Quantity:               unlimited                
--
ProductName:            RHEL Personal SVC        
ProductId:              1                        
PoolId:                 ff8080812c5f8cbc012c5f8d846f0182
Quantity:               5                        
--
ProductName:            RHEL Personal SVC        
ProductId:              1                        
PoolId:                 ff8080812c5f8cbc012c5f8d849a0184
Quantity:               10                       
--
ProductName:            RHEL Personal SVC        
ProductId:              1                        
PoolId:                 ff8080812c5f8cbc012c5f8d84c30186
Quantity:               15                       
[ajay@localhost src{master}]$ sm subscribe --pool ff8080812c5f8cbc012c5f9bf9a809a8

Comment 2 John Sefler 2010-11-29 20:30:35 UTC
VERIFICATION....
[root@jsefler-onprem01 ~]# rpm -q subscription-manager
subscription-manager-0.93.2-1.git.19.5614af0.fc12.i386
[root@jsefler-onprem02 ~]# rpm -q subscription-manager
subscription-manager-0.93.2-1.git.19.5614af0.fc12.i386



ON CLIENT 1...
[root@jsefler-onprem01 ~]# subscription-manager register --username=testuser1 --password=password --type=person
5428909d-ee58-4c2c-9671-363f21e916af testuser1
[root@jsefler-onprem01 ~]# subscription-manager list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+


ProductName:       	RHEL Personal            
ProductId:         	RH09XYU34                
PoolId:            	ff8080812c9942fa012c9943df5c018a
Quantity:          	10                       
Expires:           	2011-11-28               


ProductName:       	RHEL Personal            
ProductId:         	RH09XYU34                
PoolId:            	ff8080812c9942fa012c9943df6c018c
Quantity:          	5                        
Expires:           	2011-11-28               

[root@jsefler-onprem01 ~]# subscription-manager subscribe --pool=ff8080812c9942fa012c9943df5c018a




ON CLIENT 2...
[root@jsefler-onprem02 ~]# subscription-manager register --username=testuser1 --password=password --type=system
f534b05f-a342-4ea4-b5ab-3b43245e12b3 testuser1
[root@jsefler-onprem02 ~]# subscription-manager list --available | grep -A5 "Bits"
ProductName:       	RHEL Personal Bits       
ProductId:         	1144                     
PoolId:            	ff8080812c9942fa012c994cf1e602a2
Quantity:          	unlimited                
Expires:           	2011-11-28               

[root@jsefler-onprem02 ~]# subscription-manager subscribe --pool=ff8080812c9942fa012c994cf1e602a2



ON CLIENT 1...
[root@jsefler-onprem01 ~]# subscription-manager unsubscribe --all
Cannot unbind due to outstanding sub-pool entitlements in ff8080812c9942fa012c994cf1da02a1
[root@jsefler-onprem01 ~]# subscription-manager unregister
Cannot unregister due to outstanding sub-pool entitlements in ff8080812c9942fa012c994cf1da02a1