Remove checkpoint_count from runsc wait --checkpoint

This is done because external callers are not able to know
the snapshot generation number from the outside.

PiperOrigin-RevId: 707979556
This commit is contained in:
Fabricio Voznika
2024-12-19 11:48:10 -08:00
committed by gVisor bot
parent f1656df6d6
commit fb730ff784
9 changed files with 140 additions and 83 deletions
+5 -7
View File
@@ -722,13 +722,11 @@ func (cm *containerManager) WaitPID(args *WaitPIDArgs, waitStatus *uint32) error
return err
}
// WaitCheckpoint waits for the Kernel to have been successfully checkpointed
// n-1 times, then waits for either the n-th successful checkpoint (in which
// case it returns nil) or any number of failed checkpoints (in which case it
// returns an error returned by any such failure).
func (cm *containerManager) WaitCheckpoint(n *uint32, _ *struct{}) error {
err := cm.l.k.WaitCheckpoint(*n)
log.Debugf("containerManager.WaitCheckpoint, n = %d, err = %v", *n, err)
// WaitCheckpoint waits for the Kernel to have been successfully checkpointed.
func (cm *containerManager) WaitCheckpoint(*struct{}, *struct{}) error {
log.Debugf("containerManager.WaitCheckpoint")
err := cm.l.k.WaitForCheckpoint()
log.Debugf("containerManager.WaitCheckpoint done, err = %v", err)
return err
}
+2 -2
View File
@@ -735,7 +735,8 @@ func (r *restorer) restore(l *Loader) error {
// Restore was successful, so increment the checkpoint count manually. The
// count was saved while the previous kernel was being saved and checkpoint
// success was unknown at that time. Now we know the checkpoint succeeded.
l.k.IncCheckpointCount()
l.k.OnRestoreDone()
log.Infof("Restore successful")
}()
return nil
@@ -746,7 +747,6 @@ func (l *Loader) save(o *control.SaveOpts) (err error) {
// This closure is required to capture the final value of err.
l.k.OnCheckpointAttempt(err)
}()
l.k.ResetCheckpointStatus()
// TODO(gvisor.dev/issues/6243): save/restore not supported w/ hostinet
if l.root.conf.Network == config.NetworkHost {