Bug 999640 - REST-API: Adding and updating host by the API missing supported parameters
Summary: REST-API: Adding and updating host by the API missing supported parameters
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: 3.3.0
Assignee: Yaniv Bronhaim
QA Contact: Barak Dagan
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-21 18:36 UTC by Barak Dagan
Modified: 2016-02-10 19:16 UTC (History)
10 users (show)

Fixed In Version: is15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 18754 0 None None None Never
oVirt gerrit 19248 0 None None None Never

Description Barak Dagan 2013-08-21 18:36:33 UTC
Description of problem:
Adding host using ssh publickey authentication method results an error:

# add host --name MyHost --address 11.11.11.11 --cluster-name MyCluster --ssh-fingerprint


error: 
status: 400
reason: Bad Request
detail: Host [rootPassword] required for add

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

How reproducible:
100%

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Nothing in log nor in CLI debug mode

Comment 1 Michael Pasternak 2013-08-25 09:41:23 UTC
the code was already merged, y., please add ref. to the patches,

thanks.

Comment 2 Yaniv Bronhaim 2013-08-25 11:32:13 UTC
The command "add host --name MyHost --address 11.11.11.11 --cluster-name MyCluster --ssh-fingerprint" doesn't specified with which authentication method to use, you should have --ssh-authentication-method parameter, that should be set to "PublicKey"..

Please verify that you compiled the latest SDK and reply if it still doesn't work as expected (the expectation are the same as from the UI, if you copied the pk to host's .ssh authorized keys, it should allow adding the host)

Setting it back to assigned until verification. If it works as expected, please close it as NOTABUG.

