def get_delete_health_monitor_flow(self, topology): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) delete_hm_flow.add( vthunder_tasks.VthunderInstanceBusy( requires=a10constants.COMPUTE_BUSY)) delete_hm_flow.add( database_tasks.MarkHealthMonitorPendingDeleteInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( model_tasks.DeleteModelObject( rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) if topology == constants.TOPOLOGY_ACTIVE_STANDBY: delete_hm_flow.add( vthunder_tasks.GetMasterVThunder( name=a10constants.GET_MASTER_VTHUNDER, requires=a10constants.VTHUNDER, provides=a10constants.VTHUNDER)) delete_hm_flow.add(self.get_delete_health_monitor_vthunder_subflow()) delete_hm_flow.add( database_tasks.DeleteHealthMonitorInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.DecrementHealthMonitorQuota( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.UpdatePoolMembersOperatingStatusInDB( requires=constants.POOL, inject={constants.OPERATING_STATUS: constants.NO_MONITOR})) delete_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) delete_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) delete_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_LOCAL_PARTITION, requires=(a10constants.VTHUNDER))) delete_hm_flow.add( vthunder_tasks.WriteMemory( name=a10constants.WRITE_MEM_FOR_SHARED_PARTITION, requires=(a10constants.VTHUNDER, a10constants.WRITE_MEM_SHARED_PART))) delete_hm_flow.add( a10_database_tasks.SetThunderUpdatedAt( requires=(a10constants.VTHUNDER))) return delete_hm_flow
def get_delete_health_monitor_flow(self): """Create a flow to delete a health monitor :returns: The flow for deleting a health monitor """ delete_hm_flow = linear_flow.Flow(constants.DELETE_HEALTH_MONITOR_FLOW) delete_hm_flow.add( lifecycle_tasks.HealthMonitorToErrorOnRevertTask(requires=[ constants.HEALTH_MON, constants.LISTENERS, constants.LOADBALANCER ])) delete_hm_flow.add( database_tasks.MarkHealthMonitorPendingDeleteInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( model_tasks.DeleteModelObject( rebind={constants.OBJECT: constants.HEALTH_MON})) delete_hm_flow.add( a10_database_tasks.GetVThunderByLoadBalancer( requires=constants.LOADBALANCER, provides=a10constants.VTHUNDER)) delete_hm_flow.add( health_monitor_tasks.DeleteHealthMonitor( requires=[constants.HEALTH_MON, a10constants.VTHUNDER])) delete_hm_flow.add( database_tasks.DeleteHealthMonitorInDB( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.DecrementHealthMonitorQuota( requires=constants.HEALTH_MON)) delete_hm_flow.add( database_tasks.UpdatePoolMembersOperatingStatusInDB( requires=constants.POOL, inject={constants.OPERATING_STATUS: constants.NO_MONITOR})) delete_hm_flow.add( database_tasks.MarkPoolActiveInDB(requires=constants.POOL)) delete_hm_flow.add( database_tasks.MarkLBAndListenersActiveInDB( requires=[constants.LOADBALANCER, constants.LISTENERS])) return delete_hm_flow