Bug 1391361

Summary: fence_rhevm REST-API URL needs to be updated to "/ovirt-engine/api/".
Product: Red Hat Enterprise Linux 7 Reporter: Ameya Charekar <achareka>
Component: fence-agentsAssignee: Marek Grac <mgrac>
Status: CLOSED DUPLICATE QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: cluster-maint, juan.hernandez
Target Milestone: rc   
Target Release: ---   
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: 2016-11-03 08:54:25 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:

Description Ameya Charekar 2016-11-03 07:41:13 UTC
Description of problem:
fence_rhevm REST-API URL needs to be updated to "/ovirt-engine/api/".

Version-Release number of selected component (if applicable):
fence-agents-common-4.0.11-27.el7_2.9.x86_64

How reproducible:
Always

Steps to Reproduce:
1.Run fence_rhevm commands.
2.
3.

Actual results:
Error saying /api does not exist.

Expected results:
Should work without issue.

Additional info:
After making changes in /usr/sbin/fence_rhevm it is working without issue.

# diff /usr/sbin/fence_rhevm /usr/sbin/fence_rhevm.orig 
84c84
< 	url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/ovirt-engine/api/" + command
---
> 	url += "//" + opt["--ip"] + ":" + str(opt["--ipport"]) + "/api/" + command

Comment 1 Marek Grac 2016-11-03 08:46:18 UTC
@Ameya:

Thanks for a report and we will add the fix for the RHEV-M 4.0 but proposed patch will (probably) break existing deployment againt RHEV-M 3. So we have to find more generic solution

@Juan:

We plan to use your PR:
https://github.com/ClusterLabs/fence-agents/pull/71/

but I'm not sure about change endpoint from /api to /ovirt-engine/api. According to documenation it looks like it should be enough to use /api + header 'version: 3'. Can you please confirm this?

Comment 2 Marek Grac 2016-11-03 08:54:25 UTC

*** This bug has been marked as a duplicate of bug 1287059 ***

Comment 3 Juan Hernández 2016-11-03 09:36:42 UTC
Marek, in order to work with RHV 4 you need to use /ovirt-engine/api, as /api was removed. You also need to use the "Version: 3" header, as the agent isn't prepared to use version 4 of the API.

The patch proposed by Ameya shold work with RHV 3, as unlike RHV 4 it supports both /api and /ovirt-engine/api. But it shoud *not* work with RHV 4. I am really surprised to see that it works. May it be that it was tested with RHV 3?

I take the opportunity to remind you that in the future, probably in RHV 4.2, version 3 of the API will be removed, and then agent will need to use version 4 of the API. I'd suggest you start planning for that change. I'd also suggest that you consider using version 4 of the RVH Python SDK, instead of handling the HTTP details directly. You have documentation here:

  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk
  https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples

Comment 4 Marek Grac 2016-11-03 11:03:56 UTC
@Juan,

so documentation that can be found also on:

http://exes111.subrigo.net/ovirt-engine/docs/manual/en_US/pdf/REST_API_Guide/Red_Hat_Enterprise_Virtualization-REST_API_Guide.pdf

is not valid? Section 3.1 - shows that /api + header should be enough.

--

Are versions of ovirt-engine-sdk-python update in RHEL6/RHEL7 so we can use them without worrying about version changes?

Comment 5 Juan Hernández 2016-11-03 11:35:12 UTC
Marek, that part of the documentation is wrong, it should say /ovirt-engine/api. The old /api path doesn't work with RHV 4. I opened bug 1391464 to track that.

Note that the package I am suggesting is 'python-ovirt-engine-sdk4', that is the one that implements version 4 of the API. Currently we distribute it via the RHV channels, and only for RHEL7, but we can consider adding them to other channels, if that helps you.