Bug 972756
| Summary: | GET operation history right after scheduling operation returns 404 if client is too fast | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Libor Zoubek <lzoubek> | ||||
| Component: | REST | Assignee: | Heiko W. Rupp <hrupp> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 4.8 | CC: | mazz, theute | ||||
| Target Milestone: | --- | ||||||
| Target Release: | RHQ 4.9 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2014-03-26 08:31:31 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: | |||||||
| Attachments: |
|
||||||
|
Description
Libor Zoubek
2013-06-10 14:20:32 UTC
The underlying issue seems to be that the history item is not created by the org.rhq.enterprise.server.operation.OperationManagerBean#scheduleResourceOperation method but from the Quartz-triggered org.rhq.enterprise.server.operation.ResourceOperationJob#execute method, which leaves a time gap in between that you are running into with the fast calls. We never had issues on the UI, as humans are just slow enough. We can work around that limitation inside the REST-api, but should probably just create the history item with state "in progress" directly at job creation time. The quartz job can then update it at will. Created attachment 786576 [details]
Proposed patch
Mazz, could you please review that proposed patch? (In reply to Heiko W. Rupp from comment #5) > Mazz, could you please review that proposed patch? The only question I have is the following: 355 public void setStartedTime(long startedTime) { 356 if (this.startedTime != 0) { 357 throw new IllegalArgumentException("Can only start an operation once"); 358 } 359 this.startedTime = startedTime; Is this throwing an exception here purposefully to abort what the OperationManagerBean was doing? I was wondering if you shouldn't just let the operation manager continuing doing what its doing - just don't set the started time and leave it as-is. However, I think you may have done this on purpose because you really don't want the history item touched when this happens so you really do want to abort (??) Other than that question, it looks OK to me, especially if you can confirm that all unit tests and itests pass with this change. Throwing the exception is following the setStartedTime() method, which does that as well. I basically need to set the started time once the Quartz job has started working and is calling into OperationManager.updateHistory, which is why I need the method with parameter. master 1cd277b34e9 Bulk closing now that 4.10 is out. If you think an issue is not resolved, please open a new BZ and link to the existing one. |