Bug 1026422

Summary: Guest attach a new subscription on the host ignoring already attached host subscription
Product: [Community] Candlepin Reporter: Rehana <redakkan>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: bkearney, fsharath, jsefler, spandey
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-29 19:05:02 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 Rehana 2013-11-04 15:38:50 UTC
Description of problem:
Observed that guest is not properly filtering  already attached subscriptions on the host, hence host got healed and attached a different subscription 

Version-Release number of selected component (if applicable):
subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.31-1
subscription-manager: 1.9.5-1.el6
python-rhsm: 1.9.4-1.el6

How reproducible:
4/4

Steps to Reproduce:
1.Register and attach a subscription (having virt-limit attribute) on the physical machine
[root@rehanatestmachine ~]# subscription-manager attach --pool 8ac6a36242226ab60142226b254208f8
Successfully attached a subscription for: Awesome OS with up to 4 virtual guests
[root@rehanatestmachine ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          2
Account:           12331131231
Serial:            1155550985739235197
Pool ID:           8ac6a36242226ab60142226b254208f8
Active:            True
Quantity Used:     1
Service Level:    
Service Type:      
Status Details:    
Starts:            11/04/2013
Ends:              11/04/2014
[root@rehanatestmachine ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

2.On the guest, install a product  which has a virt-limit subscriptions
3.And register with auto-attach option
[root@localhost ~]# subscription-manager register --auto-attach
Username: admin
Password:
Organization: donaldduck
The system has been registered with ID: ed21f697-bcea-4734-82c1-b97628ce541b
Installed Product Current Status:
Product Name: Awesome OS Server Bits
Status:       Subscribed
 
[root@localhost ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with unlimited virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-unlimited
Contract:          2
Account:           12331131231
Serial:            5261767099316102488
Pool ID:           8ac6a36242226ab60142237f546617cb
Active:            True
Quantity Used:     1
Service Level:    
Service Type:      
Status Details:    
Starts:            11/04/2013
Ends:              11/04/2014
System Type:       Virtual

4.update on host
[root@rehanatestmachine ~]# /usr/libexec/rhsmcertd-worker
Updating entitlement certificates & repositories
6 updates required
done
[root@rehanatestmachine ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with unlimited virtual guests --> new subscription
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-unlimited
Contract:          2
Account:           12331131231
Serial:            3121764710303730666
Pool ID:           8ac6a36242226ab60142226b250f08e6
Active:            True
Quantity Used:     1
Service Level:    
Service Type:      
Status Details:    
Starts:            11/04/2013
Ends:              11/04/2014
 
Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          2
Account:           12331131231
Serial:            1155550985739235197
Pool ID:           8ac6a36242226ab60142226b254208f8
Active:            True
Quantity Used:     1
Service Level:    
Service Type:      
Status Details:    
Starts:            11/04/2013
Ends:              11/04/2014


Actual results:
Observed that a new subscription was attached on the host,even though a  virt_limit  subscriptions was already available on the guest

Expected results:
Guest should consider already available  virt_limit  subscription , if it doesnt exists then only it should heal the physical machine with virt-limit subscripton 

Additional info:

Comment 1 Carter Kozak 2013-11-05 18:26:27 UTC
commit c907ece127cd42d24d702329145c55f22ac1ff7e
Author: ckozak <ckozak>
Date:   Wed Oct 30 16:07:05 2013 -0400

    1025044: fix cores pre-entitlement calculation
    
    cores pre_entitlement check was not properly multiplying
    cores_per_cpu by sockets. This caused us not to filter
    some subscriptions from list available that we should.
    
    Added tests for other pre_entitlement attribute warnings
    as well

Comment 2 Rehana 2014-01-28 12:51:22 UTC
Retested on,
subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.2-1
subscription-manager: 1.10.11-2.el7
python-rhsm: 1.10.11-2.el7

steps:
on the host, attached subscription 
[root@ibm-hs23-01 test]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          2
Account:           12331131231
Serial:            1201828578316267730
Pool ID:           8ac6a36243d8692a0143d869e3da0b79
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Multi-Entitleable
Starts:            01/27/2014
Ends:              01/27/2015
System Type:       Physical

on the guest
[root@dhcp71-22 ~]# subscription-manager register --auto-attach
Username: admin
Password: 
Organization: donaldduck
The system has been registered with ID: 2177fb9c-2cd6-4642-aaf3-a1025157fa21 
Installed Product Current Status:
Product Name: Awesome OS Server Bits
Status:       Subscribed

[root@dhcp71-22 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          2
Account:           12331131231
Serial:            4405224030781382986
Pool ID:           8ac6a36243d8692a0143d8c2c9121736
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Multi-Entitleable
Starts:            01/27/2014
Ends:              01/27/2015
System Type:       Virtual

cert updated on the host

[root@ibm-hs23-01 test]# /usr/libexec/rhsmcertd-worker
Updating entitlement certificates & repositories
5 updates required
done
[root@ibm-hs23-01 test]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          2
Account:           12331131231
Serial:            1201828578316267730
Pool ID:           8ac6a36243d8692a0143d869e3da0b79
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Multi-Entitleable
Starts:            01/27/2014
Ends:              01/27/2015
System Type:       Physical


Observed that now the guest attached the sub-pool subscription which is already available on the guest.

Moving the bug to "verified"

Comment 4 Bryan Kearney 2014-09-29 19:05:02 UTC
These bugs were fixed during 7.0 but not moved to CLOSED. They have been delivered