diff --git a/lxd/network/driver_ovn.go b/lxd/network/driver_ovn.go index 30e265576dd5..8424e1d856b5 100644 --- a/lxd/network/driver_ovn.go +++ b/lxd/network/driver_ovn.go @@ -2049,6 +2049,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 }