@@ -57,6 +57,11 @@ const (
5757 // CheckpointPagesFileName is the file within the given image-path's
5858 // directory containing the container's MemoryFile pages.
5959 CheckpointPagesFileName = "pages.img"
60+ // VersionKey is the key used to save runsc version in the save metadata and compare
61+ // it across checkpoint restore.
62+ VersionKey = "runsc_version"
63+ // ContainerCountKey is the key used to save number of containers in the save metadata.
64+ ContainerCountKey = "container_count"
6065)
6166
6267// restorer manages a restore session for a sandbox. It stores information about
@@ -239,12 +244,6 @@ func (r *restorer) restore(l *Loader) error {
239244 return fmt .Errorf ("failed to load kernel: %w" , err )
240245 }
241246
242- checkpointVersion := popVersionFromCheckpoint (l .k )
243- currentVersion := version .Version ()
244- if checkpointVersion != currentVersion {
245- return fmt .Errorf ("runsc version does not match across checkpoint restore, checkpoint: %v current: %v" , checkpointVersion , currentVersion )
246- }
247-
248247 oldSpecs , err := popContainerSpecsFromCheckpoint (l .k )
249248 if err != nil {
250249 return fmt .Errorf ("failed to pop container specs from checkpoint: %w" , err )
@@ -357,10 +356,10 @@ func (l *Loader) save(o *control.SaveOpts) (err error) {
357356 if o .Metadata == nil {
358357 o .Metadata = make (map [string ]string )
359358 }
360- o .Metadata ["container_count" ] = strconv .Itoa (l .containerCount ())
359+ o .Metadata [ContainerCountKey ] = strconv .Itoa (l .containerCount ())
361360
362361 // Save runsc version.
363- l . addVersionToCheckpoint ()
362+ o . Metadata [ VersionKey ] = version . Version ()
364363
365364 // Save container specs.
366365 l .addContainerSpecsToCheckpoint ()
0 commit comments