Bug 988027

Summary: Add host with public key with rest fails
Product: [Retired] oVirt Reporter: Noam Slomianko <nslomian>
Component: ovirt-engine-apiAssignee: Yaniv Bronhaim <ybronhei>
Status: CLOSED NOTABUG QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.3CC: acathrow, dfediuck, iheim
Target Milestone: ---   
Target Release: 3.3   
Hardware: x86_64   
OS: Linux   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-25 08:50:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Engine log none

Description Noam Slomianko 2013-07-24 14:43:55 UTC
Created attachment 777830 [details]
Engine log

Description of problem:
Adding the same host with public key works through the UI while it fails when invoked by the REST PAI

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

How reproducible:
100%

Steps to Reproduce:
1. add server public key to hosts authorized_keys
2. call for post to /api/hosts with xml :
<host>
<cluster href="/api/clusters/INSERTID" id="INSERTID"/>
<name>bla</name>
<address>INSERT IP</address>
<root_password>1</root_password>
<ssh>
<port>22</port>
<authentication_type>publickey</authentication_type>
</ssh>
</host>

Actual results:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[var  action  add, var  type  host, vds cannot authenticate to server]</detail>
</fault>


Expected results:
Hosts added successfully


Additional info:
In the log it seems as if the engine tries to connect with password and not public key:
"Failed to authenticate session with host bla:
 javax.naming.AuthenticationException: SSH authentication to 'root.1.17' failed make sure host is configured for password authenticatio"

log attached

Comment 1 Yaniv Bronhaim 2013-07-25 08:50:33 UTC
<authentication_type>publickey</authentication_type> is unknown field, 

<authentication_method> should be used.. the question is why Noam decided to use authentication_type instead. Might be that I wrote it somewhere and it's misleading the user. If someone bumps into such usage please let me know. The full description described here: http://www.ovirt.org/Features/Ssh_Abilities

When the authentication method is not provided the default is to use password authentication, that's the reason for the printed error.