Bug 1393459

Summary: Command execution context information is only partially persisted in the db
Product: [oVirt] ovirt-engine Reporter: Liron Aravot <laravot>
Component: BLL.InfraAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Jiri Belka <jbelka>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1.0CC: bugs, cmestreg, mavital, mgoldboi, mperina, oourfali
Target Milestone: ovirt-4.1.0-betaFlags: rule-engine: ovirt-4.1+
mavital: testing_plan_complete?
mgoldboi: planning_ack+
mperina: devel_ack+
pstehlik: 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:59:28 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 Liron Aravot 2016-11-09 15:26:31 UTC
Description of problem:
When commands are managed by the command coordinator infrastructure, the command context is cached in memory.
On engine restart, the commands context is rebuilt according the the information
persisted in the db.

Currently only the command step id/job id are persisted in the db, leading to having context objects with different properties values after restart (for example - the execution method). That causes to unexpected results under the tasks sub tab for command coordinator managed command. 

Expected results:
The command context after the restart should have the same properties values as before the restart.

Comment 1 Martin Perina 2016-11-22 12:32:03 UTC
Moving out of 4.1 release as it is a bit dangerous to change async task code in a short time before 4.1 feature freeze and we have not yet received any important flow which depend on this functionality

Comment 2 Liron Aravot 2016-11-22 12:44:51 UTC
Steps to reproduce:
1. Add a disk
2. Restart the engine after the task is created,  before the endAction() is called.

Result:
The job will never end.

Martin, the fix shouldn't be in the async tasks code but in the context/command entity. IMO we need to this in for 4.1.

Comment 3 Martin Perina 2016-11-22 13:19:40 UTC
Sorry, I've changed different bug by mistake, this one should be fixed in 4.1

Comment 4 Liron Aravot 2017-01-08 15:41:57 UTC
*** Bug 1408405 has been marked as a duplicate of this bug. ***

Comment 5 Jiri Belka 2017-01-25 12:15:16 UTC
ok, ovirt-engine-4.1.0.2-0.2.el7.noarch

action fired with `tail -f /var/log/ovirt-engine/engine.log | ^Ck '/EVENT_ID: USER_ADD_DISK/ { print "XXXXX"; system("systemctl restart ovirt-engine") }''

2017-01-25 13:07:21,474+01 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (default task-8) [379d0993] EVENT_ID: USER_ADD_DISK(2,020), Correlation ID: a4503ddd-7b34-4896-8d6e-9ec5dbe5b8f2, Job ID: 41fc2415-a9c9-4c15-ad7f-a4e4eaa151d7, Call Stack: null, Custom Event ID: -1, Message: Add-Disk operation of '___3' was initiated by admin@internal-authz.
2017-01-25 13:08:00,610+01 INFO  [org.ovirt.engine.core.dal.dbbroker.DbFacade] (ServerService Thread Pool -- 56) [] Initializing the DbFacade
2017-01-25 13:08:00,908+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 43) [] Initializing extension 'internal-authn'
2017-01-25 13:08:01,009+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 43) [] Initializing extension 'internal-authz'
2017-01-25 13:08:01,049+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 43) [] Initializing extension 'brq-ipa.rhev.lab.eng.brq.redhat.com-authn'
2017-01-25 13:08:01,802+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 43) [] Initializing extension 'brq-ipa.rhev.lab.eng.brq.redhat.com-authz'
2017-01-25 13:08:05,723+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 56) [] Initializing extension 'internal-authn'
2017-01-25 13:08:05,739+01 INFO  [org.ovirt.engine.core.extensions.mgr.ExtensionsManager] (ServerService Thread Pool -- 56) [] Initializing extension 'brq-ipa.rhev.lab.eng.brq.redhat.com-authn'
2017-01-25 13:08:06,821+01 INFO  [org.ovirt.engine.core.bll.scheduling.SchedulingManager] (ServerService Thread Pool -- 56) [a4503ddd-7b34-4896-8d6e-9ec5dbe5b8f2] Initializing Scheduling manager
2017-01-25 13:08:07,225+01 INFO  [org.ovirt.engine.core.bll.dwh.DwhHeartBeat] (ServerService Thread Pool -- 56) [a4503ddd-7b34-4896-8d6e-9ec5dbe5b8f2] Initializing DWH Heart Beat
2017-01-25 13:08:33,728+01 INFO  [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector] (DefaultQuartzScheduler2) [] EVENT_ID: USER_ADD_DISK_FINISHED_SUCCESS(2,021), Correlation ID: a4503ddd-7b34-4896-8d6e-9ec5dbe5b8f2, Job ID: 41fc2415-a9c9-4c15-ad7f-a4e4eaa151d7, Call Stack: null, Custom Event ID: -1, Message: The disk '___3' was successfully added.