Bug 1257075 - Not possible to add sub step of step via REST
Not possible to add sub step of step via REST
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.6.0
Unspecified Unspecified
unspecified Severity high
: ovirt-3.6.0-rc
: 3.6.0
Assigned To: Moti Asayag
Ondra Machacek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-26 04:47 EDT by Ondra Machacek
Modified: 2016-04-19 21:36 EDT (History)
11 users (show)

See Also:
Fixed In Version: 3.6.0-12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-04-19 21:36:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
test log (11.73 KB, text/plain)
2015-08-26 04:47 EDT, Ondra Machacek
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 45547 master MERGED engine: Revert JPA Never
oVirt gerrit 45586 ovirt-engine-3.6 MERGED engine: Revert JPA Never

  None (edit)
Description Ondra Machacek 2015-08-26 04:47:05 EDT
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 07:36:58 EDT
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 07:38:21 EDT
Note that this is probably a duplicate of bug 1253338 or bug 1254230.
Comment 3 Juan Hernández 2015-08-26 08:14:33 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.