Skip to content

Commit

Permalink
incusd/cluster: Disable networks during evacuation
Browse files Browse the repository at this point in the history
Signed-off-by: Abhiram824 <[email protected]>
  • Loading branch information
Abhiram824 authored and stgraber committed Apr 19, 2024
1 parent 5a0252c commit 7c9e3b0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 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

0 comments on commit 7c9e3b0

Please sign in to comment.