From d40be91ac31c66296930b1dc02242bc6832f3acd Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Thu, 20 Jul 2023 20:22:05 -0700 Subject: [PATCH] Remove unused parameters PiperOrigin-RevId: 549820338 --- runsc/cmd/checkpoint.go | 2 +- runsc/cmd/restore.go | 2 +- runsc/container/container.go | 8 ++++---- runsc/container/container_test.go | 6 +++--- runsc/sandbox/sandbox.go | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/runsc/cmd/checkpoint.go b/runsc/cmd/checkpoint.go index 17de5f122..ee5ce5e2f 100644 --- a/runsc/cmd/checkpoint.go +++ b/runsc/cmd/checkpoint.go @@ -144,7 +144,7 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...any) su } defer cont.Destroy() - if err := cont.Restore(spec, conf, fullImagePath); err != nil { + if err := cont.Restore(conf, fullImagePath); err != nil { util.Fatalf("starting container: %v", err) } diff --git a/runsc/cmd/restore.go b/runsc/cmd/restore.go index 604523c4e..475f8e63a 100644 --- a/runsc/cmd/restore.go +++ b/runsc/cmd/restore.go @@ -141,7 +141,7 @@ func (r *Restore) Execute(_ context.Context, f *flag.FlagSet, args ...any) subco } log.Debugf("Restore: %v", conf.RestoreFile) - if err := c.Restore(runArgs.Spec, conf, conf.RestoreFile); err != nil { + if err := c.Restore(conf, conf.RestoreFile); err != nil { return util.Errorf("starting container: %v", err) } diff --git a/runsc/container/container.go b/runsc/container/container.go index 6f4c0bea0..6d0cacb15 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -432,7 +432,7 @@ func (c *Container) Start(conf *config.Config) error { } if isRoot(c.Spec) { - if err := c.Sandbox.StartRoot(c.Spec, conf); err != nil { + if err := c.Sandbox.StartRoot(conf); err != nil { return err } } else { @@ -502,7 +502,7 @@ func (c *Container) Start(conf *config.Config) error { // Restore takes a container and replaces its kernel and file system // to restore a container from its state file. -func (c *Container) Restore(spec *specs.Spec, conf *config.Config, restoreFile string) error { +func (c *Container) Restore(conf *config.Config, restoreFile string) error { log.Debugf("Restore container, cid: %s", c.ID) if err := c.Saver.lock(BlockAcquire); err != nil { return err @@ -519,7 +519,7 @@ func (c *Container) Restore(spec *specs.Spec, conf *config.Config, restoreFile s log.Warningf("StartContainer hook skipped because running inside container namespace is not supported") } - if err := c.Sandbox.Restore(c.ID, spec, conf, restoreFile); err != nil { + if err := c.Sandbox.Restore(conf, c.ID, restoreFile); err != nil { return err } c.changeStatus(Running) @@ -542,7 +542,7 @@ func Run(conf *config.Config, args Args) (unix.WaitStatus, error) { if conf.RestoreFile != "" { log.Debugf("Restore: %v", conf.RestoreFile) - if err := c.Restore(args.Spec, conf, conf.RestoreFile); err != nil { + if err := c.Restore(conf, conf.RestoreFile); err != nil { return 0, fmt.Errorf("starting container: %v", err) } } else { diff --git a/runsc/container/container_test.go b/runsc/container/container_test.go index 89dd31743..2e7c45995 100644 --- a/runsc/container/container_test.go +++ b/runsc/container/container_test.go @@ -1108,7 +1108,7 @@ func TestCheckpointRestore(t *testing.T) { } defer cont2.Destroy() - if err := cont2.Restore(spec, conf, imagePath); err != nil { + if err := cont2.Restore(conf, imagePath); err != nil { t.Fatalf("error restoring container: %v", err) } @@ -1152,7 +1152,7 @@ func TestCheckpointRestore(t *testing.T) { } defer cont3.Destroy() - if err := cont3.Restore(spec, conf, imagePath); err != nil { + if err := cont3.Restore(conf, imagePath); err != nil { t.Fatalf("error restoring container: %v", err) } @@ -1287,7 +1287,7 @@ func TestUnixDomainSockets(t *testing.T) { } defer contRestore.Destroy() - if err := contRestore.Restore(spec, conf, imagePath); err != nil { + if err := contRestore.Restore(conf, imagePath); err != nil { t.Fatalf("error restoring container: %v", err) } diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index c70570ec3..eac90c992 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -374,7 +374,7 @@ func (s *Sandbox) CreateSubcontainer(conf *config.Config, cid string, tty *os.Fi } // StartRoot starts running the root container process inside the sandbox. -func (s *Sandbox) StartRoot(spec *specs.Spec, conf *config.Config) error { +func (s *Sandbox) StartRoot(conf *config.Config) error { pid := s.Pid.load() log.Debugf("Start root sandbox %q, PID: %d", s.ID, pid) conn, err := s.sandboxConnect() @@ -431,7 +431,7 @@ func (s *Sandbox) StartSubcontainer(spec *specs.Spec, conf *config.Config, cid s } // Restore sends the restore call for a container in the sandbox. -func (s *Sandbox) Restore(cid string, spec *specs.Spec, conf *config.Config, filename string) error { +func (s *Sandbox) Restore(conf *config.Config, cid string, filename string) error { log.Debugf("Restore sandbox %q", s.ID) rf, err := os.Open(filename)