Skip to content
/ incus Public
forked from lxc/incus

Commit

Permalink
Merge pull request lxc#747 from Abhiram824/feat1
Browse files Browse the repository at this point in the history
Stop networks during cluster evacuations
  • Loading branch information
stgraber authored Apr 19, 2024
2 parents 43c20cc + 7c9e3b0 commit f2e3d04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
9 changes: 9 additions & 0 deletions cmd/incusd/api_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -3282,6 +3282,9 @@ func evacuateClusterMember(s *state.State, gateway *cluster.Gateway, r *http.Req
return err
}

// Stop networks after evacuation.
networkShutdown(s)

revert.Success()
return nil
}
Expand Down Expand Up @@ -3427,6 +3430,12 @@ func restoreClusterMember(d *Daemon, r *http.Request) response.Response {

metadata := make(map[string]any)

// Restart the networks.
err = networkStartup(d.State())
if err != nil {
return err
}

// Restart the local instances.
for _, inst := range localInstances {
// Don't start instances which were stopped by the user.
Expand Down
11 changes: 7 additions & 4 deletions cmd/incusd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -1462,10 +1462,13 @@ func (d *Daemon) init() error {
}

// Setup the networks.
logger.Infof("Initializing networks")
err = networkStartup(d.State())
if err != nil {
return err
if !d.db.Cluster.LocalNodeIsEvacuated() {
logger.Infof("Initializing networks")

err = networkStartup(d.State())
if err != nil {
return err
}
}

// Setup tertiary listeners that may use managed network addresses and must be started after networks.
Expand Down
1 change: 0 additions & 1 deletion internal/server/network/ovn/ovn_nb_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ type OVNRouterPeering struct {
TargetRouterRoutes []net.IPNet
}


// CreateLogicalRouter adds a named logical router.
// If mayExist is true, then an existing resource of the same name is not treated as an error.
func (o *NB) CreateLogicalRouter(ctx context.Context, routerName OVNRouter, mayExist bool) error {
Expand Down

0 comments on commit f2e3d04

Please sign in to comment.