Skip to content

Commit

Permalink
deps: bump go-criu to v6
Browse files Browse the repository at this point in the history
The v6.0.0 release of go-criu has deprecated the `rpc` and `stats`
packages in favour of the `crit` package. This commit provides the
changes required to use this version in podman.

Signed-off-by: Prajwal S N <[email protected]>
  • Loading branch information
snprajwal committed Sep 6, 2022
1 parent 8882b76 commit 2c2b40b
Show file tree
Hide file tree
Showing 183 changed files with 30,831 additions and 2,563 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/blang/semver/v4 v4.0.0
github.com/buger/goterm v1.0.4
github.com/checkpoint-restore/checkpointctl v0.0.0-20220321135231-33f4a66335f0
github.com/checkpoint-restore/go-criu/v5 v5.3.0
github.com/checkpoint-restore/go-criu/v6 v6.1.0
github.com/container-orchestrated-devices/container-device-interface v0.5.0
github.com/containernetworking/cni v1.1.2
github.com/containernetworking/plugins v1.1.1
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af/go.mod h1:Qjyv4H3/
github.com/checkpoint-restore/checkpointctl v0.0.0-20220321135231-33f4a66335f0 h1:txB5jvhzUCSiiQmqmMWpo5CEB7Gj/Hq5Xqi7eaPl8ko=
github.com/checkpoint-restore/checkpointctl v0.0.0-20220321135231-33f4a66335f0/go.mod h1:67kWC1PXQLR3lM/mmNnu3Kzn7K4TSWZAGUuQP1JSngk=
github.com/checkpoint-restore/go-criu/v5 v5.2.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
github.com/checkpoint-restore/go-criu/v5 v5.3.0 h1:wpFFOoomK3389ue2lAb0Boag6XPht5QYpipxmSNL4d8=
github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E=
github.com/checkpoint-restore/go-criu/v6 v6.1.0 h1:unOFSW/95ND2WjV9QWzdpWRmRuK8DsggmPfeqbfrhUM=
github.com/checkpoint-restore/go-criu/v6 v6.1.0/go.mod h1:rrRTN/uSwY2X+BPRl/gkulo9gsKOSAeVp9/K2tv7xZI=
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
Expand Down
42 changes: 23 additions & 19 deletions libpod/container_internal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

metadata "github.com/checkpoint-restore/checkpointctl/lib"
"github.com/checkpoint-restore/go-criu/v5/stats"
"github.com/checkpoint-restore/go-criu/v6/crit"
cdi "github.com/container-orchestrated-devices/container-device-interface/pkg/cdi"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/containers/buildah"
Expand Down Expand Up @@ -1283,11 +1283,11 @@ func (c *Container) exportCheckpoint(options ContainerCheckpointOptions) error {

includeFiles := []string{
"artifacts",
"stats-dump",
metadata.DevShmCheckpointTar,
metadata.ConfigDumpFile,
metadata.SpecDumpFile,
metadata.NetworkStatusFile,
stats.StatsDump,
}

if c.LogDriver() == define.KubernetesLogging ||
Expand Down Expand Up @@ -1517,7 +1517,8 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
return nil, fmt.Errorf("not able to open %q: %w", c.bundlePath(), err)
}

dumpStatistics, err := stats.CriuGetDumpStats(statsDirectory)
// Get dump statistics with crit
dumpStatistics, err := crit.GetDumpStats(statsDirectory.Name())
if err != nil {
return nil, fmt.Errorf("displaying checkpointing statistics not possible: %w", err)
}
Expand All @@ -1538,7 +1539,7 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
if !options.Keep && !options.PreCheckPoint {
cleanup := []string{
"dump.log",
stats.StatsDump,
"stats-dump",
metadata.ConfigDumpFile,
metadata.SpecDumpFile,
}
Expand Down Expand Up @@ -1950,7 +1951,8 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
return nil, fmt.Errorf("not able to open %q: %w", c.bundlePath(), err)
}

restoreStatistics, err := stats.CriuGetRestoreStats(statsDirectory)
// Get restore statistics with crit
restoreStatistics, err := crit.GetRestoreStats(statsDirectory.Name())
if err != nil {
return nil, fmt.Errorf("displaying restore statistics not possible: %w", err)
}
Expand Down Expand Up @@ -1996,8 +1998,8 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
cleanup := [...]string{
"restore.log",
"dump.log",
stats.StatsDump,
stats.StatsRestore,
"stats-dump",
"stats-restore",
metadata.DevShmCheckpointTar,
metadata.NetworkStatusFile,
metadata.RootFsDiffTar,
Expand Down Expand Up @@ -2553,11 +2555,12 @@ func (c *Container) bindMountRootFile(source, dest string) error {
// generateGroupEntry generates an entry or entries into /etc/group as
// required by container configuration.
// Generally speaking, we will make an entry under two circumstances:
// 1. The container is started as a specific user:group, and that group is both
// numeric, and does not already exist in /etc/group.
// 2. It is requested that Libpod add the group that launched Podman to
// /etc/group via AddCurrentUserPasswdEntry (though this does not trigger if
// the group in question already exists in /etc/passwd).
// 1. The container is started as a specific user:group, and that group is both
// numeric, and does not already exist in /etc/group.
// 2. It is requested that Libpod add the group that launched Podman to
// /etc/group via AddCurrentUserPasswdEntry (though this does not trigger if
// the group in question already exists in /etc/passwd).
//
// Returns group entry (as a string that can be appended to /etc/group) and any
// error that occurred.
func (c *Container) generateGroupEntry() (string, error) {
Expand Down Expand Up @@ -2660,13 +2663,14 @@ func (c *Container) generateUserGroupEntry(addedGID int) (string, error) {
// generatePasswdEntry generates an entry or entries into /etc/passwd as
// required by container configuration.
// Generally speaking, we will make an entry under two circumstances:
// 1. The container is started as a specific user who is not in /etc/passwd.
// This only triggers if the user is given as a *numeric* ID.
// 2. It is requested that Libpod add the user that launched Podman to
// /etc/passwd via AddCurrentUserPasswdEntry (though this does not trigger if
// the user in question already exists in /etc/passwd) or the UID to be added
// is 0).
// 3. The user specified additional host user accounts to add the the /etc/passwd file
// 1. The container is started as a specific user who is not in /etc/passwd.
// This only triggers if the user is given as a *numeric* ID.
// 2. It is requested that Libpod add the user that launched Podman to
// /etc/passwd via AddCurrentUserPasswdEntry (though this does not trigger if
// the user in question already exists in /etc/passwd) or the UID to be added
// is 0).
// 3. The user specified additional host user accounts to add the the /etc/passwd file
//
// Returns password entry (as a string that can be appended to /etc/passwd) and
// any error that occurred.
func (c *Container) generatePasswdEntry() (string, error) {
Expand Down
3 changes: 1 addition & 2 deletions pkg/checkpoint/crutils/checkpoint_restore_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"path/filepath"

metadata "github.com/checkpoint-restore/checkpointctl/lib"
"github.com/checkpoint-restore/go-criu/v5/stats"
"github.com/containers/storage/pkg/archive"
"github.com/opencontainers/selinux/go-selinux/label"
)
Expand Down Expand Up @@ -57,7 +56,7 @@ func CRImportCheckpointConfigOnly(destination, input string) error {
ExcludePatterns: []string{
"ctr.log",
"artifacts",
stats.StatsDump,
"stats-dump",
metadata.RootFsDiffTar,
metadata.DeletedFilesFile,
metadata.NetworkStatusFile,
Expand Down
4 changes: 2 additions & 2 deletions pkg/criu/criu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package criu

import (
"github.com/checkpoint-restore/go-criu/v5"
"github.com/checkpoint-restore/go-criu/v5/rpc"
"github.com/checkpoint-restore/go-criu/v6"
rpc "github.com/checkpoint-restore/go-criu/v6/crit/images"

"google.golang.org/protobuf/proto"
)
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/checkpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"
"time"

"github.com/checkpoint-restore/go-criu/v5/stats"
"github.com/containers/podman/v4/pkg/checkpoint/crutils"
"github.com/containers/podman/v4/pkg/criu"
"github.com/containers/podman/v4/pkg/domain/entities"
Expand Down Expand Up @@ -1381,7 +1380,7 @@ var _ = Describe("Podman checkpoint", func() {
)
Expect(tarsession).Should(Exit(0))

_, err = os.Stat(filepath.Join(destinationDirectory, stats.StatsDump))
_, err = os.Stat(filepath.Join(destinationDirectory, "stats-dump"))
Expect(err).ShouldNot(HaveOccurred())

Expect(os.RemoveAll(destinationDirectory)).To(BeNil())
Expand Down

This file was deleted.

107 changes: 0 additions & 107 deletions vendor/github.com/checkpoint-restore/go-criu/v5/Makefile

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions vendor/github.com/checkpoint-restore/go-criu/v5/go.sum

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2c2b40b

Please sign in to comment.