virt-who host-guest mapping on Red Hat Satellite GUI is inaccurate.

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6.3.x
  • Red Hat Satellite 6.4.x

Issue

  • The guest count on the hypervisor profile of Red Hat Satellite GUI is incorrect(and vice versa).

Resolution

  • There is a Bug filed for this behavior where the host-guest mapping is inaccurate on Red Hat Satellite's GUI.

  • Workaround for Sat 6.4.x:

  • Take a backup of the following file:

[root@satellite ~]# cp /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.42/app/lib/katello/resources/candlepin/consumer.rb /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.42/app/lib/katello/resources/candlepin/consumer.rb.bkp

Note: The katello version for the above file may vary. Use # locate consumer.rb to find the absolute path for this file.

  • Make the following edits:
[root@satellite ~]# vi /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.7.0.42/app/lib/katello/resources/candlepin/consumer.rb

               includes = params.key?(:include_only) ? "&" + included_list(params.delete(:include_only)) : ""
               fetch_paged do |page_add|
                 response = super(path + hash_to_query(params) + includes + "&#{page_add}", self.default_headers).body
-                JSON.parse(response)                                <<============= Delete.
+               JSON.parse(response).map(&:with_indifferent_access)   <<============= Add.
               end
             end
           end
  • Workaround for Sat 6.3.x:

  • Take a backup of the following files:

[root@satellite ~]# cp /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/katello/resources/candlepin.rb /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/katello/resources/candlepin.rb.bkp

[root@satellite ~]# cp /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/models/katello/host/subscription_facet.rb /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/models/katello/host/subscription_facet.rb.bkp

Note: The katello version for the above files may vary. Use # locate candlepin.rb subscription_facet.rb to find the absolute paths for these file.

  • Make the following edits:
[root@satellite ~]# vi /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/lib/katello/resources/candlepin.rb

includes = params.key?(:include_only) ? "&" + included_list(params.delete(:include_only)) : ""
               fetch_paged do |page_add|
                 response = super(path + hash_to_query(params) + includes + "&#{page_add}", self.default_headers).body
-                JSON.parse(response)                                         <<============= Delete.
+                JSON.parse(response).map(&:with_indifferent_access)   <<============= Add.
               end
             end
           end

[root@satellite ~]# vi /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.87/app/models/katello/host/subscription_facet.rb

self.facts = consumer_params['facts'] unless consumer_params['facts'].blank?
       end

-      def import_database_attributes(consumer_params)                        <<============= Delete.
+      def import_database_attributes(consumer_params = candlepin_consumer.consumer_attributes)   <<============= Add.
         update_hypervisor(consumer_params)
         update_guests(consumer_params)
  • Restart Red Hat Satellite services:
[root@satellite ~]# katello-service restart
  • Restart virt-who to update the host-guest mapping:
[root@satellite ~]# service virt-who restart

Diagnostic Steps

  • Possible affected package versions are:
[root@satellite6.4 ~]# rpm -qa | egrep "satellite-6|candlepin"
candlepin-selinux-2.4.8-1.el7.noarch
satellite-6.4.2-2.el7sat.noarch
candlepin-2.4.8-1.el7.noarch

[root@satellite6.3 ~]# rpm -qa | egrep "satellite-6|candlepin"
candlepin-selinux-2.1.24-1.el7.noarch
satellite-6.3.5-1.el7sat.noarch
candlepin-2.1.24-1.el7.noarch

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.