Skip to content

Commit

Permalink
lxd/cluster: Replace deprecated Recover with ReconfigureMembership
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hershberger <wesley.hershberger@canonical.com>
  • Loading branch information
MggMuggins committed Oct 24, 2024
1 parent f8ddd2f commit 41ffd77
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lxd/cluster/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,16 +765,6 @@ func (g *Gateway) init(bootstrap bool) error {
options = append(options, dqlite.WithDialFunc(g.raftDial()))
}

server, err := dqlite.New(
info.ID,
info.Address,
dir,
options...,
)
if err != nil {
return fmt.Errorf("Failed to create dqlite server: %w", err)
}

// Force the correct configuration into the bootstrap node, this is needed
// when the raft node already has log entries, in which case a regular
// bootstrap fails, resulting in the node containing outdated configuration.
Expand All @@ -785,12 +775,22 @@ func (g *Gateway) init(bootstrap bool) error {
{ID: uint64(info.ID), Address: info.Address},
}

err = server.Recover(cluster)
err = dqlite.ReconfigureMembershipExt(dir, cluster)
if err != nil {
return fmt.Errorf("Failed to recover database state: %w", err)
}
}

server, err := dqlite.New(
info.ID,
info.Address,
dir,
options...,
)
if err != nil {
return fmt.Errorf("Failed to create dqlite server: %w", err)
}

err = server.Start()
if err != nil {
return fmt.Errorf("Failed to start dqlite server: %w", err)
Expand Down

0 comments on commit 41ffd77

Please sign in to comment.