Bug 857365 - [Hyper-v] Failed to get the FQDN with the error "getaddrinfo failed..."
[Hyper-v] Failed to get the FQDN with the error "getaddrinfo failed..."
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: hypervkvpd (Show other bugs)
5.9
Unspecified Unspecified
high Severity high
: rc
: ---
Assigned To: Tomáš Hozza
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-14 04:49 EDT by Shengnan Wang
Modified: 2012-09-14 09:10 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-14 09:10:09 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)

  None (edit)
Description Shengnan Wang 2012-09-14 04:49:27 EDT
Description of problem:

Fail to the FQDN with the error "getaddrinfo failed..." when the hostname is not the same with that in the file /etc/hosts. The detail result is as bellow:
+-----------+---------------------+----------------------+------------+
| hostname  |                     |                      |            |
|(terminal  |                     |                      |            |                  
| output)   |   /etc/hosts        |/etc/sysconfig/network|Test Results|
+-----------+---------------------+----------------------+------------+
|test.test  |127.0.0.1 test.test  | HOSTNAME=test.test   | test.test  |
+-----------+---------------------+----------------------+------------+
|test1.test1|127.0.0.1 test.test  | HOSTNAME=test.test   |getaddrinfo |
|           |                     |                      | failed...  |
+-----------+---------------------+----------------------+------------+
|test.test  |127.0.0.1 test1.test1| HOSTNAME=test.test   |getaddrinfo |
|           |                     |                      | failed...  |
+-----------+---------------------+----------------------+------------+
|test.test  |127.0.0.1 test.test  | HOSTNAME=test1.test1 | test.test  |
+-----------+---------------------+----------------------+------------+

Suggest that to get the FQDN from the hostname(terminal output) only, or it will be confused for customer using. We can leave the consistency of hostname and /etc/hosts to customer.
If the hostname is not the same with that in the /etc/hosts, customers should modify their /etc/hosts file by themselves. 

Version-Release number of selected component (if applicable):
Host: Windows 2008 R2 Hyper-V Server Core 
Hyper-V Version: 6.1.7600.16385
Guest: Both RHEL5.9 i386 & RHEL5.9 x86_64 (2.6.18-339.el5)
Hypervkvpd package Name: hypervkvpd-0-0.7.el5
Pv drivers: 
[root@localhost ~]# lsmod |grep hv_*
hv_netvsc              25665  0 
hid_base_hv            68177  1 hid_hyperv
hv_utils               12001  0 
hv_storvsc             17601  2 
hv_vmbus               30265  4 hv_netvsc,hid_hyperv,hv_utils,hv_storvsc


How reproducible:
100%

Steps to Reproduce:

1. Check the hostname with #hostname.
2. Get the Linux guest FQDN via kvp on host.
3. Change the Linux guest name via #hostname test1.test1 . Or change the Linux guest name via modify HOSTNAME=test1.test1 in file /etc/sysconfig/network. Reboot is required after HOSTNAME updated in /etc/sysconfig/network.
4. Check the hostname with #hostname. The host name changed.
5. Get the Linux guest FQDN via kvp on host.

Actual results:
At step 2, get Linux guest FQDN successfully via kvp on Hyper-v host.
At step 5, failed to get Linux guest FQDN with the error "getaddrinfo failed..."

Expected results:
At step 2, get Linux guest FQDN successfully via kvp on Hyper-v host.
At step 5, get Linux guest FQDN successfully via kvp on Hyper-v host.


Additional info:
1. Both x86_64 guest and the i386 guest meet the problem.
Comment 1 RHEL Product and Program Management 2012-09-14 05:08:32 EDT
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.
Comment 2 Tomáš Hozza 2012-09-14 09:10:09 EDT
Hi.

The result you are getting is not an error. When you set hostname to some name, that doesn't have a DNS record and is not included in /etc/hosts, then the system is not able to get the FQDN. It is correct behavior.
                 
> | output)   |   /etc/hosts        |/etc/sysconfig/network|Test Results|
> +-----------+---------------------+----------------------+------------+
> |test1.test1|127.0.0.1 test.test  | HOSTNAME=test.test   |getaddrinfo |
> |           |                     |                      | failed...  |

This is OK, since there is no record for "test1.test1" host in /etc/hosts nor any DNS record on a DNS server.

> +-----------+---------------------+----------------------+------------+
> |test.test  |127.0.0.1 test1.test1| HOSTNAME=test.test   |getaddrinfo |
> |           |                     |                      | failed...  |

The same as previous.

> +-----------+---------------------+----------------------+------------+
> |test.test  |127.0.0.1 test.test  | HOSTNAME=test1.test1 | test.test  |

This is OK, because there is a record for "test.test" host in the /etc/hosts.

> Suggest that to get the FQDN from the hostname(terminal output) only, or it
> will be confused for customer using.

Hostname (terminal output) doesn't have to be exactly the same as FQDN, since FQDN will contain the rest of the domain where is the host located.

> If the hostname is not the same with that in the /etc/hosts, customers
> should modify their /etc/hosts file by themselves. 

Yes, if they want the FQDN to be resolved correctly. Another option is to set a DNS record on the DNS server.


Conclusion:
If you want to get the FQDN, you have to:
1. have a DNS record on DNS server for the hostname, that you are setting on the host.

OR

2. have a record in /etc/hosts on the host for the hostname, that you are setting on the host.


Closing as NOTABUG.

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