Bug 1034329

Summary: [RFE] bind requests that do not specify a quantity should automatically use max(suggested,instance_multiplier,1) for instance-based subscriptions
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: jesusr
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:04:54 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 John Sefler 2013-11-25 15:51:26 UTC
Description of problem:
Currently when a CLI user does not specify an attachment quantity, there is logic in place to attach a quantity of 1 subscription from the pool or the quantity needed to achieve compliance (as requested in bug 1008647).  Unfortunately this logic is insufficient for instance-based subscriptions when the Suggested quantity value is 0.  The result will be feedback like this: "Quantity '1' is not a multiple of instance multiplier '2'.

To further improve the user's experience and avoid this message, the bind logic should actually attach a quantity = max(suggested,instance_multiplier,1).


Version-Release number of selected component (if applicable):
The candlepin version that is currently deployed in stage. 
0.8.28.1

How reproducible:


Steps to Reproduce:
Pasted from an automated test against stage account rhel7beta from a rhel7 server...

ssh root.eng.brq.redhat.com subscription-manager list --all --available
Stdout:
+-------------------------------------------+
Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Server Beta
Provides: Red Hat Enterprise Linux 7 Public Beta
SKU: RH00069
Contract: 10299492
Pool ID: 8a99f9844228f57b014233437f345c4d
Available: 986
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux Desktop Beta
Provides: Red Hat Enterprise Linux 7 Public Beta
SKU: RH00073
Contract: 10299496
Pool ID: 8a99f9844228f57b0142334889e65cc4
Available: 986
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux Beta for IBM System z
Provides: Red Hat Enterprise Linux 7 for IBM System z Public Beta
SKU: RH00071
Contract: 10299494
Pool ID: 8a99f9844228f57b01423347ab895c98
Available: 990
Suggested: 1
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux Beta for IBM POWER
Provides: Red Hat Enterprise Linux 7 for IBM POWER Public Beta
SKU: RH00070
Contract: 10299493
Pool ID: 8a99f9844228f57b01423347ab6b5c85
Available: 59986
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: All Add-on Beta
Provides:
SKU: RH00075
Contract: 10299498
Pool ID: 8a99f9844228f57b0142334d24145d06
Available: 988
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux Workstation Beta
Provides: Red Hat Enterprise Linux 7 Public Beta
SKU: RH00074
Contract: 10299497
Pool ID: 8a99f9844228f57b0142334975185cde
Available: 988
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux 7 High Touch Beta
Provides: Red Hat Enterprise Linux 7 for IBM System z High Touch Beta
Red Hat Enterprise Linux 7 Desktop High Touch Beta
Red Hat Enterprise Linux 7 High Availability High Touch Beta
Red Hat Enterprise Linux 7 for HPC Compute Node High Touch Beta
Red Hat Enterprise Linux 7 for IBM POWER High Touch Beta
Red Hat Enterprise Linux 7 Server High Touch Beta
Red Hat Enterprise Linux 7 Workstation High Touch Beta
Red Hat Enterprise Linux 7 Load Balancer High Touch Beta
Red Hat Enterprise Linux 7 Resilient Storage High Touch Beta
SKU: RH00076
Contract: 10299499
Pool ID: 8a99f9844228f57b0142334d243f5d17
Available: 948
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Subscription Name: Red Hat Enterprise Linux Server Beta for HPC Compute Node
Provides: Red Hat Enterprise Linux 7 Public Beta
SKU: RH00072
Contract: 10299495
Pool ID: 8a99f9844228f57b01423348142a5cac
Available: 988
Suggested: 0
Service Level: Self-Support
Service Type: L1-L3
Multi-Entitlement: Yes
Ends: 11/06/2014
System Type: Physical

Stderr:
ExitCode: 0


ssh root.eng.brq.redhat.com subscription-manager subscribe --pool=8a99f9844228f57b014233437f345c4d --pool=8a99f9844228f57b0142334889e65cc4 --pool=8a99f9844228f57b01423347ab895c98 --pool=8a99f9844228f57b01423347ab6b5c85 --pool=8a99f9844228f57b0142334d24145d06 --pool=8a99f9844228f57b0142334975185cde --pool=8a99f9844228f57b0142334d243f5d17 --pool=8a99f9844228f57b01423348142a5cac
Stdout:
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Quantity '1' is not a multiple of instance multiplier '2'
Stderr:
ExitCode: 1


Actual results:
Every bind request fails with "Quantity '1' is not a multiple of instance multiplier '2'" because the user did not specify a quantity and the default of 1 was insufficient.

Expected results:
All of these bind requests would have succeeded if the logic was changed to use a quantity = max(suggested,instance_multiplier,1).
Once again, this logic should only apply when the user does not explicitly provide an attachment quantity.

Additional info:

Comment 1 Carter Kozak 2013-11-25 16:10:13 UTC
commit a121556d1039400c483d8414fcdb1f5374f31df6
Author: ckozak <ckozak>
Date:   Wed Oct 23 15:00:53 2013 -0400

    ActKeys can take null quantity, pick quantity upon activation

Comment 2 John Sefler 2014-02-28 21:15:44 UTC
Verifying Version...
[root@jsefler-7 ~]# subscription-manager version
server type: Red Hat Subscription Management    <========== candlepin-0.9.3
subscription management server: Unknown
subscription-manager: 1.10.14-3.el7
python-rhsm: 1.10.12-1.el7


