Bug 1132246

Summary: [GUI over REST API gaps] RunMultipleActions
Product: Red Hat Enterprise Virtualization Manager Reporter: Einav Cohen <ecohen>
Component: ovirt-engine-restapiAssignee: Nobody <nobody>
Status: CLOSED WONTFIX QA Contact: Shai Revivo <srevivo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: bazulay, ecohen, gklein, iheim, juan.hernandez, lsurette, oramraz, rbalakri, Rhev-m-bugs, yeylon, ykaul
Target Milestone: ---   
Target Release: 3.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: ux
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-15 14:18:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1132506    

Description Einav Cohen 2014-08-21 01:44:30 UTC
there isn't anything parallel to RunMultipleActions in the rest api today. 

this may be initially worked-around in the JavaScript SDK itself (simply several requests will be invoked instead of a single request to multiple pieces of data), however we may need to take into consideration:
- potential performance regressions that may occur as a result.
- AFAIK, MultipleActionsRunner will no longer be invoked, this may badly affect the results of some actions.

Comment 1 Einav Cohen 2014-08-21 01:47:27 UTC
marking as 'ux' (which will be in charge at least for the initial workaround), however we may need 'infra's involvement in making the MultipleActionsRunner "invokable" somehow via the rest api (maybe it already is, not sure).

Comment 2 Juan Hernández 2014-11-20 16:31:16 UTC
I think it is impossible to do this in a REST fashion.

The only solution I can imagine is to add a mechanism to tell the RESTAPI that a requested action isn't intended to run immediately, but to be remembered and added to a set of actions to run later together. For example:

1. Create a set of actions (would need a new top level collection in the RESTAPI):

  POST /actionsets
  <action_set/>

This will just create an empty set of actions and assign it an identifier used to refer to the set later:

  <action_set id="12345"/>

2. Run an action, but specifying that it is not to be executed immediately, but to be added to an action set:

  POST /disks/{disk:id}/move
  <action>
    <storage_domain id="..."/>
    <action_set id="12345"/>
  </action>

This step may be repeated multiple times.

3. Tell the RESTAPI to run all the actions in a set:

  POST /actionsets/{actionset:id}/run

I see several difficulties with any mechanism that groups RESTAPI actions:

A. Not all RESTAPI actions are cleanly translated to backend actions. Most of them perform validations before actually running the backend action. Those validations would still run in step 2, and the outcome would be potentially wrong in step 3. Take into account that the RESTAPI doesn't have a "can do, then do" model.

B. There is no simple way to determine how to translate the output of actions in step 3 into XML or JSON documents, as the context of what was the resource that executed the action is lost.

All in all, I strongly suggest to adjust the backend and the GUI so this isn't needed.