(octavia_client, deleted_lbs)
Wait for the loadbalancers to be deleted.

    Load balancer deletion API in Octavia is asynchronous so that the called
    needs to wait if it wants to guarantee the load balancer to be deleted.
    The timeout is necessary to avoid waiting infinitely.
Wait for the loadbalancers to be deleted.
Wait for the loadbalancers to be deleted .
def wait_for_lb_deleted(octavia_client, deleted_lbs):
    """Wait for the loadbalancers to be deleted.

    Load balancer deletion API in Octavia is asynchronous so that the called
    needs to wait if it wants to guarantee the load balancer to be deleted.
    The timeout is necessary to avoid waiting infinitely.
    """
    timeout = CONF.cluster.pre_delete_lb_timeout
    start_time = time.time()

    while True:
        lbs = octavia_client.load_balancer_list().get("loadbalancers", [])
        lbIDs = set(
            [lb["id"]
             for lb in lbs if lb["provisioning_status"] != "DELETED"]
        )
        if not (deleted_lbs & lbIDs):
            break

        if (time.time() - timeout) > start_time:
            raise Exception("Timeout waiting for the load balancers "
                            "%s to be deleted." % deleted_lbs)

        time.sleep(1)
def wait_for_lb_deleted ( octavia_client , deleted_lbs ) : timeout = CONF . cluster . pre_delete_lb_timeout start_time = time . time ( ) while True : lbs = octavia_client . load_balancer_list ( ) . get ( "loadbalancers" , [ ] ) lbIDs = set ( [ lb [ "id" ] for lb in lbs if lb [ "provisioning_status" ] != "DELETED" ] ) if not ( deleted_lbs & lbIDs ) : break if ( time . time ( ) - timeout ) > start_time : raise Exception ( "Timeout waiting for the load balancers " "%s to be deleted." % deleted_lbs ) time . sleep ( 1 )