Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop networks during cluster evacuations #747

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading