Bug 815253 - Operation completion wait time hardcoded to 10s in the CLI
Operation completion wait time hardcoded to 10s in the CLI
Status: NEW
Product: RHQ Project
Classification: Other
Component: CLI (Show other bugs)
Unspecified Unspecified
medium Severity unspecified (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2012-04-23 04:24 EDT by Lukas Krejci
Modified: 2012-04-23 12:10 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Lukas Krejci 2012-04-23 04:24:31 EDT
Description of problem:

When one invokes an operation on a resource using its proxy (i.e. invoke an operation on the resource returned from the ProxyFactory.getResource()), the maximum time the method waits for the operation completion is hardcoded to 10s.

This is non-optimal as there are a number of operations that take more time than that.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Pick a long lasting operation ("update all plugins" or RHQ agent resource, start on AS5 resource, etc).
2. in the cli:
var r = ProxyFactory.getResource(<ID_OF_THE_RESOURCE>)
Actual results:
In the CLI, if the operation doesn't complete in 10s, the method just returns null. There is no indication if that is the expected outcome of the operation or any other way provided to get at the status of the operation.

Expected results:
There should be a way of waiting on the operation to complete when using resource proxies. The proxies are about providing convenience methods to the users but in this case I think we're hiding too much detail and don't provide the user to get at the information s/he needs.

Additional info:

I think these changes should do it:

1) add methods on ProxyFactory:

setOperationMaxWaitTime(int) - this would set the max wait time on any subsequent resource operation invocation

int getOperationMaxWaitTime() - this would return the max wait time on operation invocations so that callers can get at that information should they need it for some reason.

2) The invocation of the operation through the proxy factory would throw an exception when max wait time would be exceeded:


3) The above exception would have methods to wait for the operation to complete:

OperationRequestStatus getOperationStatus() - get the status of the operation

void waitForOperationToComplete(int nofSeconds) - wait at most given time for the op to complete

Configuration waitUntilOperationCompletes() - wait until the op completes and return its results

Configuration getOperationResult() - return the op results if it completed

The following methods are provided so that the catch-site of the exception can get at the information about the operation being executed:

Resource getResource() - the resource that the operation is invoked upon

String getOperationName() - the name of the operation

Configuration getOperationParameters() - the parameters provided to the operation

With this approach we make sure that no changes are needed to the scripts that don't invoke long lasting operations but provide a way for the script writers to change their scripts to use proxy factories instead of "raw" remote API interrogation to wait for long lasting operations.
Comment 1 Mike Foley 2012-04-23 12:10:58 EDT
setting priority to medium per BZ triage 4/23 (crouch, santos, oleary, foley)

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