Bug 1008647

Summary: [RFE] bind requests that do not specify a quantity should automatically use the quantity needed to achieve compliance
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Carter Kozak <ckozak>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 0.9CC: bkearney, hhudgeon
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: 2013-12-05 13:46:42 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: 862910    

Description John Sefler 2013-09-16 18:19:30 UTC
Description of problem:
This is the server-side of bug 1008557.

In light of the increasing number of subscription types (instance based, ram, cores, sockets) that often require a quantity more than one to achieve compliance, it would be helpful for the candlepin server to automatically give a CLI consumer the quantity needed to achieve compliance when the --quantity option is not explicitly specified by the CLI consumer.

I believe this will facilitate the transition to new instance-based subscriptions and avoid this troublesome stdout attachment message:
  "Quantity '%s' is not a multiple of instance multiplier '%s'"

Comment 2 Carter Kozak 2013-09-19 18:54:51 UTC
commit c67def26a24c2a43c1133995ad08ed27d18bb86d
Author: ckozak <ckozak>
Date:   Tue Sep 17 11:57:02 2013 -0400

    1007836: calculate suggested quantity with only matching stacking_ids

commit 92f3f326a6423b8c5c49e482d529f38d70b02abc
Author: ckozak <ckozak>
Date:   Tue Sep 17 10:56:17 2013 -0400

    check if quantity is null when autobinding

commit 9a3c7e6b6fd4a764a301a69a6ee978533def9ddd
Author: ckozak <ckozak>
Date:   Mon Sep 16 11:23:49 2013 -0400

    added spec tests

commit a3dc68dd151a91cdb856d13e187aa580ddb99d01
Author: Carter Kozak <ckozak>
Date:   Fri Sep 13 20:48:08 2013 -0400

    fixed up spec tests

commit a3961d8a76318bb2a0a6878e26dfffc0fbf88d9b
Author: ckozak <ckozak>
Date:   Fri Sep 13 18:07:29 2013 -0400

    change default attach value to suggested quantity

commit 83ea92df468fd4b231abe3881f08730e90d544be
Author: ckozak <ckozak>
Date:   Fri Sep 13 17:59:21 2013 -0400

    default quantity is the suggested quantity

Comment 3 Bryan Kearney 2013-09-26 18:15:05 UTC
fixed in 0.8.28-1

Comment 4 John Sefler 2013-10-08 21:16:47 UTC
Verifying Version...
[root@jsefler-6 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.8.28-1
subscription-manager: 1.9.9-1.el6
python-rhsm: 1.9.6-1.el6


[root@jsefler-6 ~]# subscription-manager facts --list | grep cpu_socket
cpu.cpu_socket(s): 16
[root@jsefler-6 ~]# subscription-manager register 
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: 69b7f787-c13f-468a-a9c7-1e76239e2af3 
[root@jsefler-6 ~]# subscription-manager auto-attach --disable
Auto-attach preference: disabled
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# subscription-manager list --avail
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Multi-Attribute Stackable (16 cores, 4 sockets, 8GB RAM)
Provides:          Multi-Attribute Limited Product
SKU:               sock-core-ram-multiattr
Pool ID:           8a9087404175311a01417531d71905c6
Available:         5
Suggested:         4                       <========= VERIFIED BUG 1008557
Service Level:     Super
Service Type:      Level 3
Multi-Entitlement: Yes
Ends:              09/30/2014
System Type:       Physical

[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# subscription-manager attach --pool 8a9087404175311a01417531d71905c6
Successfully attached a subscription for: Multi-Attribute Stackable (16 cores, 4 sockets, 8GB RAM)
[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name: Multi-Attribute Stackable (16 cores, 4 sockets, 8GB RAM)
Provides:          Multi-Attribute Limited Product
SKU:               sock-core-ram-multiattr
Contract:          0
Account:           12331131231
Serial:            5499075467547058958
Pool ID:           8a9087404175311a01417531d71905c6
Active:            True
Quantity Used:     4                <=============== VERIFIED BUG 1008647
Service Level:     Super
Service Type:      Level 3
Status Details:    
Starts:            09/30/2013
Ends:              09/30/2014
System Type:       Physical

[root@jsefler-6 ~]# 


VERIFIED: Although no --quantity value was specified during the call to subscription-manager attach, the needed quantity is now used to achieve compliance.