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

Bug 1257075

Summary: Not possible to add sub step of step via REST
Product: Red Hat Enterprise Virtualization Manager Reporter: Ondra Machacek <omachace>
Component: ovirt-engineAssignee: Moti Asayag <masayag>
Status: CLOSED CURRENTRELEASE QA Contact: Ondra Machacek <omachace>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.6.0CC: bazulay, gklein, juan.hernandez, lsurette, oourfali, pstehlik, rbalakri, Rhev-m-bugs, srevivo, ykaul, ylavi
Target Milestone: ovirt-3.6.0-rc   
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.6.0-12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-20 01:36:31 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:
Attachments:
Description Flags
test log none

Description Ondra Machacek 2015-08-26 08:47:05 UTC
Created attachment 1067192 [details]
test log

Description of problem:


Version-Release number of selected component (if applicable):
rhevm-restapi-3.6.0-0.12.master.el6.noarch
rhevm-3.6.0-0.12.master.el6.noarch

How reproducible:
always

Steps to Reproduce:
1) Create job.
2) Create step under the new job.
3) Create sub step of step cretead in 2).

Actual results:
Status: 404
Reason: Not Found
Detail: Entity not found: 26152fe3-9c56-4e38-811c-73306a3420fe

Expected results:
sub step created successfully

Additional info:
The whole process with debug info is in attachment.

Comment 1 Juan Hernández 2015-08-26 11:36:58 UTC
I believe this is another manifestation of the transaction management issues that we have with jobs. When a step is created from the RESTAPI it is first created using the AddExternalStep command, which should return the identifier of the created step, in this case 26152fe3-9c56-4e38-811c-73306a3420fe. Then the RESTAPI retrieves the details of the step, using the GetStepByStepId query. Is this query that is failing, probably because the insert was done in a different transaction, ans wasn't committed.

I used the following script to reproduce:

---8<---
#!/usr/bin/python

from ovirtsdk.api import API
from ovirtsdk.xml import params

# Connect to the server:
api = API(
    url="https://rhevm36.example.com/ovirt-engine/api",
    username="admin@internal",
    password="redhat123",
    ca_file="/etc/pki/ovirt-engine/ca.pem",
    debug=True
)

# Create a job:
job = api.jobs.add(
    params.Job(
        description="myjob"
    )
)

# Create the first step:
first_step = job.steps.add(
    params.Step(
        description="first",
        type_="executing"
    )
)

# Create the second step:
second_step = job.steps.add(
    params.Step(
        description="second",
        type_="executing",
        parent_step=params.Step(
            id=first_step.get_id()
        )
    )
)

# Close the connection:
api.disconnect()
--->8---

Comment 2 Juan Hernández 2015-08-26 11:38:21 UTC
Note that this is probably a duplicate of bug 1253338 or bug 1254230.

Comment 3 Juan Hernández 2015-08-26 12:14:33 UTC
After applying the following two patches (the proposed solution for of bug 1253338 and bug 1254230) adding the sub step works correctly:

  core: Make JobRepository a @Singleton
  https://gerrit.ovirt.org/45319

  core: Index entity managers by transaction
  https://gerrit.ovirt.org/45327

So most probably this is a duplicate. However I'd leave it open so that this specific scenario can be verified by QE.