Comment 3 Michael Pasternak 2013-08-25 11:56:44 UTC
(In reply to Yaniv Bronhaim from comment #2)
> The command "add host --name MyHost --address 11.11.11.11 --cluster-name
> MyCluster --ssh-fingerprint" doesn't specified with which authentication
> method to use, you should have --ssh-authentication-method parameter, that
> should be set to "PublicKey"..

actually according to sdk docs [1], it should be ...ssh-authentication_type

[1] 

        Overload 2:
          @param host.name: string
          @param host.address: string
          @param host.ssh.password: string
          @param host.cluster.id|name: string
          [@param host.comment: string]
          [@param host.ssh.port: int]
          [@param host.ssh.fingerprint: string]
          [@param host.ssh.authentication_type: string]
          [@param host.port: int]
          [@param host.display.address: string]
          [@param host.storage_manager.priority: int]
          [@param host.power_management.type: string]
          [@param host.power_management.enabled: boolean]
          [@param host.power_management.address: string]
          [@param host.power_management.username: string]
          [@param host.power_management.password: string]
          [@param host.power_management.options.option: collection]
          {
            [@ivar option.name: string]
            [@ivar option.value: string]
          }
          [@param host.power_management.pm_proxy: collection]
          {
            [@ivar propietary: string]
          }
          [@param host.power_management.agents.agent: collection]
          {
            [@ivar type: string]
            [@ivar address: string]
            [@ivar user_name: string]
            [@ivar password: string]
            [@ivar options.option: collection]
            {
              [@param option.name: string]
              [@param option.value: string]
            }
          }
          [@param host.reboot_after_installation: boolean]
          [@param host.override_iptables: boolean]
        [@param expect: 201-created]
        [@param correlation_id: any string]


> 
> Please verify that you compiled the latest SDK and reply if it still doesn't
> work as expected (the expectation are the same as from the UI, if you copied
> the pk to host's .ssh authorized keys, it should allow adding the host)
> 
> Setting it back to assigned until verification. If it works as expected,
> please close it as NOTABUG.

Comment 4 Yaniv Bronhaim 2013-08-25 13:06:27 UTC
Well, it must be an old version of the sdk, currently its authentication_methods, we renamed it everywhere. Your comment also doesn't state how to configure ssh.username btw.

Comment 5 Barak Dagan 2013-08-26 11:29:28 UTC
(In reply to Yaniv Bronhaim from comment #4)
> Well, it must be an old version of the sdk, currently its
> authentication_methods, we renamed it everywhere. Your comment also doesn't
> state how to configure ssh.username btw.

My comment was about the error given - asked for rootpassword when I was trying to use the ssh.
According to comment #3, there is no ssh.username option anyway

Comment 6 Barak Dagan 2013-08-26 12:19:45 UTC
(In reply to Yaniv Bronhaim from comment #2)
> The command "add host --name MyHost --address 11.11.11.11 --cluster-name
> MyCluster --ssh-fingerprint" doesn't specified with which authentication
> method to use, you should have --ssh-authentication-method parameter, that
> should be set to "PublicKey"..
> 
> Please verify that you compiled the latest SDK and reply if it still doesn't
> work as expected (the expectation are the same as from the UI, if you copied
> the pk to host's .ssh authorized keys, it should allow adding the host)
> 
> Setting it back to assigned until verification. If it works as expected,
> please close it as NOTABUG.

versions:
[root@vm-161-51 ~]# rpm -qa | grep rhevm | egrep 'cli|sdk'
rhevm-sdk-python-3.3.0.11-1.el6ev.noarch
rhevm-cli-3.3.0.5-1.el6ev.noarch

Comment 7 Yaniv Bronhaim 2013-08-27 17:22:26 UTC
Barak, That's an old rhevm-cli version, since 2013-07-15 
you should install latest version of both sdk and cli build and check, you will see --ssh-authentication-method and --ssh-username, check the authentication-method to publicKey and try it on.

please verify it and close the bug. you can also check with latest ovirt-cli

Comment 11 Yaniv Bronhaim 2013-09-01 20:44:57 UTC
Posted a fix in yaml file. Apparently the issue was correct and important, both updating and adding host operations were declared wrong in the rsdl scheme.

Comment 12 Yaniv Bronhaim 2013-09-10 15:14:02 UTC
All supported new fields should be exposed by the API. The attached patch adds it both to add and update operations.

Comment 14 Barak Dagan 2013-09-15 10:42:28 UTC
When is this patch going to be merged ?

Comment 15 Yaniv Bronhaim 2013-09-15 11:28:52 UTC
merged

Comment 18 Barak Dagan 2013-09-18 08:52:48 UTC
Verification failed: is15.

Add host works with ssh-authentication_method, however auto complete and help are not updated with the new flag as can be seen below.

[RHEVM shell]# info

backend version: 3.3
sdk version    : 3.3.0.13
cli version    : 3.3.0.6
python version : 2.6.6.final.0


[RHEVM shell]# add host --name MyHosy --address MyIp --cluster-id MyCluster 
(AutoCompletion options:)
root_password        ssh-authentication_type          
ssh-fingerprint      ssh-password                     
ssh-port                         

[RHEVM shell (connected.161.51)]# add host --name MyHosy --address MyIp --cluster-id MyCluster --ssh-authentication_type publicKey


error: "authentication_type" is invalid argument segment.


[RHEVM shell (connected.161.51)]# add host --name MyHosy --address MyIp --cluster-id MyCluster--ssh-authentication_method publicKey

id                           : 12b1958a-df60-4196-8b69-4a5a4af9f547
name                         : MyHosy
address                      : MyIp
certificate-organization     : 
certificate-subject          : 
...
ssh-fingerprint              : 6e:f7:4b:8b:1e:0c:3c:9c:f4:58:d2:39:36:41:3f:9a
ssh-port                     : 22
status-state                 : installing



help add host:

     Overload 1:
     
     * --name: string
     * --address: string
     * --root_password: string
     * --cluster-id|name: string

     Overload 2:
     
     * --name: string
     * --address: string
     * --ssh-password: string
     * --cluster-id|name: string
     * [--comment: string]
     * [--ssh-port: int]
     * [--ssh-fingerprint: string]
     * [--ssh-authentication_type: string]

Comment 19 Yaniv Bronhaim 2013-09-22 10:01:21 UTC
As I understand from Michael it must be an old sdk. authentication_type does not exist in last 3.3, 3.3.0 and master branches.

Please be sure you check the last one.
I'm not sure your authentication_method test worked, your line is:

[RHEVM shell (connected.161.51)]# add host --name MyHosy --address MyIp --cluster-id MyCluster--ssh-authentication_method publicKey

Without a space after MyCluster, so the cli just ignored the --ssh-authentication_method publicKey and used publicKey as default.

As long as you see authentication_type you still use the old sdk

Comment 20 Barak Dagan 2013-09-22 10:53:34 UTC
1) The sdk version was given - sdk version    : 3.3.0.13. If it's still an old one, please make sure that a new one enters the new build.

2) As for the --ssh-authentication_method. Add host fails if it is omitted:

[RHEVM shell]# add host --name MyHost --address MyIP --cluster-id MyCluster

error: 
status: 400
reason: Bad Request
detail: Cannot install Host with empty password.

and works if the flag is added:

[RHEVM shell]# add host --name  MyHost --address MyIP --cluster-id MyCluster--ssh-authentication_method publicKey

id                           : f748ba70-5433-4f5b-868c-f42ca7d76e8a
name                         : MyHost
address                      : MyIP
...
ssh-fingerprint              : 6e:f7:4b:8b:1e:0c:3c:9c:f4:58:d2:39:36:41:3f:9a
ssh-port                     : 22
status-state                 : installing

3) As can be seen - the help file is not correct as well (#1 ?)

Comment 21 Michael Pasternak 2013-09-23 08:23:21 UTC
barak,

according to eedri:

build@bob:/export/builds/is15$ ll |grep sdk
-rw-rw-r--  2 build build    486964 Sep 17 11:10 rhevm-sdk-java-1.0.0.22-0.1.el6ev.noarch.rpm
-rw-rw-r--  2 build build   2335328 Sep 17 11:10 rhevm-sdk-java-javadoc-1.0.0.22-0.1.el6ev.noarch.rpm
-rw-rw-r--  2 build build    335748 Sep 17 11:39 rhevm-sdk-python-3.3.0.14-1.el6ev.noarch.rpm

so, you're using old sdk.

Comment 22 Barak Dagan 2013-09-30 13:36:44 UTC
verified on is15:

[RHEVM shell]# info

backend version: 3.3
sdk version    : 3.3.0.14.*final-.1
cli version    : 3.3.0.7.*final-.1
python version : 2.6.6.final.0

help add host ....

     Overload 2:
     
     * --name: string
     * --address: string
     * --cluster-id|name: string
     * [--comment: string]
     * [--ssh-port: int]
     * [--ssh-fingerprint: string]
     * [--ssh-authentication_method: string]
     * [--ssh-user-user_name: string]
     * [--ssh-user-password: string]

auto completion add host ....
[RHEVM shell]# add host --name MyHost --address MyIP --cluster-id MyCluster

ssh-user-user_name ssh-authentication_method ssh-fingerprint                  
ssh-port ssh-user-password

missing authentication ...
error: 
status: 400
reason: Bad Request
detail: Cannot install Host with empty password.


Backwards compatability ....
[RHEVM shell]# add host --name MyHost --address MyIP --cluster-id MyCluster 
--root_password psswrd

Comment 23 Itamar Heim 2014-01-21 22:27:25 UTC
Closing - RHEV 3.3 Released

Comment 24 Itamar Heim 2014-01-21 22:27:42 UTC
Closing - RHEV 3.3 Released

Comment 25 Itamar Heim 2014-01-21 22:30:31 UTC
Closing - RHEV 3.3 Released


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