[root@jsefler-7 ~]# subscription-manager facts | grep cpu_socket
cpu.cpu_socket(s): 4
[root@jsefler-7 ~]# subscription-manager facts | grep is_guest
virt.is_guest: false
[root@jsefler-7 ~]# subscription-manager register --username=rhel7beta --serverurl=subscription.rhn.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 37caf6f0-df99-4507-b61c-a9ae948da9fc 
[root@jsefler-7 ~]# subscription-manager list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name: Red Hat Enterprise Linux Server Beta
Provides:          Red Hat Enterprise Linux 7 Public Beta
SKU:               RH00069
Contract:          10299492
Pool ID:           8a99f9844228f57b014233437f345c4d
Available:         918
Suggested:         4
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

Subscription Name: Red Hat Enterprise Linux Desktop Beta
Provides:          Red Hat Enterprise Linux 7 Public Beta
SKU:               RH00073
Contract:          10299496
Pool ID:           8a99f9844228f57b0142334889e65cc4
Available:         930
Suggested:         8
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

Subscription Name: All Add-on Beta
Provides:          
SKU:               RH00075
Contract:          10299498
Pool ID:           8a99f9844228f57b0142334d24145d06
Available:         983
Suggested:         4
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

Subscription Name: Red Hat Enterprise Linux Workstation Beta
Provides:          Red Hat Enterprise Linux 7 Public Beta
SKU:               RH00074
Contract:          10299497
Pool ID:           8a99f9844228f57b0142334975185cde
Available:         926
Suggested:         4
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

Subscription Name: Red Hat Enterprise Linux 7 High Touch Beta
Provides:          Red Hat Enterprise Linux 7 for IBM System z High Touch Beta
                   Red Hat Enterprise Linux 7 Desktop High Touch Beta
                   Red Hat Enterprise Linux 7 High Availability High Touch Beta
                   Red Hat Enterprise Linux 7 for HPC Compute Node High Touch Beta
                   Red Hat Enterprise Linux 7 for IBM POWER High Touch Beta
                   Red Hat Enterprise Linux 7 Server High Touch Beta
                   Red Hat Enterprise Linux 7 Workstation High Touch Beta
                   Red Hat Enterprise Linux 7 Load Balancer High Touch Beta
                   Red Hat Enterprise Linux 7 Resilient Storage High Touch Beta
SKU:               RH00076
Contract:          10299499
Pool ID:           8a99f9844228f57b0142334d243f5d17
Available:         605
Suggested:         4
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

Subscription Name: Red Hat Enterprise Linux Server Beta for HPC Compute Node
Provides:          Red Hat Enterprise Linux 7 Public Beta
SKU:               RH00072
Contract:          10299495
Pool ID:           8a99f9844228f57b01423348142a5cac
Available:         936
Suggested:         2
Service Level:     Self-Support
Service Type:      L1-L3
Subscription Type: Instance Based
Ends:              11/06/2014
System Type:       Physical

[root@jsefler-7 ~]# subscription-manager subscribe --pool=8a99f9844228f57b014233437f345c4d --pool=8a99f9844228f57b0142334889e65cc4 --pool=8a99f9844228f57b0142334d24145d06 --pool=8a99f9844228f57b0142334975185cde --pool=8a99f9844228f57b0142334d243f5d17 --pool=8a99f9844228f57b01423348142a5cac
Successfully attached a subscription for: Red Hat Enterprise Linux Server Beta
Successfully attached a subscription for: Red Hat Enterprise Linux Desktop Beta
Successfully attached a subscription for: All Add-on Beta
Successfully attached a subscription for: Red Hat Enterprise Linux Workstation Beta
Successfully attached a subscription for: Red Hat Enterprise Linux 7 High Touch Beta
Successfully attached a subscription for: Red Hat Enterprise Linux Server Beta for HPC Compute Node
[root@jsefler-7 ~]# subscription-manager list --consumed | grep "Quantity"
Quantity Used:     4
Quantity Used:     8
Quantity Used:     4
Quantity Used:     4
Quantity Used:     4
Quantity Used:     2


VERIFIED: Without specifying a quantity during the bind request, the needed quantity to achieve compliance for each instance-based pool was attached.

Comment 3 John Sefler 2014-02-28 21:17:23 UTC
Additional Info about the Instance Based subscriptions...

[root@jsefler-7 ~]# curl --stderr /dev/null --insecure --user ***:*** --request GET http://rubyvip.web.stage.ext.phx2.redhat.com:80/clonepin/candlepin/owners/7074055/pools | python -m simplejson/tool | egrep "instance_multiplier|sockets" -A4 | grep -v updated
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00073",
                "value": "1"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00073",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00069",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00069",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00070",
                "value": "8"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00070",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00071",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00072",
                "value": "8"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00072",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00073",
                "value": "1"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00073",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00075",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00075",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00076",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00076",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00072",
                "value": "8"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00072",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00073",
                "value": "1"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00073",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00074",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00073",
                "value": "1"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00073",
                "value": "2"
            },
--
                "name": "sockets",
                "productId": "RH00072",
                "value": "8"
            },
--
                "name": "instance_multiplier",
                "productId": "RH00072",
                "value": "2"
            },

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