Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1488755

Summary: Can't enable PM through REST API
Product: [oVirt] ovirt-engine Reporter: Petr Matyáš <pmatyas>
Component: BLL.InfraAssignee: Eli Mesika <emesika>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matyáš <pmatyas>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.0CC: bugs, emesika, juan.hernandez, lsvaty, oourfali
Target Milestone: ovirt-4.2.0Keywords: Automation, Regression
Target Release: ---Flags: rule-engine: ovirt-4.2+
rule-engine: blocker+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 11:42:12 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:
Embargoed:

Description Petr Matyáš 2017-09-06 07:52:01 UTC
Description of problem:
After adding PM to host through REST API I'm trying to enable it through REST API, but I always get [Cannot edit Host. Power Management is enabled for Host but no Agent type selected.] even though I have all the necessary fields added already.

Version-Release number of selected component (if applicable):
ovirt-engine-4.2.0-0.0.master.20170904111624.git842d79b.el7.centos.noarch

How reproducible:
always

Steps to Reproduce:
1. curl -v -u "admin@internal:$pass" -H "Content-type: application/xml" --insecure -X POST https://$engine/ovirt-engine/api/hosts/$host_id/fenceagents -d "<agent><address>$ip</address><concurrent>false</concurrent><order>1</order><password>$pass</password><type>ipmilan</type><username>$user</username></agent>"
2.curl -v -u "admin@internal:$pass" -H "Content-type: application/xml" --insecure -X PUT https://$engine/ovirt-engine/api/hosts/$host_id -d "<host><power_management><enabled>true</enabled></power_management></host>"

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

Expected results:
enabled PM for a host

Additional info:
Only relevant thing in engine log is:
2017-09-06 10:30:13,523+03 INFO  [org.ovirt.engine.core.sso.utils.AuthenticationUtils] (default task-21) [] User admin@internal succes
sfully logged in with scopes: ovirt-app-api ovirt-ext=token-info:authz-search ovirt-ext=token-info:public-authz-search ovirt-ext=token
-info:validate ovirt-ext=token:password-access
2017-09-06 10:30:13,544+03 INFO  [org.ovirt.engine.core.bll.aaa.CreateUserSessionCommand] (default task-24) [4973e424] Running command
: CreateUserSessionCommand internal: false.
2017-09-06 10:30:13,553+03 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-24) [4973e424] E
VENT_ID: USER_VDC_LOGIN(30), User admin@internal-authz logged in.
2017-09-06 10:30:13,571+03 WARN  [org.ovirt.engine.core.bll.hostdeploy.UpdateVdsCommand] (default task-24) [3c96065c-47f2-4e9a-91b4-e5
3dc539cf1c] Validation of action 'UpdateVds' failed for user admin@internal-authz. Reasons: VAR__ACTION__UPDATE,VAR__TYPE__HOST,ACTION
_TYPE_FAILED_PM_ENABLED_WITHOUT_AGENT
2017-09-06 10:30:13,572+03 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-24) [] Operation Failed
: [Cannot edit Host. Power Management is enabled for Host but no Agent type selected.]
2017-09-06 10:30:13,576+03 INFO  [org.ovirt.engine.core.bll.aaa.LogoutSessionCommand] (default task-24) [6d6940f] Running command: Log
outSessionCommand internal: false.
2017-09-06 10:30:13,581+03 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-24) [6d6940f] EV
ENT_ID: USER_VDC_LOGOUT(31), User admin@internal-authz logged out.
2017-09-06 10:31:10,801+03 INFO  [org.ovirt.engine.core.sso.servlets.OAuthRevokeServlet] (default task-11) [7f53e5e4] User admin@inter
nal successfully logged out

Comment 1 Juan Hernández 2017-09-06 08:27:06 UTC
Eli, could this be related to the recent database changes around power fence agents?

Comment 2 Red Hat Bugzilla Rules Engine 2017-09-06 12:30:34 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 3 Eli Mesika 2017-09-10 09:53:45 UTC
(In reply to Juan Hernández from comment #1)
> Eli, could this be related to the recent database changes around power fence
> agents?

Do you mean Ori's work on separating the fence agents from vds_static to their own table? 
Otherwise, there where no significant changes on the fencing tables ...

Anyway, I will check where the problem resides in if it is engine or API related

Comment 6 Petr Matyáš 2017-10-16 14:55:05 UTC
Verified on 4.2.0-0.0.master.20171013142622.git15e767c.el7.centos

Comment 7 Sandro Bonazzola 2017-12-20 11:42:12 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.