Bug 885763

Summary: [RFE] idea to avoid abandoned consumers holding unproductive entitlements
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED WONTFIX QA Contact: Katello QA List <katello-qa-list>
Severity: low Docs Contact:
Priority: low    
Version: 0.9CC: bcourt, bhamrick, bkearney, khowell, tomckay
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-20 15:00:48 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:
Bug Depends On:    
Bug Blocks: 971511    

Description John Sefler 2012-12-10 15:08:49 UTC
Description of problem:
After listening in an a GSS meeting where they were discussing customer issues, I heard this complaint "how come all my entitlements are being consumed so fast?"  One answer has to do with the instructions that I heard one of the GSS folks describe... "run subscription-manager clean, and then register with --force".

The problem with this instruction is that there are dirty consequences of using clean.  Primarily, the old consumer (who has already been granted entitlements) is NOT deleted server-side by the system's actions to "run subscription-manager clean, and then register with --force".  Instead, a new consumer is created who will subsequently consume more entitlements thereby leaving the former consumer abandoned on the server holding onto unproductive entitlements.

My proposal....
  When a consumer registers to candlepin, it sends up it's system facts...
  Search through the existing consumers for one having the same mac_address
    (I'm looking for one fact or a combo to uniquely identify this unit)
  If a match is found, throw an exception...
    "A unit with the same <mac_address foo> has been registered previously as
     consumerid <uuid>.  Try registering with --consumerid to regain
     lost entitlements, or try register with --force to delete the old
     previous consumer."
  If the user registers with --consumerid, all should be good already.
  If the user registers with --force, then candlepin needs to be updated to...
     delete the previous consumer thereby putting its entitlements on the CRL
     and adding its quantity back into the pool.

Additional Info,
In the land of QE, I also witness entitlements being consumed and never released as systems are registered with the stage candlepin and later re-built without ever having been unregistered.

Comment 1 Devan Goodwin 2014-03-27 18:24:37 UTC
*** Bug 991563 has been marked as a duplicate of this bug. ***

Comment 2 Kevin Howell 2016-09-08 20:08:16 UTC
A con of the proposals is that it increased the cost of registration calls. There are also a lot of edge cases (ex. cloning VMs or OpenStack use-cases). An alternative that we are considering is adding warnings to the clean command. For example, "Are you sure you want to clean this system? You will orphan all entitlements attached to this unit."