Skip to content

Commit

Permalink
lxd/network/ovn: Check uplink IP limits on validateUplinkNetwork
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Dec 10, 2024
1 parent 7f4c8bd commit 2817b94
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lxd/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,16 @@ func (n *ovn) validateUplinkNetwork(p *api.Project, uplinkNetworkName string) (s
uplinkNetworkName = allowedUplinkNetworks[0]
}

// Check project quota for uplink IPs in this uplink after confirming the uplink is allowed.
quotaAvailable, err := n.projectUplinkIPQuotaAvailable(p, uplinkNetworkName)
if err != nil {
return "", err
}

if !quotaAvailable {
return "", fmt.Errorf("Project %s's quota for uplink IPs on network %s is exhausted", p.Name, uplinkNetworkName)
}

return uplinkNetworkName, nil
}

Expand Down

0 comments on commit 2817b94

Please sign in to comment.