Bug 673392 - "Software Channels" page should show available flex guest entitlements for channels if system Flex Guest
Summary: "Software Channels" page should show available flex guest entitlements for ch...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: WebUI
Version: 530
Hardware: All
OS: Linux
high
medium
Target Milestone: ---
Assignee: Milan Zázrivec
QA Contact: Martin Minar
URL:
Whiteboard:
Depends On:
Blocks: sat541-blockers
TreeView+ depends on / blocked
 
Reported: 2011-01-28 01:58 UTC by Xixi
Modified: 2018-11-14 14:52 UTC (History)
7 users (show)

Fixed In Version: spacewalk-java-1.2.39-70
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-06-17 02:34:38 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Xixi 2011-01-28 01:58:12 UTC
Description of problem:
System Details -> Software -> Software Channels page (rhn/systems/details/SystemChannels.do) shows only available regular entitlements for the channels tree, even if the system is a flex guest.  It should show both regular and flex guest entitlements.

Version-Release number of selected component (if applicable):
Red Hat Network (RHN) Satellite 5.4.0

How reproducible:
Always.

Steps to Reproduce:
1. Have 5.4 satellite with both regular and flex guest entitlements.
2. Subscribe a KVM guest (running on an unsubscribed RHEL host) to rhel-x86_64-server-5.
3. Verify that it consumes a flex guest entitlement for the base channel's channel family.
4. Overview > Subscription Management > Software Channel Entitlements shows the RHN tools child channel has 1 regular entitlement available and 100 flex entitlements available:
"Channel Entitlement: Red Hat Network Tools for Red Hat Enterprise Linux
Regular Consumed: 1  
Regular Available: 1	
Consumed Flex Guests: 0  	
Available Flex Guests: 100
Systems Subscribed: 1"
5.Go to the system profile's Software > Software Channels tab, and see that the number of available "regular" entitlements is displayed for the system, even though it should be able to consume flex guest entitlements:
"Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64) (1 available)"
6.Subscribe the system to this child channel, and note that the # available stays at 1
"Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64) (1 available)"
and that the Software Channel Entitlements page shows that a flex guest entitlement has been consumed:
"Channel Entitlement: Red Hat Network Tools for Red Hat Enterprise Linux 	
Regular Consumed: 1 	
Regular Available: 1 	
Consumed Flex Guests: 1 	
Available Flex Guests: 99 	
Systems Subscribed: 2"

Actual results:
# of available regular entitlement is shown even for flex guest system

Expected results:
Both regular and flex guest entitlement shown for flex guest system

Additional info:

Comment 1 Xixi 2011-01-28 02:00:32 UTC
This is due to SystemChannelsAction calling ChannelManager.getAvailableEntitlements() which only returns regular entitlements.

src/com/redhat/rhn/frontend/action/systems/sdc/SystemChannelsAction.java
...
        // Setup request attributes
        request.setAttribute(RequestContext.SYSTEM, s);
        if (s.getBaseChannel() != null) {
            Channel baseChannel = s.getBaseChannel();
            List channels = baseChannel.getAccessibleChildrenFor(user);

            Collections.sort(channels,
                    new DynamicComparator("name", RequestContext.SORT_ASC));

            ChildChannelDto[] childchannels = new ChildChannelDto[channels.size()];
            for (int i = 0; i < channels.size(); i++) {
                Channel child = (Channel) channels.get(i);
                childchannels[i] = new ChildChannelDto(child.getId(), child.getName(),
                        s.isSubscribed(child),
                        ChannelManager.isChannelFreeForSubscription(s, child),
                        child.isSubscribable(user.getOrg(), s));
                childchannels[i].setAvailableSubscriptions(
                        ChannelManager.getAvailableEntitlements(user.getOrg(), child));
            }
            request.setAttribute(AVAIL_CHILD_CHANNELS, childchannels);
            form.set(NEW_BASE_CHANNEL_ID, s.getBaseChannel().getId());

            if (log.isDebugEnabled()) {
                log.debug("base_channel: " + form.get(NEW_BASE_CHANNEL_ID));
            }
...

src/com/redhat/rhn/manager/channel/ChannelManager.java
...
    public static Long getAvailableEntitlements(Org org, Channel c) {
        ChannelEntitlementCounter counter =
            (ChannelEntitlementCounter) MethodUtil.getClassFromConfig(
                    ChannelEntitlementCounter.class.getName());

        Long retval = counter.getAvailableEntitlements(org, c);
        log.debug("getAvailableEntitlements: " + c.getLabel() + " got: " + retval);

        return retval;
    }
...

Comment 3 Xixi 2011-02-15 21:00:53 UTC
Workaround is to go to Software Subscriptions page to view the # of regular and flex entitlements for that channel.

Comment 4 Clifford Perry 2011-03-12 02:07:54 UTC
bug 683539 also contains this same, plus a few more changes I'd like to see.

Comment 5 Milan Zázrivec 2011-03-14 10:14:04 UTC
I fixed part of the problem described here in bug #673394 already, although
the results do not exactly match what is requested here.

In the alter channel subscription page, my fix shows number of available
flex guest entitlements in applicable scenarios and number of regular
entitlements if flex is zero or the system in question cannot consume flex.

This means that it's not exactly clear which entitlement poll (flex vs.
regular) the number shown is representing.

Comment 6 Milan Zázrivec 2011-05-02 16:39:29 UTC
Alter channel subscriptions: display flex consumption in applicable scenarios.

spacewalk.git: 30f6fe90f434d41d888283166205016b835da4f5
satellite.git SATELLITE-5.4: 97ea4b3cd8d3422299169c103203692230fb162c

Comment 9 Milan Zázrivec 2011-05-06 10:38:35 UTC
One more modification required -- correct the entitlement count for
custom channels:

spacewalk.git master: 32b333cb2021979f55b0796502e1aa6ac0e21245
satellite.git SATELLITE-5.4: 44cda4947813700c261e00bbf968979477cca5cc

Comment 13 Clifford Perry 2011-06-17 02:34:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

https://rhn.redhat.com/errata/RHSA-2011-0879.html


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