Bug 782430 - Internal Server Error when removing entitlement from virtual host whose guest is subscribed to channel from trusted org
Summary: Internal Server Error when removing entitlement from virtual host whose guest...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 1.6
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Jan Pazdziora
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 731586 space17
TreeView+ depends on / blocked
 
Reported: 2012-01-17 13:22 UTC by Jan Pazdziora
Modified: 2018-11-28 20:46 UTC (History)
1 user (show)

Fixed In Version: spacewalk-schema-1.7.11-1
Doc Type: Bug Fix
Doc Text:
Clone Of: 731586
Environment:
Last Closed: 2012-03-07 09:54:27 UTC
Embargoed:


Attachments (Terms of Use)
tea (8.63 KB, text/html)
2015-11-09 19:03 UTC, leonidwxxinosov
no flags Details

Description Jan Pazdziora 2012-01-17 13:22:16 UTC
+++ This bug was initially created as a clone of Bug #731586 +++

Description of problem:

If any virtual guests of a virtualization host or virtualization platform-entitled host are subscribed to a channel from a trusted organization, then any attempt to remove add-on system entitlements (e.g., Provisioning) from the host's system profile will result in an Internal Server Error.

Version-Release number of selected component (if applicable):

satellite-schema-5.4.0.13-1.el5sat
spacewalk-schema-1.2.21-13.el5sat

How reproducible:

100%

Steps to Reproduce:
1. Subscribe RHEL virtual host to Satellite, add Virtualization Host entitlement, and register one of its guests as well.

2. Create a custom child channel in another org, share it with the original org, and subscribe the virtual guest to the channel.

3. Add Provisioning entitlement to the virtual host.

4. Now try to remove the Provisioning entitlement.
  
Actual results:

Internal Server Error. Tomcat log shows Oracle error:

***
ERROR at line 1:
ORA-20288: (invalid_server_group_member) - The specified entitlement can not be
removed from the specified server because the server does not have that
entitlement level
ORA-06512: at "RHNSAT.RHN_EXCEPTION", line 23
ORA-06512: at "RHNSAT.RHN_ENTITLEMENTS", line 334
ORA-06512: at line 1
***

Expected results:

Add-on entitlement is removed without error.

Additional info:

The error occurs in the rhn_entitlements.repoll_virt_guest_entitlements procedure, when it attempts to look up the max_members value for each channel family that is in use by one of the virtual guests:

***
            -- get the max members of the family
            select max_members
            into max_members_val
            from rhnPrivateChannelFamily
            where channel_family_id = family.channel_family_id
            and org_id = org_id_val;
***

This SELECT statement returns no results, because there is no entry stored in rhnPrivateChannelFamily for org X systems subscribed to an org Y channel family.

--- Additional comment from jpazdziora on 2012-01-09 08:30:16 EST ---

Would the following patch to the rhn_entitlements package body help on your ... box? ...

diff --git a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
index 9704ade..3cd6d59 100644
--- a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
@@ -648,6 +648,8 @@ is
                 rhn_channel.channel_family_current_members(family.channel_family_id,
                                                            org_id_val); -- fixed transposed args
 
+            begin
+
             -- get the max members of the family
             select max_members
             into max_members_val
@@ -698,6 +700,9 @@ is
             rhn_channel.update_family_counts(family.channel_family_id,
                                              org_id_val);
 
+            exception when no_data_found then null;
+            end;
+
             -- It is possible that the guests belong  to a different org than the host
             -- so we are going to update the family counts in the guests orgs also
             for org in virt_guest_orgs loop

Comment 1 Jan Pazdziora 2012-01-17 13:33:57 UTC
Modified in Spacewalk master, 238d73f87561ca00ff2815f0a5f230eb7be9190b.

Comment 2 Jan Pazdziora 2012-03-07 09:54:27 UTC
Spacewalk 1.7 has been released:

https://fedorahosted.org/spacewalk/wiki/ReleaseNotes17

Comment 3 leonidwxxinosov 2015-11-09 19:03:29 UTC
Created attachment 1091908 [details]
tea


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