Bug 1076104

Summary: There's no way to deploy plugin once it was marked as DELETED on server
Product: [Other] RHQ Project Reporter: Libor Zoubek <lzoubek>
Component: Core ServerAssignee: Lukas Krejci <lkrejci>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.10CC: hrupp, lkrejci, mazz, theute
Target Milestone: ---   
Target Release: RHQ 4.11   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1095799 (view as bug list) Environment:
Last Closed: 2014-07-21 10:13:25 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: 1022943, 1095799    

Description Libor Zoubek 2014-03-13 14:45:42 UTC
Description of problem:

When agent- (probably server- too) plugin is marked as deleted on server, there is no way to undelete it. In case I try to deploy plugin again, it fails.

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

How reproducible: always


Steps to Reproduce:
1. start your server, delete some plugin through UI -> Administration -> Agent plugins
2. copy same plugin (must be same file name/version as the one deleted) to $RHQ/plugins folder
3. check log

Actual results: It fails, server takes plugin, reads some parts of it, and then it deletes it, in the later stage it fails on this

ERROR [org.rhq.enterprise.server.core.StartupBean] (EJB default - 9) Plugin scan failed. Cause: java.lang.Exception:File [/data/rhq/master/dev-container/rhq-server/modules/org/rhq/server-startup/main/deployments/rhq.ear/rhq-downloads/rhq-plugins/rhq-platform-plugin-4.10.0-SNAPSHOT.jar] is not a valid jarfile -  it is either corrupted or file
has not been fully written yet.

Expected results:
User should be able to deploy previously deleted plugin

Additional info:

Plugin jar is deleted by AgentPluginScanner#removeDeletedPluginsFromFileSystem()

Comment 1 John Mazzitelli 2014-03-13 15:55:42 UTC
The reason why this workflow is here is due to HA environments. When you delete a plugin in an HA environment, we have to ensure all servers know about it. That's why the two step process of delete-purge.

This is documented in the wiki. Any solution for different workflows when deleting/purging plugins must work in an HA environment.

see https://docs.jboss.org/author/display/RHQ/Agent+Plugin+Administration#AgentPluginAdministration-PurgingPlugins and related docs.

Comment 2 Lukas Krejci 2014-03-14 10:29:58 UTC
While it is true that this needs to be a 2-step process, there's, imho, no reason why a user should be involved in it.

When they delete a plugin, the intention is most probably that they want it gone. Having to have to remember that once you click the delete button, you have to click "show deleted" and then select the deleted plugin and then hit "purge" (only after manually ensuring that there is no way other servers in HA can magically redeploy it) is I think on the border of a bug :)

I'm making this block BZ 1022943 because it makes working with plugins a part of our public API (both remote and rest). We need to streamline the workflows and make them easy and usable.

Comment 3 Heiko W. Rupp 2014-03-14 14:23:06 UTC
(In reply to John Mazzitelli from comment #1)
> The reason why this workflow is here is due to HA environments. When you

As Lukas says, the fact alone, that
a) deleted really means "mark for deletion"
b) you need to klick on "show deleted" (which makes no sense to me as non-native English speaker)
c) need to "really delete" 

is confusing as hell to everyone.

If we can not change the workflow itself,

a) renaming to "mark for deletion" or "prepare for deletion"
b) no hiding it then, so no "unhide" button needed
c) finally delete it

And if there is time needed between a) and c) for some background magic, then just 

1) keep that "really delete" button disabled until it can be used
2) add some "spinner" on the list of plugins that indicates that there is some backend processing happening.

Comment 4 John Mazzitelli 2014-04-22 17:30:59 UTC
pull request has been merged. I also did some trivial fixes after the merge, removed unused import, fixed indentation in db-upgrade.xml

git commit to master:

5283ef79ea58b21d47742863a975771ff8e8a434 (fix db-upgrade.xml)
6286a106ce898c32a3a5f60ac9d62f82f03b56d1 (remove bad import)
a637f1ee6a2d1cd424924d0b4350818ee6591ca8 (the main merge)

Comment 6 Heiko W. Rupp 2014-07-21 10:13:25 UTC
Bulk closing of RHQ 4.11 issues, now that RHQ 4.12 is out.

If you find an issue with those, please open a new BZ, linking to the old one.