Bug 1113974 - Hostname validation during all-in-one setup
Summary: Hostname validation during all-in-one setup
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: oVirt
Classification: Retired
Component: ovirt-engine-installer
Version: 3.5
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.5.0
Assignee: Simone Tiraboschi
QA Contact: Pavel Stehlik
URL:
Whiteboard: integration
Depends On: 1127770
Blocks: 1073943
TreeView+ depends on / blocked
 
Reported: 2014-06-27 11:20 UTC by Simone Tiraboschi
Modified: 2014-10-17 12:33 UTC (History)
6 users (show)

Fixed In Version: ovirt-3.5.0-beta1.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-17 12:33:23 UTC
oVirt Team: ---


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 29512 None None None Never

Description Simone Tiraboschi 2014-06-27 11:20:40 UTC
Description of problem:
all-in-one setup fails reporting:
detail: Host address must be a FQDN or a valid IP address

while the FQDN can be resolved via /etc/hosts file (using ping command to check it).

Under setup log file I found:
2014-06-27 12:37:56 DEBUG otopi.context context._executeMethod:152 method exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/otopi/context.py", line 142, in _executeMethod
    method['method']()
  File "/usr/share/ovirt-engine/setup/bin/../plugins/ovirt-engine-setup/ovirt-engine/all-in-one/vdsm.py", line 260, in _closeup
    port=self.environment[oenginecons.AIOEnv.SSHD_PORT],
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 8679, in add
    headers={"Expect":expect, "Correlation-Id":correlation_id}
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 88, in add
    return self.request('POST', url, body, headers)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 118, in request
    persistent_auth=self._persistent_auth)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 146, in __doRequest
    persistent_auth=persistent_auth
  File "/usr/lib/python2.7/site-packages/ovirtsdk/web/connection.py", line 134, in doRequest
    raise RequestError, response
RequestError: ^M
status: 400^M
reason: Bad Request^M
detail: Host address must be a FQDN or a valid IP address
2014-06-27 12:37:56 ERROR otopi.context context._executeMethod:161 Failed to execute stage 'Closing up': ^M
status: 400^M
reason: Bad Request^M
detail: Host address must be a FQDN or a valid IP address


Under engine log I found:
2014-06-27 12:37:55,688 WARN  [org.ovirt.engine.core.bll.AddVdsCommand] (ajp--127.0.0.1-8702-6) [21636c91] CanDoAction of action AddVds failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__HOST,$server f19_t_d2.localdomain,VALIDATION.VDS.HOSTNAME.HOSTNAME_OR_IP
2014-06-27 12:37:55,741 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp--127.0.0.1-8702-6) Operation Failed: [Host address must be a FQDN or a valid IP address]


Version-Release number of selected component (if applicable):
3.5 beta

How reproducible:
100%
Steps to Reproduce:
1. change the hostname and set in /etc/hosts
2. install ovirt-engine-setup-plugin-allinone rpm
3. launch engine-setup choosing to install also VDSM

Actual results:
Setup breaks reporting:
detail: Host address must be a FQDN or a valid IP address

Expected results:
Setup completes successfully

Additional info:
My hostname is f19_t_d2.localdomain

Comment 1 Sandro Bonazzola 2014-06-27 12:01:28 UTC
Same with dellserver.home

Comment 2 Juan Hernández 2014-06-27 12:06:18 UTC
According to RFC 952 valid host names contain only letters, digits and hyphens. The underscore is not allowed in host names, even if it is in DNS domain names. The engine uses the URI class to validate this, so it rejects your host name. I think this isn't a bug.

Comment 3 Juan Hernández 2014-06-27 12:09:11 UTC
Also, in the log snippet in the description, it looks like the host name that you are actually sending is "$server f19_t_d2.localdomain". Please enable debug output in the Python SDK (adding debug=True to the API constructor) and repeat the test, so that we can see what is actually sent to the engine.

Comment 4 Simone Tiraboschi 2014-06-27 12:35:27 UTC
API with debug=True doesn't seam that much verbose:

2014-06-27 14:28:59,068 WARN  [org.ovirt.engine.core.bll.AddVdsCommand] (ajp--127.0.0.1-8702-6) [1c3783ca] CanDoAction of action AddVds failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__HOST,$server f19_t_d2.localdomain,VALIDATION.VDS.HOSTNAME.HOSTNAME_OR_IP
2014-06-27 14:28:59,100 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp--127.0.0.1-8702-6) Operation Failed: [Host address must be a FQDN or a valid IP address]

Comment 5 Juan Hernández 2014-06-27 12:38:05 UTC
The debug output of the SDK goes to the standard output of the client program, not to the engine log. It will probably be available, I guess, in the log of the setup script.

Comment 6 Simone Tiraboschi 2014-06-27 13:24:16 UTC
SDK debug output isn't neither there.
The good news is that changing the hostname from f19_t_d2.localdomain to f19td2.localdomain the setup ends correctly.
We should validate the host name also there to alert the user if the hostname is not valid.

Comment 7 Sandro Bonazzola 2014-06-27 13:49:10 UTC
Simone can you take update the regexp we use to validate the fqdn for not accepting _?

Comment 8 Pavel Stehlik 2014-08-08 11:31:22 UTC
ok - ovirt-engine-3.5.0-0.0.master.20140804172041.git23b558e.el6.noarch

Comment 9 Sandro Bonazzola 2014-10-17 12:33:23 UTC
oVirt 3.5 has been released and should include the fix for this issue.


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