Bug 1693710 - katello.facts gets invalid hostname while updating RHV hypervisor
Summary: katello.facts gets invalid hostname while updating RHV hypervisor
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: imgbased
Version: 4.2.8-4
Hardware: All
OS: Linux
high
medium
Target Milestone: ovirt-4.3.3
: 4.3.0
Assignee: Yuval Turgeman
QA Contact: jikwang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-28 14:07 UTC by nijin ashok
Modified: 2020-08-03 15:26 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-08 12:32:23 UTC
oVirt Team: Node
Target Upstream Version:
Embargoed:
lsvaty: testing_plan_complete-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:1053 0 None None None 2019-05-08 12:32:35 UTC
oVirt gerrit 99090 0 master MERGED persistence: use fqdn for nspawn machine name 2020-11-25 09:11:40 UTC
oVirt gerrit 99104 0 ovirt-4.3 MERGED persistence: use fqdn for nspawn machine name 2020-11-25 09:11:15 UTC

Description nijin ashok 2019-03-28 14:07:13 UTC
Description of problem:

The katello.facts is generated automatically during the installation of the katello-ca-consumer-latest rpm. It populates the files using the below code.

===
FQDN=`hostname -f`
if [ $? == "0" ] && [ -d /etc/rhsm/facts/ ]; then
  echo "{\"network.hostname-override\":\"$FQDN\"}" > /etc/rhsm/facts/katello.facts
fi
===

So it should contain the hostname of the hypervisor as below.

cat /etc/rhsm/facts/katello.facts
{"network.hostname-override":"myhost.example.com"}

Where myhost.example.com is the hypervisor hostname.

Since the katello-ca-consumer-latest is an extra rpm, we will be using "rpm -Uvh" at the end of the upgrade procedure to move the package to the new layer. This is done using systemd-nspawn as below.

===
2019-03-28 12:47:06,988 [DEBUG] (MainThread) Running ['systemd-nspawn', '--uuid', '68ee01a38489442c9ba23c1746b9e330', '-D', u'/tmp/mnt.T18wo//', 'rpm', '-Uvh', '/var/imgbased/persisted-rpms/katello-ca-consumer-latest.noarch.rpm']
===

We are not passing the "--machine" with systemd-nspawn. So from the man page of systemd-nspawn, if -machine is not specified, the last component of the root directory path of the container is used to set the hostname.

So this results in having an invalid entry in the katello.facts.

===
cat /etc/rhsm/facts/katello.facts
{"network.hostname-override":"mnt.T18wo"}
===


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

Customer reproduced with RHV 4.2 and I have used 4.3 to reproduce the issue.


How reproducible:

100%

Steps to Reproduce:

1. Install katello-ca-consumer-latest from the satellite on RHV-H.

2. Check if /etc/rhsm/facts/katello.facts is having correct hostname.

3. Upgrade the host.

4. The /etc/rhsm/facts/katello.facts will be having an invalid hostname.

Actual results:

katello.facts gets invalid hostname while updating RHV hypervisor

Expected results:

Upgrading RHV-H should not make an invalid entry in /etc/rhsm/facts/katello.facts.

Additional info:

Comment 3 jikwang 2019-04-04 07:37:16 UTC
How to reproduce this Bug.

1.Use a modified katello-ca-consumer-latest rpm to install by Yum.

yum -y install katello-ca-consumer-host-8-243-104.host.centralci.eng.rdu2.redhat.com-1.0-1.noarch.rpm

2. It automatically generates a katello.facts file.

Note: katello-ca-consumer-latest rpm can not automatically generate files before modification.

      My satellite version is 6.4.2. It can't generate katello.facts file.


cat katello.facts 
{"network.hostname-override":"dhcp-10-180.nay.redhat.com"}

3. Upgrade from rhvh-4.2.5.0-20180724 to rhvh-4.2.8.3-0.20190219.0。

result: The katello.facts file has changed.

cat /etc/rhsm/facts/katello.facts 
{"network.hostname-override":"mnt.q6aAw"}

Comment 5 jikwang 2019-04-08 08:18:00 UTC
The issue is fixed in rhvh-4.3.0.5-0.20190404.0+1.

Test version:
Build1: rhvh-4.3.0.5-0.20190328.0
Build2: rhvh-4.3.0.5-0.20190404.0+1

Test steps:

1.Use a modified katello-ca-consumer-latest rpm to install by Yum.
yum -y install katello-ca-consumer-host-8-243-104.host.centralci.eng.rdu2.redhat.com-1.0-1.noarch.rpm

The content modified in A is the following:
#rpmrebuiled -enp katello-ca-consumer-host-8-243-104.host.centralci.eng.rdu2.redhat.com-1.0-1.noarch.rpm
Add following below line 66:

FQDN=`hostname -f`
if [ $? == "0" ] && [ -d /etc/rhsm/facts/ ]; then 
  echo "{\"network.hostname-override\":\"$FQDN\"}" > /etc/rhsm/facts/katello.facts
fi

2. It automatically generates a katello.facts file.
cat katello.facts 
{"network.hostname-override":"dhcp-10-180.nay.redhat.com"}
3. Upgrade from rhvh-4.3.0.5-0.20190328.0 to rhvh-4.3.0.5-0.20190404.0+1.


Test result:
this file will not change.

cat /etc/rhsm/facts/katello.facts 
{"network.hostname-override":"dhcp-10-180.nay.redhat.com"}

So this bug is fixed in rhvh-4.3.0.5-0.20190404.0+1, I will change the status to VERIFIED.

Comment 7 errata-xmlrpc 2019-05-08 12:32:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:1053

Comment 8 Daniel Gur 2019-08-28 13:12:59 UTC
sync2jira

Comment 9 Daniel Gur 2019-08-28 13:17:11 UTC
sync2jira


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