Bug 1141781 - End date of the subscription is not a appropriate when you attach a future subscription and then heal the system
Summary: End date of the subscription is not a appropriate when you attach a future su...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Chris "Ceiu" Rog
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel66
TreeView+ depends on / blocked
 
Reported: 2014-09-15 12:45 UTC by Rehana
Modified: 2015-05-14 14:52 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-13 16:19:17 UTC
Embargoed:


Attachments (Terms of Use)

Description Rehana 2014-09-15 12:45:49 UTC
Description of problem:


Version-Release number of selected component (if applicable):
]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.26-1
subscription management rules: 5.11
subscription-manager: 1.12.14-5.el6
python-rhsm: 1.12.5-2.el6


How reproducible:
3/3

Steps to Reproduce:
1.# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

2.Attach Partial subscriptions on the system

# subscription-manager attach --pool ff8080814859e808014859e8cf8f1719 --quantity=2
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)

]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            6012753760821495114
Pool ID:           ff8080814859e808014859e8cf8f1719
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    Only supports 2 of 10 sockets.
Subscription Type: Instance Based
Starts:            09/08/2014
Ends:              09/08/2015
System Type:       Physical

3.Attach a Future subscription on the system

# subscription-manager attach --pool ff8080814859e808014859e8ce66168d 
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)

# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            1621244346063134358
Pool ID:           ff8080814859e808014859e8ce66168d
Active:            False
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            08/29/2015
Ends:              08/28/2016
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            6012753760821495114
Pool ID:           ff8080814859e808014859e8cf8f1719
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    Only supports 2 of 10 sockets.
Subscription Type: Instance Based
Starts:            09/08/2014
Ends:              09/08/2015
System Type:       Physical

[root@ibm-hs21-12 product]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Partially Subscribed
Status Details: Only supports 2 of 10 sockets.
Starts:         09/08/2014
Ends:           08/28/2016   ----->> END date is correct now

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

4. Enabled auto-attach, wait for healing (~3mins) to complete

# subscription-manager auto-attach --enable
Auto-attach preference: enabled

# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            1621244346063134358
Pool ID:           ff8080814859e808014859e8ce66168d
Active:            False
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            08/29/2015
Ends:              08/28/2016
System Type:       Physical

Subscription Name: Awesome OS with up to 4 virtual guests
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-4
Contract:          0
Account:           12331131231
Serial:            6926995847070222334
Pool ID:           ff8080814859e808014859e8bcab0f0c
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Multi-Entitleable
Starts:            09/08/2014
Ends:              09/08/2015
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            6012753760821495114
Pool ID:           ff8080814859e808014859e8cf8f1719
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            09/08/2014
Ends:              09/08/2015
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            8174551229898676783
Pool ID:           ff8080814859e808014859e8cf8f1719
Active:            True
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            09/08/2014
Ends:              09/08/2015
System Type:       Physical

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Subscribed
Status Details: 
Starts:         09/08/2014
Ends:           09/08/2015  ---->> end date is changed back to Active   
subscription end date" , while future subscription is still present on the system

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Subscribed
Status Details: 
Starts:         09/08/2014
Ends:           09/08/2015


Actual results:
END DATE of Instance based subscription is set to  09/08/2015

Expected results:
END DAte of the subscription should consider the "Future subscriptions" END DATE if they are present ; In this case END date should be set to :08/28/2016

Additional info:

Comment 1 Chris "Ceiu" Rog 2014-10-07 16:25:27 UTC
I'm unable to reproduce the issue with the current test data/build. Are you still able to reproduce it? If so, can you also provide the exact subscriptions you're using so I can try to recreate the same initial state?

Thanks
-C

Comment 2 Rehana 2014-10-08 05:39:14 UTC
Yes, I am able to reproduce the issue. 

Tested version of candlepin

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.32-1
subscription management rules: 5.11
subscription-manager: 1.13.3-1.el7
python-rhsm: 1.13.2.1-2.el7

Please find the subscription details along with the detailed steps below

1) Installed products i had on the test machine

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:

2) Test machine is having 10 sockets, Attaching "Partial subscription"

# subscription-manager attach --pool ff80808148e479330148e479dc4c15d3 --quantity=2
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)

