Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1624529

Summary: hosted-engine-setup doesn't restore hostname entry of RHV manager under "/etc/hosts" at the end of the setup if the engine VM is configured with DHCP
Product: Red Hat Enterprise Virtualization Manager Reporter: Ameya Charekar <achareka>
Component: ovirt-hosted-engine-setupAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED ERRATA QA Contact: Liran Rotenberg <lrotenbe>
Severity: low Docs Contact:
Priority: medium    
Version: 4.2.5CC: achareka, lsurette
Target Milestone: ovirt-4.2.7Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-hosted-engine-setup-2.2.27-1.el7ev.noarch.rpm Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-05 15:03:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1629888    

Description Ameya Charekar 2018-09-01 00:04:39 UTC
Description of problem:

During Hosted Engine deployment, temporary entry for local VM HostedEngineLocal is added in "/etc/hosts" (e.g. 192.168.124.x rhv_manager_fqdn) after removing already added entry of rhv_manager_fqdn.

But after completing setup successfully though temporary entry of rhv_manager_fqdn from "/etc/hosts" is removed, original rhv_manager_fqdn entry is not added back.

Version-Release number of selected component (if applicable):
ovirt-hosted-engine-setup-2.2.25-1.el7ev.noarch.rpm

How reproducible:
Always

Steps to Reproduce:
1. add rhv_manager_fqdn entry in "/etc/hosts"
2. run Hosted Engine setup
3. check contents of file "/etc/hosts"

Actual results:
No entry for rhv_manager_fqdn entry in "/etc/hosts"

Expected results:
re-add entry of rhv_manager_fqdn present before deploying Hosted Engine setup in "/etc/hosts".

Additional info:
One can re-add rhv_manager_fqdn entry manually in file "/etc/hosts" once entry of HostedEngineLocal is removed at the end of setup or run setup without using Ansible "hosted-engine --deploy --noansible".

Comment 1 Simone Tiraboschi 2018-09-04 09:28:54 UTC
There is an explicit task to add id back at the end of the deployment:
https://github.com/oVirt/ovirt-hosted-engine-setup/blob/master/src/ansible/create_target_vm.yml#L443

and it's under "when: VM_ETC_HOSTS and VM_IP_ADDR is not none" condition.

Ameya, did you deployed from cockpit or from CLI?
Can you please attach hosted-engine-setup logs?

Comment 3 Simone Tiraboschi 2018-09-05 07:58:27 UTC
OK, the issue comes from here:

2018-09-05 05:48:28,943+0530 DEBUG otopi.plugins.otopi.dialog.human dialog.__logString:204 DIALOG:SEND                 How should the engine VM network be configured (DHCP, Static)[DHCP]? 
2018-09-05 05:48:30,105+0530 DEBUG otopi.plugins.otopi.dialog.human human.queryString:159 query CI_VM_ETC_HOST

We are temporary removing the entry under /etc/hosts since the bootstrap VM it's running on libvirt default netted network over a different address.
We are not restoring it at the end since the engine VM is configured to use DHCP and so VM_IP_ADDR is none and 
  when: VM_ETC_HOSTS and VM_IP_ADDR is not none
fails for that.

Comment 4 Liran Rotenberg 2018-10-03 06:43:16 UTC
Verified on:
ovirt-hosted-engine-setup-2.2.27-1.el7ev.noarch

Steps:
1. Set a FQDN entry for the future engine in /etc/hosts.
2. Deploy HE(# hosted-engine --deploy)
3. In the deployment select DHCP on:
How should the engine VM network be configured (DHCP, Static)[DHCP]?
4. Check the /etc/hosts after:
TASK [Create an entry in /etc/hosts for the local VM]
and
TASK [Remove temporary entry in /etc/hosts for the local VM]

Results:
The host was set in /etc/hosts:
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.65.211.18 my-amazing-test.redhat.com
10.35.72.233 <EngineFQDN>

After TASK [Create an entry in /etc/hosts for the local VM]:
# cat /etc/hosts
192.168.122.199 <EngineFQDN> # temporary entry added by hosted-engine-setup for the bootstrap VM
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.65.211.18 my-amazing-test.redhat.com
10.35.72.233 <EngineFQDN>

After TASK [Remove temporary entry in /etc/hosts for the local VM]:
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.65.211.18 my-amazing-test.redhat.com
10.35.72.233 <EngineFQDN>

Where <EngineFQDN> is the desired FQDN.

Comment 6 errata-xmlrpc 2018-11-05 15:03:44 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-2018:3482