Bug 536579 - (RHQ-914) Agent deletion, either implicit or explicit
Agent deletion, either implicit or explicit
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: John Mazzitelli
Corey Welton
: Improvement
Depends On:
  Show dependency treegraph
Reported: 2008-10-01 11:53 EDT by Jay Shaughnessy
Modified: 2009-08-03 16:02 EDT (History)
0 users

See Also:
Fixed In Version: 1.3
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
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 Jay Shaughnessy 2008-10-01 11:53:00 EDT
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 12:01:00 EDT
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 09:45:50 EDT
Targeting fix due to support case
Comment 3 John Mazzitelli 2008-10-16 11:04:43 EDT
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 17:51:06 EST
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 12:01:08 EST
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 11:23:45 EDT
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 12:29:29 EDT
agent is now purged from rhq_agent and the failover tables
Comment 8 John Mazzitelli 2009-08-03 15:58:12 EDT
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 16:02:21 EDT
QA Verified, after platform is removed, running the sql listed above shows that agent is gone.
Comment 10 Red Hat Bugzilla 2009-11-10 16:19:31 EST
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.