[root@dell-per620-02 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            1809226156361107733
Pool ID:           ff80808148e479330148e479dc4c15d3
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    Only supports 2 of 10 sockets.
Subscription Type: Instance Based
Starts:            10/05/2014
Ends:              10/05/2015
System Type:       Physical

3.List installed , after attaching ^ the subscription

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Partially Subscribed
Status Details: Only supports 2 of 10 sockets.
Starts:         10/05/2014
Ends:           10/05/2015

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         

4.listing Future subscrition 

# subscription-manager list --available --ondate=2016-06-06
Subscription Name: Awesome OS Super Hypervisor
Provides:          Awesome Hypervisor Bits
SKU:               awesomeos-super-hypervisor
Contract:          1
Pool ID:           ff80808148e479330148e479c9510d2b
Available:         15
Suggested:         1
Service Level:     
Service Type:      
Subscription Type: Stackable
Ends:              09/24/2016
System Type:       Physical


Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Pool ID:           ff80808148e479330148e479db5f1559
Available:         30
Suggested:         10
Service Level:     Standard
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              09/24/2016
System Type:       Physical


5. Attaching future subscription for "Instance based" product

# subscription-manager attach --pool ff80808148e479330148e479db5f1559
Successfully attached a subscription for: Awesome OS Instance Based (Standard Support)


6.Consumed list 

# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            1809226156361107733
Pool ID:           ff80808148e479330148e479dc4c15d3
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    Only supports 2 of 10 sockets.
Subscription Type: Instance Based
Starts:            10/05/2014
Ends:              10/05/2015
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            5035486301179352413
Pool ID:           ff80808148e479330148e479db5f1559
Active:            False
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            09/25/2015
Ends:              09/24/2016
System Type:       Physical

7.Installed list after attaching the future subscription

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Partially Subscribed
Status Details: Only supports 2 of 10 sockets.
Starts:         10/05/2014
Ends:           09/24/2016  ==>> Notice now the end date is updated with future 
                                 subscrption's "End date"

Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Not Subscribed
Status Details: Not supported by a valid subscription.
Starts:         
Ends:           


8.Heal the system; Set "autoAttachInterval" to 3 min, restart rhsmcertd ; wait for the heal process to complete

9.Consumed list after "heal"

# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            1809226156361107733
Pool ID:           ff80808148e479330148e479dc4c15d3
Active:            True
Quantity Used:     2
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            10/05/2014
Ends:              10/05/2015    ==> Intialy attached  partial subscription
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          1
Account:           12331131231
Serial:            5035486301179352413
Pool ID:           ff80808148e479330148e479db5f1559
Active:            False
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            09/25/2015
Ends:              09/24/2016 ==> Future subscription
System Type:       Physical

Subscription Name: Awesome OS Instance Based (Standard Support)
Provides:          Awesome OS Instance Server Bits
SKU:               awesomeos-instancebased
Contract:          0
Account:           12331131231
Serial:            3643148307552384103
Pool ID:           ff80808148e479330148e479ddb01695
Active:            True
Quantity Used:     8
Service Level:     Standard
Service Type:      L1-L3
Status Details:    
Subscription Type: Instance Based
Starts:            10/05/2014
Ends:              10/05/2015 ==>Subscription attached by "heal" process
System Type:       Physical

Subscription Name: Awesome OS Virtual Datacenter
Provides:          Awesome OS Server Bits
SKU:               awesomeos-virt-datacenter
Contract:          1
Account:           12331131231
Serial:            7818449199451944969
Pool ID:           ff80808148e479330148e479c7430c4f
Active:            True
Quantity Used:     1
Service Level:     
Service Type:      
Status Details:    
Subscription Type: Standard
Starts:            10/05/2014
Ends:              10/05/2015 ==>Subscription attached by "heal" process for 
                              the other installed product product
System Type:       Physical

10. List --installed 

# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Awesome OS Instance Server Bits
Product ID:     32060
Version:        6.1
Arch:           ALL
Status:         Subscribed
Status Details: 
Starts:         10/05/2014 
Ends:           10/05/2015 ---->> End date is changed back to Active   
subscription's end date" , while future subscription is still present on the system


Product Name:   Awesome OS Server Bits
Product ID:     37060
Version:        6.1
Arch:           ALL
Status:         Subscribed
Status Details: 
Starts:         10/05/2014
Ends:           10/05/2015

Comment 3 Chris "Ceiu" Rog 2014-10-13 16:19:17 UTC
Okay, this one took a bit, but I was able to recreate it and figure out exactly what's going on. The behavior you're seeing is actually by design. A bit goofy, but it should make sense in a moment.

When you do the initial two attaches (partial w/quantity 2 and future with auto-quantity), the display is for the end of the future date since you're only actually compliant for the two-three week overlap period between the two.

When the auto-attach/healing process is run, it tries to use the minimum number of subscriptions possible to bring the system into compliance. In this scenario, that number is eight -- and that's where the confusion begins. Because it's only attaching eight more subscriptions, the system is only compliant for the duration of the original subscription; after that, the future subscription takes over which, itself, only has eight subscriptions. As such, the system is no longer compliant and the updated date reflects this.

When the same sequence of commands is run, but the future subscription is attached with "--quantity 10," the auto healing resolves the same, but the date runs through the end of the future subscription, as the system is compliant throughout.


Note You need to log in before you can comment on or make changes to this bug.