def reserve_vlanid():
 LOG.debug(_('reserve_vlanid() called'))
 session = db.get_session()
 try:
  rvlan = session.query(network_models_v2.VlanID).filter_by(vlan_used=False).first()
  if (not rvlan):
   raise exc.NoResultFound
  rvlanid = session.query(network_models_v2.VlanID).filter_by(vlan_id=rvlan['vlan_id']).one()
  rvlanid['vlan_used'] = True
  session.merge(rvlanid)
  session.flush()
  return rvlan['vlan_id']
 except exc.NoResultFound:
  raise c_exc.VlanIDNotAvailable()

def reserve_vlanid ( ) : LOG . debug ( _ ( 'reserve_vlanid() called' ) ) session = db . get_session ( ) try : rvlan = session . query ( network_models_v2 . VlanID ) . filter_by ( vlan_used = False ) . first ( ) if ( not rvlan ) : raise exc . NoResultFound rvlanid = session . query ( network_models_v2 . VlanID ) . filter_by ( vlan_id = rvlan [ 'vlan_id' ] ) . one ( ) rvlanid [ 'vlan_used' ] = True session . merge ( rvlanid ) session . flush ( ) return rvlan [ 'vlan_id' ] except exc . NoResultFound : raise c_exc . VlanIDNotAvailable ( )
reserves the first unused vlanid .