@require_admin_context
@_retry_on_deadlock
def quota_destroy_all_by_project(context, project_id, only_quotas=False):
 session = get_session()
 with session.begin():
  quotas = model_query(context, models.Quota, session=session, read_deleted='no').filter_by(project_id=project_id).all()
  for quota_ref in quotas:
   quota_ref.delete(session=session)
  if only_quotas:
   return
  quota_usages = model_query(context, models.QuotaUsage, session=session, read_deleted='no').filter_by(project_id=project_id).all()
  for quota_usage_ref in quota_usages:
   quota_usage_ref.delete(session=session)
  reservations = model_query(context, models.Reservation, session=session, read_deleted='no').filter_by(project_id=project_id).all()
  for reservation_ref in reservations:
   reservation_ref.delete(session=session)

@ require_admin_context @ _retry_on_deadlock def quota_destroy_all_by_project ( context , project_id , only_quotas = False ) : session = get_session ( ) with session . begin ( ) : quotas = model_query ( context , models . Quota , session = session , read_deleted = 'no' ) . filter_by ( project_id = project_id ) . all ( ) for quota_ref in quotas : quota_ref . delete ( session = session ) if only_quotas : return quota_usages = model_query ( context , models . QuotaUsage , session = session , read_deleted = 'no' ) . filter_by ( project_id = project_id ) . all ( ) for quota_usage_ref in quota_usages : quota_usage_ref . delete ( session = session ) reservations = model_query ( context , models . Reservation , session = session , read_deleted = 'no' ) . filter_by ( project_id = project_id ) . all ( ) for reservation_ref in reservations : reservation_ref . delete ( session = session )
destroy all quotas associated with a given project .