disassociating a health monitor

asked 2013-12-05 17:24:22 -0500

anonymous user

Anonymous

updated 2014-01-22 15:12:26 -0500

anonymous user

Anonymous

In the loadbalancer plugin, we have this following function which is called for both the delete and dissociation of the health monitor from the pool (Correct me if I am wrong). I am having problem with differentiating both the calls in the driver, as one will delete the health monitor other will just disassociates the health monitor. Any clue how can I differentiate both the operations ?

def delete_health_monitor(self, context, id):
    with context.session.begin(subtransactions=True):
        hm = self.get_health_monitor(context, id)
        qry = context.session.query(
            ldb.PoolMonitorAssociation
        ).filter_by(monitor_id=id).join(ldb.Pool)
        for assoc in qry:
            driver = self._get_driver_for_pool(context, assoc['pool_id'])
            driver.delete_pool_health_monitor(context,
                                              hm,
                                              assoc['pool_id'])
    super(LoadBalancerPlugin, self).delete_health_monitor(context, id)

Out of curiosity, isn't it be easy if we had two separate function for doing delete and disassociate ?

edit retag flag offensive close delete