Description of problem: 1) Clear Subscription Procedure calling update_family_counts twice a) clear_subscriptions calls unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server) at line 549. unsubscribe_server calls rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val); at line 666. b) clear_subscriptions calls rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id); at line 551. clear_subscriptions is located in http://git.corp.redhat.com/cgit/rhn/rhn/tree/schema/rhn/packages/RHN_CHANNEL.pkb at line number 536. Solution :- Remove the call b) at line 551 since it is effectively done in unsubscribe_server. Version-Release number of selected component (if applicable): How reproducible: This if for performence improvement on RHN DB side. Steps to Verify: 1. go to RHN systems UI. 2.select a bunch of systems. 3.delete them via system set manager 4.At the same time try to regiter a system for same org via command line. 5.You should be able to successfully acheive it. *You should also try to delete a single system. * You should also be able to change the base channel for a system.
Deployed to dev2. Recommended testing approach: 1. Register a system to rhn dev2: rhnreg_ks --username <user> --password <pass> --serverUrl http://xmlrpc.ams-rhn-dev2.devlab.phx1.redhat.com/XMLRPC --force 2. Get the system id: less /etc/sysconfig/rhn/systemid (do not include ID-) 3. Use system_id in the following query to find the Channel Family of the Base Channel for that system: select id, label from rhn.rhnChannelFamily where id = (select channel_family_id from rhn.rhnChannelFamilyMembers where channel_id = (select channel_id from rhn.rhnServerChannel where server_id = &server_id)); 4. Find the consumption of entitlements for that user's org for that channel family: select * from rhn.rhnPrivateChannelFamily where channel_family_id = &cf_id and org_id = &org_id; Note the current_members and max_members. The current_members should decrease when the system is A) deleted from the RHN UI B) the server's base channel is changed to one in a different channel family
code review is complete
Tested good on AMS-RHN-DEV2: https://tcms.engineering.redhat.com/run/68636/?from_plan=9552
Tested good on QA: https://tcms.engineering.redhat.com/run/68675/?from_plan=9552
Retested good in QA: https://tcms.engineering.redhat.com/run/68675/
CHG002023 released to Production 7/13 https://url.corp.redhat.com/chg2023