Bug 1010265 - Installation fails if hostname is not on DNS
Installation fails if hostname is not on DNS
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: CLI (Show other bugs)
JON 3.2
Unspecified Unspecified
urgent Severity high
: ER03
: JON 3.2.0
Assigned To: Stefan Negrea
Mike Foley
: Reopened
Depends On:
Blocks: jon32-Beta-Blockers-1006862
  Show dependency treegraph
 
Reported: 2013-09-20 08:09 EDT by Jeeva Kandasamy
Modified: 2014-01-02 15:39 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-30 15:43:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
hostname (2.70 KB, text/x-log)
2013-09-20 08:09 EDT, Jeeva Kandasamy
no flags Details
After hostname was changed, the error message is understandable for the end user. (210.56 KB, image/png)
2013-10-30 07:30 EDT, jvlasak
no flags Details

  None (edit)
Description Jeeva Kandasamy 2013-09-20 08:09:33 EDT
Created attachment 800473 [details]
hostname

Description of problem:
If hostname is not on DNS installation gets failed. storage node installation gets fail, if the hostname is not configured with DNS. It's reporting java stack trace exception, end user might not have knowledge on Java and they might not get understand the actual issue. Error message should be like easy understandable.

if we add hostname on /etc/hosts, installation gets success.

Version-Release number of selected component (if applicable):
JBoss Operations Network 
Version: 3.2.0.ER1
Build Number: 54dd29c:464a643
GWT Version: 2.5.0
SmartGWT Version: 3.0

How reproducible:
100%

Steps to Reproduce:
1. change hostname to something, other than localhost.localdomain 
2. ./rhqctl install


Actual results:
throwing java exception stack trace

Expected results:
User understandable error message

Additional info: log is attached
Comment 1 Heiko W. Rupp 2013-09-23 08:22:16 EDT
This piece of code can be used to see mappings
When I remove the mapping of 

ip   host

in /etc/hosts, then the hostname and hostname2 
no longer match -> DNS forward and reverse mapping are not correctly
set up. 
We may use something similar before trying to install the system.



public class DnsTest {


    public static void main(String[] args) throws Exception {

        String hostname = InetAddress.getLocalHost().getHostName();
        System.out.println("Hostname:                    " + hostname);
        System.out.println("Canonical hostname:          " + InetAddress.getLocalHost().getCanonicalHostName());
        InetAddress address = InetAddress.getByName(hostname);
        System.out.println("Addr.hostname:               " + address.getHostName());
        System.out.println("Addr. canonical hostname:    " +address.getCanonicalHostName());
        byte[] addr = address.getAddress();
        InetAddress address2 = InetAddress.getByAddress(addr);
        System.out.println("Address2:                    " + address2);
        System.out.println("Address2.hostname:           " + address2.getHostName());
        System.out.println("Address2.canonical hostname: " + address2.getCanonicalHostName());
        System.out.flush();
        if (!address2.getHostName().equals(address.getHostName()))
            System.err.println("Reverse mapping probably failed");
    }
}
Comment 2 Stefan Negrea 2013-09-30 15:43:31 EDT
It is clearly documented that DNS resolution is required for all hosts that have JON components. Moreover, this is a generic networking issue; without having DNS resolution, there is no way to bind services to IP addresses.


Please refer to this community documentation regarding DNS:
https://docs.jboss.org/author/display/RHQ/RHQ+Server+Installation+Preparation#RHQServerInstallationPreparation-DNSsetup
Comment 3 Larry O'Leary 2013-09-30 16:04:42 EDT
(In reply to Stefan Negrea from comment #2)
> It is clearly documented that DNS resolution is required for all hosts that
> have JON components. Moreover, this is a generic networking issue; without
> having DNS resolution, there is no way to bind services to IP addresses.
> 
> 
> Please refer to this community documentation regarding DNS:
> https://docs.jboss.org/author/display/RHQ/
> RHQ+Server+Installation+Preparation#RHQServerInstallationPreparation-DNSsetup

As this is a JBoss ON BZ, the reference to community documentation is unacceptable. This needs to be clearly documented in the JBoss ON installation guide and if this is a change since 3.1, it should also be documented in the release notes as a NEW requirement. Perhaps it already is as this seems like a pretty standard requirement but as indicated in the comment 0 it seems that a more meaningful error message should be provided to the user.
Comment 4 Stefan Negrea 2013-09-30 17:41:31 EDT
Added a little more verbiage around the initial unknown host exception. The code still throws that exception but in the process of doing so points the user towards the installation instructions and local DNS settings.

master branch commit:
https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=e0e11c053a3b4c0cfc2625a7fa9ae19b1caaa5fd
Comment 5 Stefan Negrea 2013-09-30 17:45:43 EDT
Here is link to DNS requirements from JON 3.1.x documentation (Section 3.1.2. Preparing the Host Machine):
https://access.redhat.com/site/documentation/en-US/JBoss_Operations_Network/3.1/html-single/Installation_Guide/index.html
Comment 6 Heiko W. Rupp 2013-10-01 06:14:12 EDT
We should warn the user beforehand and not make him fail and then re-read the documentation.
Comment 7 Stefan Negrea 2013-10-01 12:22:12 EDT
Updated the verbiage and the location for the error handling one more time. The error happens very fast, within seconds of starting the process. The code that checks for DNS resolution is part of reading the configuration properties; host name is one of the properties to be read and validated.


master branch commit:
https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=10ebd20b9ec54d734e038f75c4043433d71545a9
Comment 8 Jirka Kremser 2013-10-03 10:28:14 EDT
this handles the case when the hostname is not pingable

repro steps: 
1) sudo hostname asdfg 
2) rhqctl install

branch:  master
link:    http://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=a80c8cbcf
time:    2013-10-03 16:26:20 +0200
commit:  a80c8cbcffcc7f80b5a551c41221c15f896f954e
author:  Jirka Kremser - jkremser@redhat.com
message: [BZ 1010265] - Installation fails if hostname is not on DNS - Handling
         also the case when the UnknownHostException is thrown from the
         startNode() method (where the Cassandra is actually started.)
Comment 9 Simeon Pinder 2013-10-08 03:41:55 EDT
Moving to ON_QA for testing.
Comment 10 jvlasak 2013-10-30 07:30:50 EDT
Created attachment 817412 [details]
After hostname was changed, the error message is understandable for the end user.

Verified.
See the attached screenshot.

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