Problem occures when a metric has more than one OID assigned. Then,
during the table unregistration, plugin thinks that there are some OIDs
left in the table and keeps index keys also registered. It's because
plugin registers all the OIDs for the particular metric, but unregisters only
the first one which is wrong.
Change-Id: I6daae1ceeebf30b98f22075940b29936ee3d110d
Signed-off-by: Mozejko, MarcinX <marcinx.mozejko@intel.com>
pthread_mutex_lock(&g_agent->agentx_lock);
+ int reg_oids = -1; /* Number of registered oids for given instance */
+
for (size_t i = 0; i < dd->oids_len; i++) {
if (td->index_oid.oid_len)
snmp_agent_unregister_oid_index(&dd->oids[i], *index);
else
snmp_agent_unregister_oid_string(&dd->oids[i], index_oid);
+
+ reg_oids =
+ snmp_agent_update_instance_oids(td->instance_oids, index_oid, -1);
}
/* Checking if any metrics are left registered */
- if (snmp_agent_update_instance_oids(td->instance_oids, index_oid, -1) > 0) {
+ if (reg_oids != 0) {
pthread_mutex_unlock(&g_agent->agentx_lock);
return;
}