Bug 849711 (PM-333, PRODMGT-333)

Summary: [Feature] Need a simple method to remove agent from RHQ server
Product: [JBoss] JBoss Operations Network Reporter: Larry O'Leary <loleary>
Component: InventoryAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: urgent Docs Contact:
Priority: high    
Version: JON 3.1.2CC: hrupp, mazz
Target Milestone: ER01Keywords: FutureFeature
Target Release: JON 3.2.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Feature Request
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 Flags
screenshot of the warning that pops up when asking to delete agents none

Description Larry O'Leary 2012-08-20 16:33:55 UTC
Description of problem:
When an agent is no longer installed or needs to be removed from the RHQ server the user currently has to import the agent's platform into inventory and then remove the platform from inventory to remove the agent's registration/association with the server.

Instead, a button or other feature should be added that will allow a user to de-register and remove the agent's inventory from the agent topology page. Essentially, the feature would remove the agent, the agent's security token, and all the agent's inventory (COMMITTED and/or NEW). Obviously, usage of the feature should warn the user that it can not be undone and that all associated inventory will be lost.

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

How reproducible:
Always

Steps to Reproduce:
1. Start an agent and register it with the RHQ server
2. Wait for the agent to perform its discovery
3. Shutdown the agent and delete the installation as if the agent shouldn't never have been installed.
  
Actual results:
Agent remains in a DOWN state in the RHQ agent topology page
Discovery queue continues to show discovered resources

Expected results:
A server side method should be invoked to remove the agent along with its inventory that is being displayed in the discovery queue.

Comment 1 Larry O'Leary 2012-08-20 16:39:02 UTC
Bug 535246 was supposed to address this but it does not address the issue pertaining to uncommitted inventory from the agent.

Comment 2 Charles Crouch 2013-02-11 21:28:31 UTC
Talking to Larry a bit more on this:

-If we ignore the discovery queue for a moment, this request is essentially the same as removing the platform from inventory: since this will remove all resources associated with the agent and also remove the row from the rhq-agent table.

-The problem is mostly for platforms/agents which are only in the discovery queue. You can't remove something from the db via the discovery queue. Instead you have to import it into the inventory and then remove it. So this RFE is really about removing the need for this workaround.

-There is a theoretical problem that someone could register an agent and then cancel it before the agent has a chance to send up its inventory report. So there would be a row in rhq-agent but nothing in the discovery queue. I don't know if this is actually feasible but would be nice if we handle this issue too.

In terms of solutions I'm kind of liking Larry's suggestion more of getting rid of the discovery queue entirely and just have all resources (including those not yet imported) in the inventory list (perhaps unclickable). From there they could be imported or deleted as necessary.

Comment 3 Charles Crouch 2013-03-08 04:44:56 UTC
Moving RFE to JON product bugzilla

Comment 4 Charles Crouch 2013-03-08 04:51:29 UTC
In the cold light of day I think dropping the entire discovery queue is probably a little overkill for this RFE, though I think it would make an interesting RFE on its own. 

The simplest option as mentioned in the original PRODMGT issue seems to be add a Delete button (and warning) to the topology pages. That will either 
i) delete the platform from inventory, if its there
or
ii) delete all vestiges of the agent from the discovery queue and anywhere else, assuming its not yet been imported.

Comment 6 John Mazzitelli 2013-03-13 14:16:48 UTC
git commit to master: 

there is now a "delete" button on the Administration>Agents page. Select one or more agents, press the "delete" button and the agent's platform and child resources are uninventoried and the agent row in the RHQ_AGENT table is deleted. Once you click delete and the server does its thing, the UI page will refresh and the agents should no longer show up in the list.

If the agent is still running, then within a short time you may see the agent come back again and its new discovered inventory show up in the discovery queue.

Comment 7 John Mazzitelli 2013-03-13 14:18:36 UTC
(In reply to comment #6)
> git commit to master: 

opps, forgot to put in the actual hash - git commit to master:

c9287f6c75b16712c45f03d24ea363524921ae39

Comment 8 John Mazzitelli 2013-04-17 20:15:00 UTC
Created attachment 737002 [details]
screenshot of the warning that pops up when asking to delete agents

I documented this feature on my blog here:

http://management-platform.blogspot.com/2013/03/deleting-rhq-agent-made-easier.html

(the attached screenshot is also in that blog)

Comment 9 Charles Crouch 2013-04-17 20:34:09 UTC
I think the text of the warning popup should be stronger. It should read

"This will deregister the selected agents and uninventory their corresponding platforms and all other resources associated with them. There is no way to undo this action. Are you sure you want to do this?

Comment 10 John Mazzitelli 2013-04-17 20:50:48 UTC
git commit to master: 1e284420cfc176787040cd562f6bfa40a13cf257

Messages.properties change:

-view_adminTopology_agent_delete_confirm = This will delete the selected agents and uninventory any and all resources associated with them. Are you sure you want to do this?
+view_adminTopology_agent_delete_confirm = This will deregister the selected agents and uninventory their corresponding platforms and all other resources associated with them. There is no way to undo this action. Are you sure you want to do this?

Comment 11 Larry O'Leary 2013-04-17 21:12:01 UTC
Thanks mazz. Looks good. Of course seeing two words that don't actually exist in the dictionary in a message worries me but I am no grammar expert (deregister vs. uninentory).

Comment 12 Mike Foley 2013-09-04 20:51:03 UTC
Exit criteria for RFEs is a development demo to QE and GSS.  The demo is critical in initiating a converstion that leads to structured testcase development.

Assigning back to development until a developer demo is done.

Comment 13 Mike Foley 2013-09-04 21:01:54 UTC
Exit criteria for RFEs is a development demo to QE and GSS.  The demo is critical in initiating a converstion that leads to structured testcase development.

Assigning back to development until a developer demo is done.

Comment 14 Mike Foley 2013-09-04 21:03:09 UTC
Discussed with Mazz.  Agreed there is no need for a developer demo.  

QE to test as follows:
1)  http://management-platform.blogspot.com/2013/03/deleting-rhq-agent-made-easier.html
2)  its just navigating to Admin>Agents, selecting an agent, and clicking the "delete" button :)

Comment 15 Mike Foley 2013-09-05 19:08:15 UTC
this is still open.

QE work will be tracked here ...

https://engineering.redhat.com/trac/jon/ticket/673