Bug 1805463

Summary: virt-who package installation failed on satellite server due to package locking
Product: Red Hat Satellite Reporter: Ganesh Payelkar <gpayelka>
Component: Virt-who Configure PluginAssignee: Marek Hulan <mhulan>
Status: CLOSED DUPLICATE QA Contact: Kunxin Huang <kuhuang>
Severity: medium Docs Contact: satellite-doc-list
Priority: unspecified    
Version: 6.7.0CC: mhulan
Target Milestone: UnspecifiedKeywords: Regression
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-25 18:51:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ganesh Payelkar 2020-02-20 20:26:44 UTC
Description of problem:

virt-who package installation failed on satellite server due to foreman-protector plugin

Version-Release number of selected component (if applicable):
satellite-6.7.0-5.beta.el7sat.noarch


How reproducible:
New installation 

Steps to Reproduce:
1. Install satellite 6.7 Beta 
2. If you have a virtual platform and Virtual DataCenter subscriptions you should configure virt-who 
3. Configure Virt-who through satellite WebUI by following below steps
 
5.2. Deploying a virt-who Configuration on Satellite Server
 
https://access.redhat.com/documentation/en-us/red_hat_satellite/6.7-beta/html-single/configuring_virtual_machine_subscriptions_in_red_hat_satellite/index#deploying-a-virt-who-configuration

Actual results:  

WebUI --> Infrastructure --> Virt-who Configurations --> Create config --> Submit Details 
   This will redirect you to the overview and Deploy page, where you can find below details on-page then paste the Hammer command into your terminal.

# hammer virt-who-config deploy --id 1 --organization-id 3

== [1/5] Installing virt-who ==
Loaded plugins: foreman-protector, product-id, search-disabled-repos, subscription-manager
ansible-runner                                                                                                                                                                              | 2.9 kB  00:00:00     
rhel-7-server-ansible-2.8-rpms                                                                                                                                                              | 4.0 kB  00:00:00          
rhel-7-server-rpms                                                                                                                                                                          | 3.5 kB  00:00:00     
rhel-7-server-satellite-maintenance-6-beta-rpms                                                                                                                                             | 3.8 kB  00:00:00     
rhel-server-7-satellite-6-beta-rpms                                                                                                                                                         | 4.0 kB  00:00:00     
rhel-server-rhscl-7-rpms                                                                                                                                                                    | 3.4 kB  00:00:00     
(1/2): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                                                                                         | 3.5 MB  00:00:00     
(2/2): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                                                                                         |  66 MB  00:00:04     

WARNING: Excluding 12248 updates due to foreman-protector. 
Use foreman-maintain packages install/update <package> 
to safely install packages without restrictions.
Use foreman-maintain upgrade run for full upgrade.

No package virt-who available.
Error: Nothing to do
virt-who package virt-who is not installed does not meet minimum requirements, please make sure this host is properly subscribed and has access to satellite-tools repository, minimal virt-who version is 0.24.2

== Finished ==
There were some errors during configuration:
Newer version of virt-who is required, minimum version is 0.24.2
Unable to install virt-who package, make sure the host is properly subscribed and has access to satellite-tools repository


In the Satellite web UI, navigate to Infrastructure > Virt-who configurations.
Click the name of the virt-who configuration file.
Click the Deploy tab.
Under Configuration script, click Download the script.
Copy the script to the Red Hat Enterprise Linux server:


# sh virt-who.sh 

== [1/5] Installing virt-who ==
Loaded plugins: foreman-protector, product-id, search-disabled-repos, subscription-manager

WARNING: Excluding 12248 updates due to foreman-protector. 
Use foreman-maintain packages install/update <package> 
to safely install packages without restrictions.
Use foreman-maintain upgrade run for full upgrade.

No package virt-who available.
Error: Nothing to do
virt-who package virt-who is not installed does not meet minimum requirements, please make sure this host is properly subscribed and has access to satellite-tools repository, minimal virt-who version is 0.24.2

== Finished ==
There were some errors during configuration:
A newer version of virt-who is required, the minimum version is 0.24.2
Unable to install virt-who package, make sure the host is properly subscribed and has access to a satellite-tools repository


Expected results:

Virt-who packages should be installed on the satellite when we perform virt-who deployment through WebUI.

Additional info:

Workaround: 

