Bug 1257075 - Not possible to add sub step of step via REST
Summary: Not possible to add sub step of step via REST
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Moti Asayag
QA Contact: Ondra Machacek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-26 08:47 UTC by Ondra Machacek
Modified: 2016-04-20 01:36 UTC (History)
11 users (show)

Fixed In Version: 3.6.0-12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-20 01:36:31 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 45547 0 master MERGED engine: Revert JPA Never
oVirt gerrit 45586 0 ovirt-engine-3.6 MERGED engine: Revert JPA Never

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.


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