Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1693710 - katello.facts gets invalid hostname while updating RHV hypervisor
Summary: katello.facts gets invalid hostname while updating RHV hypervisor
Keywords:
Status: VERIFIED
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: 2019-04-14 13:40 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Node
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 99090 master MERGED persistence: use fqdn for nspawn machine name 2019-04-02 07:35:34 UTC
oVirt gerrit 99104 ovirt-4.3 MERGED persistence: use fqdn for nspawn machine name 2019-04-02 17:47:34 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.


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