Bug 536579 (RHQ-914) - Agent deletion, either implicit or explicit
Summary: Agent deletion, either implicit or explicit
Keywords:
Status: CLOSED NEXTRELEASE
Alias: RHQ-914
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 1.1
Hardware: All
OS: All
medium
medium
Target Milestone: ---
: ---
Assignee: John Mazzitelli
QA Contact: Corey Welton
URL: http://jira.rhq-project.org/browse/RH...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-10-01 15:53 UTC by Jay Shaughnessy
Modified: 2009-08-03 20:02 UTC (History)
0 users

Fixed In Version: 1.3
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Any
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Jay Shaughnessy 2008-10-01 15:53:00 UTC
Version 1.0 saw the removal of agent deletion (rhq_agent row removal from the db) in response to several issues around agent/server synchronization (see RHQ-124).  This can be problematic in HA since all agents are considered when distributing agent load across servers.  It's only an issue when lots of platforms are uninventoried, since those are the agent entries that will be in the db but not utilized.

Improvements in resource synchronization may allow us to return agent deletion to be part of the platform uninventory logic. This would be the best solution.  Aother option would be explicit deletion of agents via HAAC.  As a workaround, direct SQL could be executed to clean out dead agents (those with no child resources.


Comment 1 Greg Hinkle 2008-10-01 16:01:00 UTC
SQL to clean out agents with no resources:

delete from RHQ_FAILOVER_DETAILS where id in (select failoverli0_.id from RHQ_FAILOVER_DETAILS failoverli0_ inner join RHQ_FAILOVER_LIST failoverli1_ on failoverli0_.FAILOVER_LIST_ID=failoverli1_.ID where failoverli1_.AGENT_ID not in (select resource2_.AGENT_ID from RHQ_RESOURCE resource2_))
;
delete from RHQ_FAILOVER_LIST failoverli0_ where failoverli0_.AGENT_ID not in (select resource1_.AGENT_ID from RHQ_RESOURCE resource1_)
;
delete from RHQ_AGENT a where a.id not in (select res.AGENT_ID from RHQ_RESOURCE res) 

This can be used to cleanup if you've got a lot of stranded agent records messing up HA. Can be run from /admin/test/sql.jsp

Comment 2 Greg Hinkle 2008-10-16 13:45:50 UTC
Targeting fix due to support case

Comment 3 John Mazzitelli 2008-10-16 15:04:43 UTC
the original code that did this can be seen by doing an svn diff on ResourceManagerBean, svn rev 597 and 639 - the change is to method "public List<Integer> deleteResource(Subject user, Integer resourceId)"


Comment 4 John Mazzitelli 2008-12-03 22:51:06 UTC
Can we please fix this?

We might also want a way to change an agent's name (RHQ_AGENT.name) in the case people want to/need to change the agent's internal name.

Comment 5 John Mazzitelli 2008-12-10 17:01:08 UTC
this is needed in order to change the agent's internal name. If we fix this issue, then RHQ-1245 might not be needed.

Comment 6 John Mazzitelli 2009-05-01 15:23:45 UTC
we must fix this in the next release. too many people are running into issues when they need to purge agents.

Comment 7 John Mazzitelli 2009-05-01 16:29:29 UTC
agent is now purged from rhq_agent and the failover tables

Comment 8 John Mazzitelli 2009-08-03 19:58:12 UTC
to test

import an agent
shutdown the agent
delete the agent's platform
select * from rhq_agent and make sure the agent row is deleted

Comment 9 Corey Welton 2009-08-03 20:02:21 UTC
QA Verified, after platform is removed, running the sql listed above shows that agent is gone.


Comment 10 Red Hat Bugzilla 2009-11-10 21:19:31 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-914
This bug relates to RHQ-1187
This bug incorporates RHQ-1245



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