# foreman-maintain packages unlock 
Running preparation steps required to run the next scenarios
================================================================================
Check if tooling for package locking is installed:                    [OK]
--------------------------------------------------------------------------------


Running unlocking of package versions
================================================================================
Unlock packages:                                                      [OK]
--------------------------------------------------------------------------------

# hammer virt-who-config deploy --id 1 --organization-id 3

== [1/5] Installing virt-who ==
Loaded plugins: product-id, search-disabled-repos, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package virt-who.noarch 0:0.24.7-1.el7 will be installed
--> Processing Dependency: libvirt-python for package: virt-who-0.24.7-1.el7.noarch
--> Processing Dependency: python-suds for package: virt-who-0.24.7-1.el7.noarch
--> Processing Dependency: systemd-python for package: virt-who-0.24.7-1.el7.noarch
--> Running transaction check
---> Package libvirt-python.x86_64 0:4.5.0-1.el7 will be installed
---> Package python-suds.noarch 0:0.4.1-5.el7 will be installed
---> Package systemd-python.x86_64 0:219-67.el7_7.3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================
 Package                                             Arch                                        Version                                             Repository                                               Size
===================================================================================================================================================================================================================
Installing:
 virt-who                                            noarch                                      0.24.7-1.el7                                        rhel-7-server-rpms                                      248 k
Installing for dependencies:
 libvirt-python                                      x86_64                                      4.5.0-1.el7                                         rhel-7-server-rpms                                      343 k
 python-suds                                         noarch                                      0.4.1-5.el7                                         rhel-7-server-rpms                                      204 k
 systemd-python                                      x86_64                                      219-67.el7_7.3                                      rhel-7-server-rpms                                      137 k

Transaction Summary
===================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 932 k
Installed size: 3.4 M
Downloading packages:
(1/4): libvirt-python-4.5.0-1.el7.x86_64.rpm                                                                                                                                                | 343 kB  00:00:00     
(2/4): systemd-python-219-67.el7_7.3.x86_64.rpm                                                                                                                                             | 137 kB  00:00:00     
(3/4): virt-who-0.24.7-1.el7.noarch.rpm                                                                                                                                                     | 248 kB  00:00:00     
(4/4): python-suds-0.4.1-5.el7.noarch.rpm                                                                                                                                                   | 204 kB  00:00:03     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                              286 kB/s | 932 kB  00:00:03     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-suds-0.4.1-5.el7.noarch                                                                                                                                                                  1/4 
  Installing : systemd-python-219-67.el7_7.3.x86_64                                                                                                                                                            2/4 
  Installing : libvirt-python-4.5.0-1.el7.x86_64                                                                                                                                                               3/4 
  Installing : virt-who-0.24.7-1.el7.noarch                                                                                                                                                                    4/4 
  Verifying  : libvirt-python-4.5.0-1.el7.x86_64                                                                                                                                                               1/4 
  Verifying  : systemd-python-219-67.el7_7.3.x86_64                                                                                                                                                            2/4 
  Verifying  : virt-who-0.24.7-1.el7.noarch                                                                                                                                                                    3/4 
  Verifying  : python-suds-0.4.1-5.el7.noarch                                                                                                                                                                  4/4 

Installed:
  virt-who.noarch 0:0.24.7-1.el7                                                                                                                                                                                   

Dependency Installed:
  libvirt-python.x86_64 0:4.5.0-1.el7                                   python-suds.noarch 0:0.4.1-5.el7                                   systemd-python.x86_64 0:219-67.el7_7.3                                  

Complete!

== [2/5] Encrypting password ==

== [3/5] Creating virt-who configuration ==

== [4/5] Creating sysconfig virt-who configuration ==

== [5/5] Enabling and restarting the virt-who service ==
Note: Forwarding request to 'systemctl enable virt-who.service'.
Created symlink from /etc/systemd/system/multi-user.target.wants/virt-who.service to /usr/lib/systemd/system/virt-who.service.
Redirecting to /bin/systemctl restart virt-who.service

== Finished ==
Finished successfully

Comment 3 Marek Hulan 2020-02-21 08:01:31 UTC
We need to use foreman-maintain to unlock the packages to install virt-who. The deploy script can be used outside of Satellite machine too, so we should check if foreman-maintain is installed and if so, unlock packages before the installation and lock again afterwards.