示例#1
0
 def test_remove_probe_from_loadbalancer(self, mock_f1, mock_f2):
     cmd.remove_probe_from_loadbalancer(self.ctx, 'fakesf', self.probe)
     self.assertTrue(mock_f1.called, "delete_probe not called")
     self.assertTrue(mock_f2.called,
                     "remove_probe_from_server_farm not called")
     mock_f1.assert_called_once_with(self.ctx, self.probe)
     mock_f2.assert_called_once_with(self.ctx, 'fakesf', self.probe)
示例#2
0
def lb_delete_probe(conf, lb_id, probe_id):
    lb = db_api.loadbalancer_get(conf, lb_id)
    sf = db_api.serverfarm_get_all_by_lb_id(conf, lb_id)[0]
    probe = db_api.probe_get(conf, probe_id)
    db_api.probe_destroy(conf, probe_id)
    device_driver = drivers.get_device_driver(conf, lb['device_id'])
    with device_driver.request_context() as ctx:
        commands.remove_probe_from_loadbalancer(ctx, sf, probe)
    return probe_id