Bug 1404051

Summary: End external job expects a status to be provided, but it's not declared in the api model
Product: [oVirt] ovirt-engine Reporter: Moti Asayag <masayag>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Aleksei Slaikovskii <aslaikov>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: bugs, gklein, juan.hernandez, mperina, oourfali
Target Milestone: ovirt-4.1.0-betaFlags: rule-engine: ovirt-4.1+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
gklein: testing_ack+
Target Release: 4.1.0.2   
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-02-01 14:48:20 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 Moti Asayag 2016-12-12 23:56:37 UTC
Description of problem:
The 'status' parameter is mandatory for terminating an external job, however it is not described anywhere.

In addition, even if the status is set, the final status set to the job might not match the one provided by the user.
i.e. if the user asked to terminate a job as 'aborted', it will be marked as 'failed'.

Version-Release number of selected component (if applicable):
4.1.master

How reproducible:
always

Steps to Reproduce:
1. send the following request to terminate a job:

  <action>
    <force>true</force>
  </action>

Actual results:
The request failed due to incomplete parameter.

Expected results:
The model should declare on that parameter.

Additional info:

The 'status' for terminating an external job via the api is mandatory:
(taken from BackendJobResource.java)
public Response end(Action action) {
        validateParameters(action, "status");
  ...
}


However, the model (Job.java) doesn't define such parameter for the end-job request:

interface End {
        @In Boolean force();
        @In Boolean async();
    }

Comment 1 Juan Hernández 2016-12-16 13:15:31 UTC
I believe that the right way to solve this issue is to add a new 'succeeded' parameter to the operation that ends the job. That parameter should be optional, and by default it should be `true`. Same for the 'step'. The following patch documents that in the specification of the API:

  Add 'succeeded' parameter to Job.end
  https://gerrit.ovirt.org/68600

And the following patch implements it in the server:

  restapi: Add 'succeeded' parameter to Job.end
  https://gerrit.ovirt.org/68605

Comment 2 Aleksei Slaikovskii 2017-01-30 16:04:41 UTC
Verified on ovirt-engine-4.1.1-0.0.master