Bug 1019211

Summary: [RESTAPI] wrong VM link for Template's watchdog
Product: Red Hat Enterprise Virtualization Manager Reporter: Lukas Svaty <lsvaty>
Component: ovirt-engine-restapiAssignee: Gilad Chaplik <gchaplik>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Svaty <lsvaty>
Severity: high Docs Contact:
Priority: high    
Version: 3.3.0CC: acathrow, bazulay, dfediuck, iheim, lsvaty, mavital, oramraz, Rhev-m-bugs, yeylon
Target Milestone: ---Keywords: Triaged
Target Release: 3.3.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: sla
Fixed In Version: is22 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: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1032811    

Description Lukas Svaty 2013-10-15 09:56:52 UTC
Description of problem:
adding watchdog to template is not supported via restapi returning HTTP Error code 405 Method not allowed

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

How reproducible:
100%

Steps to Reproduce:
1. Add/update watchdog via RESTAPI to template

Actual results:
HTML Error code 405

Expected results:
HTML code 200

Additional info:
curl -X POST -H "Accept: application/xml" -H 
"Content-Type: application/xml" -u admin@internal:123456 --cacert ca.crt -d "<watchdogs>
 <watchdog>
  <model>i6300esb</model>
  <action>reset</action>
 </watchdog>
</watchdogs>" 
https://ls-rhevm33.rhev.lab.eng.brq.redhat.com:443/api/templates/18e7869a-ae1a-4164-8b60-f71913014f0d/watchdogs

<html><head><title>JBoss Web/7.2.2.Final-redhat-1 - JBWEB000064: Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 405 - </h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000067: Status report</p><p><b>JBWEB000068: message</b> <u></u></p><p><b>JBWEB000069: description</b> <u>JBWEB000125: The specified HTTP method is not allowed for the requested resource.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.2.2.Final-redhat-1</h3></body></html>


also after adding watchdog to template in webadmin, api shows in 
/api/templates/18e7869a-ae1a-4164-8b60-f71913014f0d/watchdogs:

<watchdogs>
 <watchdog href="/api/vms/18e7869a-ae1a-4164-8b60-f71913014f0d/watchdogs/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000">
  <vm href="/api/vms/18e7869a-ae1a-4164-8b60-f71913014f0d" id="18e7869a-ae1a-4164-8b60-f71913014f0d"/>
  <model>i6300esb</model>
  <action>reset</action>
 </watchdog>
</watchdogs>

why is there a link to api/vms (href="/api/vms") in watchdog templates? and subelement vm?

also tried removing this watchdog from template in webadmin and trying to add it via RESTAPI with no success

Comment 1 Gilad Chaplik 2013-10-21 15:52:33 UTC
hi, 

Looks like an add/update should be performed on a single watchdog node (i.e. without <watchdogs></watchdogs> tags). can you verify (it works the same for vm and template).

For the second issue, I see there is a problem with it in the code. I'll consult Michael Pasternak, about it.

thanks :)

Comment 2 Lukas Svaty 2013-10-22 07:35:31 UTC
Verified the first part and it seems to be working. Watchdog added successfully to template when I removed <watchdogs> tags from HTTP request.

If the second part is OK with Michael this should be CLOSED as NOTABUG

Comment 3 Gilad Chaplik 2013-10-24 14:29:53 UTC
(In reply to Lukas Svaty from comment #2)
> Verified the first part and it seems to be working. Watchdog added
> successfully to template when I removed <watchdogs> tags from HTTP request.
> 
> If the second part is OK with Michael this should be CLOSED as NOTABUG

I guess that we can remove the needinfo, talked with Michael, and I'm uploading a fix for the second issue.
Also changing the bug title to sth less frightening :)

Comment 4 Lukas Svaty 2013-11-15 12:24:20 UTC
tested in is23

Comment 5 Itamar Heim 2014-01-21 22:30:00 UTC
Closing - RHEV 3.3 Released

Comment 6 Itamar Heim 2014-01-21 22:30:02 UTC
Closing - RHEV 3.3 Released

Comment 7 Itamar Heim 2014-01-21 22:32:59 UTC
Closing - RHEV 3.3 Released