Bug 1010265 - Installation fails if hostname is not on DNS
Summary: Installation fails if hostname is not on DNS
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: CLI
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ER03
: JON 3.2.0
Assignee: Stefan Negrea
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: jon32-Beta-Blockers-1006862
TreeView+ depends on / blocked
 
Reported: 2013-09-20 12:09 UTC by Jeeva Kandasamy
Modified: 2014-01-02 20:39 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-30 19:43:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
hostname (2.70 KB, text/x-log)
2013-09-20 12:09 UTC, 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 11:30 UTC, jvlasak
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1006986 0 urgent CLOSED NoHostAvailableException: All host(s) tried for query failed 2021-02-22 00:41:40 UTC

Internal Links: 1006986

Description Jeeva Kandasamy 2013-09-20 12:09:33 UTC
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 12:22:16 UTC
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 19:43:31 UTC
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 20:04:42 UTC
(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 21:41:31 UTC
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 21:45:43 UTC
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 10:14:12 UTC
We should warn the user beforehand and not make him fail and then re-read the documentation.

Comment 7 Stefan Negrea 2013-10-01 16:22:12 UTC
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 14:28:14 UTC
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
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 07:41:55 UTC
Moving to ON_QA for testing.

Comment 10 jvlasak 2013-10-30 11:30:50 UTC
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.