Bug 999640 - REST-API: Adding and updating host by the API missing supported parameters
REST-API: Adding and updating host by the API missing supported parameters
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.3.0
Unspecified Unspecified
unspecified Severity high
: ---
: 3.3.0
Assigned To: Yaniv Bronhaim
Barak Dagan
infra
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-21 14:36 EDT by Barak Dagan
Modified: 2016-02-10 14:16 EST (History)
10 users (show)

See Also:
Fixed In Version: is15
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 18754 None None None Never
oVirt gerrit 19248 None None None Never

  None (edit)
Description Barak Dagan 2013-08-21 14:36:33 EDT
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 05:41:23 EDT
the code was already merged, y., please add ref. to the patches,

thanks.
Comment 2 Yaniv Bronhaim 2013-08-25 07:32:13 EDT
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 07:56:44 EDT
(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 09:06:27 EDT
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 07:29:28 EDT
(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 08:19:45 EDT
(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 13:22:26 EDT
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 16:44:57 EDT
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 11:14:02 EDT
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 06:42:28 EDT
When is this patch going to be merged ?
Comment 15 Yaniv Bronhaim 2013-09-15 07:28:52 EDT
merged
Comment 18 Barak Dagan 2013-09-18 04:52:48 EDT
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@10.35.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@10.35.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 06:01:21 EDT
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@10.35.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 06:53:34 EDT
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 04:23:21 EDT
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 09:36:44 EDT
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 17:27:25 EST
Closing - RHEV 3.3 Released
Comment 24 Itamar Heim 2014-01-21 17:27:42 EST
Closing - RHEV 3.3 Released
Comment 25 Itamar Heim 2014-01-21 17:30:31 EST
Closing - RHEV 3.3 Released

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