Skip to content

Commit

Permalink
system: send states before takeover
Browse files Browse the repository at this point in the history
Send states to the new daemon to restore.

Signed-off-by: Huang Jianan <[email protected]>
  • Loading branch information
mofishzz committed Feb 27, 2023
1 parent 038023a commit c3bacbe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/system/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"regexp"
"strconv"
"strings"
"time"

"github.com/gorilla/mux"
"github.com/pkg/errors"
Expand Down Expand Up @@ -300,6 +301,7 @@ func (sc *Controller) upgradeNydusDaemon(d *daemon.Daemon, c upgradeRequest) err

var new daemon.Daemon
new.States = d.States
new.Supervisor = d.Supervisor
new.CloneInstances(d)

s := path.Base(d.GetAPISock())
Expand All @@ -316,6 +318,11 @@ func (sc *Controller) upgradeNydusDaemon(d *daemon.Daemon, c upgradeRequest) err
return err
}

su := manager.SupervisorSet.GetSupervisor(d.ID())
if err := su.SendStatesTimeout(time.Second * 10); err != nil {
return errors.Wrap(err, "Send states")
}

if err := cmd.Start(); err != nil {
return errors.Wrap(err, "start process")
}
Expand Down

0 comments on commit c3bacbe

Please sign in to comment.