Bug 1330209

Summary: /api/hosts/{host:id}/install fails
Product: [oVirt] ovirt-engine Reporter: Fabrice Bacchella <fabrice.bacchella>
Component: BLL.InfraAssignee: Ondra Machacek <omachace>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.6.5.1CC: bugs, juan.hernandez, mperina, omachace, oourfali
Target Milestone: ovirt-4.0.0-rcFlags: rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
mperina: devel_ack+
pstehlik: testing_ack+
Target Release: 4.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-01 12:30:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Fabrice Bacchella 2016-04-25 15:54:27 UTC
I'm trying my python cli, I send the following command using python sdk 3.6.3.0 to reinstall an host:

> POST /api/hosts/db240f83-9266-4892-a6d2-8ac406cadfb1/install HTTP/1.1
...
> <action>
>     <host>
>         <override_iptables>false</override_iptables>
>     </host>
>     <ssh>
>         <port>22</port>
>         <fingerprint>SHA256:3wKEADIgpAnX1cF/EnvdVODBKvU/FaaFKqHndlYxl8k</fingerprint>
>         <authentication_method>publickey</authentication_method>
>     </ssh>
> </action>

But I got a :
<     <fault>
<         <reason>Operation Failed</reason>
<         <detail>[Cannot edit Host. Power Management is enabled for Host but no Agent type selected.]</detail>
<     </fault>

In engine.log:
2016-04-25 17:51:50,837 INFO  [org.ovirt.engine.core.bll.aaa.LoginUserCommand] (default task-27) [] Running command: LoginUserCommand internal: false.
2016-04-25 17:51:50,841 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-27) [] Correlation ID: null, Call Stack: null, Custom Event ID: -1, Message: User XXXX logged in.
2016-04-25 17:51:52,127 WARN  [org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand] (default task-23) [173941f5] CanDoAction of action 'UpdateVds' failed for user XXXXX. Reasons: VAR__ACTION__UPDATE,VAR__TYPE__HOST,ACTION_TYPE_FAILED_PM_ENABLED_WITHOUT_AGENT
2016-04-25 17:51:52,128 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-23) [] Operation Failed: [Cannot edit Host. Power Management is enabled for Host but no Agent type selected.]
2016-04-25 17:51:52,699 INFO  [org.ovirt.engine.core.bll.aaa.LoginUserCommand] (default task-29) [] Running command: LoginUserCommand internal: false.

When I'm using the web UI, the reinstallation works fine.

I'm using ovirt-engine 3.6.5.3

But the agent was set when I created the host, the GUI don't ask for power management informations when reinstalling the hosts and when I look the the rsdl ( at https://ovirt/api?rsdl), the agent type was not required.

<link href="/api/hosts/{host:id}/install" rel="install">
   <description>
       install vdsm and other packages required to get the host ready to be used in the engine
   </description>
   <request>
       <http_method>POST</http_method>
       <headers>
           <header required="false">
               <name>Correlation-Id</name>
               <value>any string</value>
           </header>
           <header required="true">
               <name>Content-Type</name>
               <value>application/xml|json</value>
           </header>
       </headers>
       <url>
           <parameters_set>
               <parameter required="false" type="xs:boolean" context="matrix">
                   <name>async</name>
                   <value>true|false</value>
               </parameter>
           </parameters_set>
       </url>
       <body>
           <type>Action</type>
         ...
           <parameters_set>
               <description>
                   install vdsm and other packages required to get the host ready to be used in the engine providing the ssh password
               </description>
               <parameter required="false" type="xs:int">
                   <name>action.ssh.port</name>
               </parameter>
               <parameter required="false" type="xs:string">
                   <name>action.ssh.fingerprint</name>
               </parameter>
               <parameter required="false" type="xs:string">
                   <name>action.ssh.authentication_method</name>
               </parameter>
               <parameter required="false" type="xs:string">
                   <name>action.ssh.user.user_name</name>
               </parameter>
               <parameter required="false" type="xs:string">
                   <name>action.ssh.user.password</name>
               </parameter>
               <parameter required="false" type="xs:string">
                   <name>action.image</name>
               </parameter>
               <parameter required="false" type="xs:boolean">
                   <name>action.host.override_iptables</name>
               </parameter>
               <parameter required="false" type="xs:boolean">
                   <name>action.async</name>
               </parameter>
               <parameter required="false" type="xs:long">
                   <name>action.grace_period.expiry</name>
               </parameter>
           </parameters_set>
       </body>
   </request>
   <response>
       <type>Action</type>
   </response>
</link>

Comment 1 Juan Hernández 2016-04-25 16:00:32 UTC
I believe that the problem is in the checks that the backend performs when the host is updated. It checks if power management is enabled, and then it checks if the agents are provided as part of the request, but in this case power management is enabled but no agents are provided, as they aren't being modified.

Comment 2 Juan Hernández 2016-04-25 16:03:31 UTC
Looks more like an infra issue, as it is related to fencing.

Comment 3 Yaniv Lavi 2016-05-09 10:54:01 UTC
Moving to first RC, since things should not be targeted to second one at this point.

Comment 4 Oved Ourfali 2016-05-25 13:55:21 UTC
Ondra - the patch is merged already. Should it move to MODIFIED?

Comment 5 Martin Perina 2016-05-25 14:28:13 UTC
Yes, this should be moved even to ON_QA as it was merged on May 10th. I somehow missed this bug :-(

Comment 6 Petr Matyáš 2016-07-21 13:22:52 UTC
Verified on 4.0.1-2