def reserve_provider_segment(self, context, segment):
     if self.is_partial_segment(segment):
         alloc = self.allocate_partially_specified_segment(context)
         if not alloc:
             raise exc.NoNetworkAvailable
     else:
         segmentation_id = segment.get(api.SEGMENTATION_ID)
         alloc = self.allocate_fully_specified_segment(
             context, vxlan_vni=segmentation_id)
         if not alloc:
             raise exc.TunnelIdInUse(tunnel_id=segmentation_id)
     return {api.NETWORK_TYPE: p_const.TYPE_VXLAN,
             api.PHYSICAL_NETWORK: None,
             api.SEGMENTATION_ID: alloc.vxlan_vni}
Example #2
0
 def reserve_provider_segment(self, context, segment):
     if self.is_partial_segment(segment):
         alloc = self.allocate_partially_specified_segment(context)
         if not alloc:
             raise exc.NoNetworkAvailable()
     else:
         segmentation_id = segment.get(api.SEGMENTATION_ID)
         alloc = self.allocate_fully_specified_segment(
             context, **{self.segmentation_key: segmentation_id})
         if not alloc:
             raise exc.TunnelIdInUse(tunnel_id=segmentation_id)
     return {api.NETWORK_TYPE: self.get_type(),
             api.PHYSICAL_NETWORK: None,
             api.SEGMENTATION_ID: getattr(alloc, self.segmentation_key),
             api.MTU: self.get_mtu()}