Description of problem: On System Details -> Software -> Software Channels page (rhn/systems/details/SystemChannels.do), trying to subscribe a flex guest system to a child channel will fail if the regular entitlement for that channel is 0, even if there're plenty of flex guest entitlement available. 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" 7. Now, unsubscribe this flex guest system from the Tools child channel, and subscribe another non-flex guest system to the Tools channel, so that the last remaining regular entitlement is consumed. The software channel entitlements is updated as expected: "Channel Entitlement: Red Hat Network Tools for Red Hat Enterprise Linux Regular Consumed: 2 Regular Available: 0 Consumed Flex Guests: 0 Available Flex Guests: 100 Systems Subscribed: 2" 8. Try again to subscribe the original flex guest system to the Tools channel. Note that the child channel shows "0 available": "Red Hat Network Tools for RHEL Server (v.5 64-bit x86_64) (0 available)" If you check the child channel and click "Change Subscriptions", then a red banner message appears at the top of the page: "Note: Some channel subscriptions could not be updated because there were no available subscriptions." and the attempted Tools channel subscription fails. Actual results: For flex guest system, subscribing to child channel with available flex entitlements fails if regular entitlements == 0 Expected results: For flex guest system, subscribing to child channel with available flex entitlements succeeds Additional info:
The bug is due to SystemManager.canServerSubscribeToChannel() using ChannelManager.getAvailableEntitlements to check for available subscriptions which only returns regular entitlements. If the server is a flex guest, it should check for flex guest entitlements. code/src/com/redhat/rhn/manager/system/SystemManager.java ... public static boolean canServerSubscribeToChannel(Org orgIn, Server serverIn, Channel channelIn) { if (serverIn.isSubscribed(channelIn)) { log.debug("already subscribed. return true"); return true; } // If channel is free for this guest, dont check avail subs if (ChannelManager.isChannelFreeForSubscription(serverIn, channelIn)) { log.debug("its a free channel for this server, returning true"); return true; } // Otherwise check available subs Long availableSubscriptions = ChannelManager.getAvailableEntitlements(orgIn, channelIn); if (availableSubscriptions != null && (availableSubscriptions.longValue() < 1)) { log.debug("avail subscriptions is to small : " + availableSubscriptions); return false; } log.debug("canServerSubscribeToChannel true!"); return true; } ... Adding the following log4j debug: log4j.logger.com.redhat.rhn.manager.system=DEBUG log4j.logger.com.redhat.rhn.manager.channel=DEBUG log4j.logger.com.redhat.rhn.frontend.action.systems.sdc.SystemChannelsAction=DEBUG shows: 2011-01-27 16:25:22,147 [TP-Processor3] DEBUG com.redhat.rhn.frontend.action.systems.sdc.SystemChannelsAction - Adding child id: 223 2011-01-27 16:25:22,197 [TP-Processor3] DEBUG com.redhat.rhn.manager.system.UpdateChildChannelsCommand - subscribing to new channels 2011-01-27 16:25:22,205 [TP-Processor3] DEBUG com.redhat.rhn.manager.system.UpdateChildChannelsCommand - checking to see if we can sub: rhn-tools-rhel-x86_64-server-5 2011-01-27 16:25:22,205 [TP-Processor3] DEBUG com.redhat.rhn.manager.channel.ChannelManager - isChannelFreeForSubscription.start: rhn-tools-rhel-x86_64-server-5 2011-01-27 16:25:22,207 [TP-Processor3] DEBUG com.redhat.rhn.manager.channel.ChannelManager - levels : [com.redhat.rhn.domain.common.VirtSubscriptionLevel@ed75e132, com.redhat.rhn.domain.common.VirtSubscriptionLevel@8051b3cd] 2011-01-27 16:25:22,207 [TP-Processor3] DEBUG com.redhat.rhn.manager.channel.ChannelManager - host is null, returning false 2011-01-27 16:25:22,209 [TP-Processor3] DEBUG com.redhat.rhn.manager.channel.ChannelManager - getAvailableEntitlements: rhn-tools-rhel-x86_64-server-5 got: 0 2011-01-27 16:25:22,209 [TP-Processor3] DEBUG com.redhat.rhn.manager.system.SystemManager - avail subscriptions is to small : 0 2011-01-27 16:25:22,209 [TP-Processor3] DEBUG com.redhat.rhn.manager.system.UpdateChildChannelsCommand - we can't subscribe to the channel.
Workaround is to make sure at least one regular entitlement exists for that child channel.
spacewalk.git master: 009afe5bf9fa73a050d3516c09437ba2d5f2c157
satellite.git master: 357c5e6cfc4544c19975faf691bfe9211450d811
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause: A bug in the way the server computes number of available channel subscriptions. Consequence: The server would disallow a flex guest eligible system to be subscribed to a child channel if regular entitlements ran out even if there were flex guest entitlements available. Fix: The fix was a bit invasive. Result: Results of channel subscription now reflect the status of available flex / regular entitlements.
What I see with OLD packages, slightly differs from what is described in comment #0. This is what I see: 1. Have 5.4 satellite with both regular and flex guest entitlements Subscriptions -> System Entitlements Management (Base): 10 Subscriptions -> Software Channel Entitlements Red Hat Enterprise Linux (core server): Regular Proposed Total: 1 Flex Proposed Total: 10 Red Hat Network Tools for Red Hat Enterprise Linux: Regular Proposed Total: 1 Flex Proposed Total: 10 2. Subscribe a KVM guest (running on an unsubscribed RHEL host) to rhel-i386-server-5 3. Verify that it consumes a flex guest entitlement for the base channel's channel family Details page shows: Virtualization: KVM/QEMU Overview -> Subscription Management -> Virtualization Entitlements -> Guests Without Hosts system is there -> Flex Guest Entitlement Consumers system is there -> Software Channel Entitlements shows: -> Red Hat Enterprise Linux (core server) Regular Consumed: 0 Regular Available: 1 Consumed Flex Guests: 1 Available Flex Guests: 9 Systems Subscribed: 1 4. Add RHN Tools channel to the system in Details -> Software -> Software Channels Note there is "(1 available)" althought you have 1 regular and 10 flex 5. Note that it consumes a regular child channel's channel family Overview -> Subscription Management -> Software Channel Entitlements shows: -> Red Hat Network Tools for Red Hat Enterprise Linux Regular Consumed: 1 Regular Available: 0 Consumed Flex Guests: 0 Available Flex Guests: 10 Systems Subscribed: 1 But as this is a flex system, it should consume flex variant 7. Register second FLEX-able system (I have just re-registered first one) 6. Go to the system profile's Software > Software Channels tab of new system, 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 32-bit x86) (0 available) But generally, this is what I see and what I'm going to verify: > Actual results: > For flex guest system, subscribing to child channel with available flex > entitlements fails if regular entitlements == 0 > > Expected results: > For flex guest system, subscribing to child channel with available flex > entitlements succeeds
Hello, using NEW packages (spacewalk-java-1.2.39-38.el5sat) I have done this and got ISE: 1) have RHEL base entitlements: 1 regular + 10 flex RHN Client Tools ents: 1 regular + 10 flex 2) register flex-able (host not registered) KVM guest => flex base consumed (PASS) 3) subscribed to RHN Client Tools channel => regular used (FAIL) 4) register that guest again to get another profile 5) new guest consumes flex base (PASS) 6) go to "Alter Channel Subscriptions" and check number of available RHN Client Tools entitlements (10 available) => flex bunch displayed (PASS) 7) now add RHN Client Tools channel for that new guest => Internal Server Error (FAIL) http://pastebin.test.redhat.com/42813 Note for myself: I have to check on non-virtual system that only regular ones are displayed as available.
Are you sure the Satellite in question does have errata http://rhn.redhat.com/errata/RHBA-2011-0156.html applied correctly?
You are right, that was the issue. Thanks!
I have reported bug 681844 - but it is not 100% reproducible and I do not think it is a regression from OLD to NEW.
With http://rhn.redhat.com/errata/RHBA-2011-0156.html applied correctly, I see this bug PASS correctly: 1) have RHEL base entitlements: 1 regular + 10 flex RHN Client Tools ents: 1 regular + 10 flex 2) register flex-able (host not registered) KVM guest => flex base consumed (PASS) 3) subscribed to RHN Client Tools channel => flex used (PASS) 4) register that guest again to get another profile 5) new guest consumes flex base (PASS) 6) go to "Alter Channel Subscriptions" and check number of available RHN Client Tools entitlements (9 available) => flex bunch displayed (PASS) 7) now add RHN Client Tools channel for that new guest => flex used (PASS) I have also checked physical system consumes physical entitlement and displays correct physical available count.
Also reported bug 682112 discovered during this. That one was reproduced on OLD, so it is not a regression.
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. http://rhn.redhat.com/errata/RHBA-2011-0362.html