Skip to content

Commit

Permalink
lxd/network/driver/ovn: Prevent removal of uplink volatile IP setting…
Browse files Browse the repository at this point in the history
…s when associated network IP address is populated

Fixes #14531

Signed-off-by: Thomas Parrott <[email protected]>
  • Loading branch information
tomponline committed Jan 17, 2025
1 parent f2a4278 commit 8b4b0ea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lxd/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3211,6 +3211,20 @@ func (n *ovn) Update(newNetwork api.NetworkPut, targetNode string, clientType re
return nil // Nothing changed.
}

// Check that the uplink volatile IPs haven't been removed incorrectly.
for _, ipVersion := range []int{4, 6} {
networkAddrKey := "ipv" + strconv.Itoa(ipVersion) + ".address"
uplinkAddrKey := ovnVolatileUplinkIPv4

if ipVersion == 6 {
uplinkAddrKey = ovnVolatileUplinkIPv6
}

if newNetwork.Config[uplinkAddrKey] == "" && newNetwork.Config[networkAddrKey] != "" {
return fmt.Errorf("Uplink address key %q cannot be empty when network address key %q is populated", uplinkAddrKey, networkAddrKey)
}
}

// If the network as a whole has not had any previous creation attempts, or the node itself is still
// pending, then don't apply the new settings to the node, just to the database record (ready for the
// actual global create request to be initiated).
Expand Down

0 comments on commit 8b4b0ea

Please sign in to comment.