Update deps after move to containerd org

This updates containerd to use the latest versions of cgroups, fifo,
console, and go-runc from the containerd org.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-05-10 16:35:32 -07:00
parent 79e389e549
commit 23b2b09d13
76 changed files with 244 additions and 54 deletions

View File

@ -19,7 +19,7 @@ import (
"github.com/containerd/containerd/linux/shim" "github.com/containerd/containerd/linux/shim"
"github.com/containerd/containerd/reaper" "github.com/containerd/containerd/reaper"
"github.com/containerd/containerd/sys" "github.com/containerd/containerd/sys"
runc "github.com/crosbymichael/go-runc" runc "github.com/containerd/go-runc"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View File

@ -5,8 +5,8 @@ import (
"os" "os"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/console"
"github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/services/execution"
"github.com/crosbymichael/console"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli" "github.com/urfave/cli"
) )

View File

@ -11,10 +11,10 @@ import (
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/console"
"github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/services/execution"
rootfsapi "github.com/containerd/containerd/api/services/rootfs" rootfsapi "github.com/containerd/containerd/api/services/rootfs"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/crosbymichael/console"
"github.com/opencontainers/image-spec/identity" "github.com/opencontainers/image-spec/identity"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -17,8 +17,8 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/console"
"github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/services/execution"
"github.com/crosbymichael/console"
protobuf "github.com/gogo/protobuf/types" protobuf "github.com/gogo/protobuf/types"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"

View File

@ -9,11 +9,11 @@ import (
"time" "time"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/console"
"github.com/containerd/containerd/api/services/execution" "github.com/containerd/containerd/api/services/execution"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/windows" "github.com/containerd/containerd/windows"
"github.com/containerd/containerd/windows/hcs" "github.com/containerd/containerd/windows/hcs"
"github.com/crosbymichael/console"
protobuf "github.com/gogo/protobuf/types" protobuf "github.com/gogo/protobuf/types"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"

View File

@ -19,8 +19,8 @@ import (
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/containerd/console"
"github.com/containerd/containerd/api/services/shim" "github.com/containerd/containerd/api/services/shim"
"github.com/crosbymichael/console"
protobuf "github.com/gogo/protobuf/types" protobuf "github.com/gogo/protobuf/types"
"github.com/opencontainers/runtime-spec/specs-go" "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"

View File

@ -14,8 +14,8 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/containerd/fifo"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/tonistiigi/fifo"
"github.com/urfave/cli" "github.com/urfave/cli"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"

2
cmd/dist/common.go vendored
View File

@ -11,13 +11,13 @@ import (
"strings" "strings"
"time" "time"
"github.com/containerd/console"
imagesapi "github.com/containerd/containerd/api/services/images" imagesapi "github.com/containerd/containerd/api/services/images"
"github.com/containerd/containerd/content" "github.com/containerd/containerd/content"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
"github.com/containerd/containerd/remotes" "github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker" "github.com/containerd/containerd/remotes/docker"
imagesservice "github.com/containerd/containerd/services/images" imagesservice "github.com/containerd/containerd/services/images"
"github.com/crosbymichael/console"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/urfave/cli" "github.com/urfave/cli"
"google.golang.org/grpc" "google.golang.org/grpc"

View File

@ -17,7 +17,7 @@ import (
"github.com/containerd/containerd/api/types/mount" "github.com/containerd/containerd/api/types/mount"
"github.com/containerd/containerd/log" "github.com/containerd/containerd/log"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
runc "github.com/crosbymichael/go-runc" runc "github.com/containerd/go-runc"
"golang.org/x/net/context" "golang.org/x/net/context"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"

View File

@ -5,7 +5,7 @@ import (
shimapi "github.com/containerd/containerd/api/services/shim" shimapi "github.com/containerd/containerd/api/services/shim"
"github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/container"
runc "github.com/crosbymichael/go-runc" runc "github.com/containerd/go-runc"
google_protobuf "github.com/golang/protobuf/ptypes/empty" google_protobuf "github.com/golang/protobuf/ptypes/empty"
"golang.org/x/net/context" "golang.org/x/net/context"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"

View File

@ -15,11 +15,11 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/containerd/console"
shimapi "github.com/containerd/containerd/api/services/shim" shimapi "github.com/containerd/containerd/api/services/shim"
"github.com/crosbymichael/console" "github.com/containerd/fifo"
runc "github.com/crosbymichael/go-runc" runc "github.com/containerd/go-runc"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/tonistiigi/fifo"
) )
type execProcess struct { type execProcess struct {

View File

@ -13,11 +13,11 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/containerd/console"
"github.com/containerd/containerd" "github.com/containerd/containerd"
shimapi "github.com/containerd/containerd/api/services/shim" shimapi "github.com/containerd/containerd/api/services/shim"
"github.com/crosbymichael/console" "github.com/containerd/fifo"
runc "github.com/crosbymichael/go-runc" runc "github.com/containerd/go-runc"
"github.com/tonistiigi/fifo"
) )
type initProcess struct { type initProcess struct {

View File

@ -9,9 +9,9 @@ import (
"sync" "sync"
"syscall" "syscall"
"github.com/crosbymichael/console" "github.com/containerd/console"
runc "github.com/crosbymichael/go-runc" "github.com/containerd/fifo"
"github.com/tonistiigi/fifo" runc "github.com/containerd/go-runc"
) )
func copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg, cwg *sync.WaitGroup) error { func copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg, cwg *sync.WaitGroup) error {

View File

@ -7,7 +7,7 @@ import (
"io" "io"
"time" "time"
"github.com/crosbymichael/console" "github.com/containerd/console"
) )
type process interface { type process interface {

View File

@ -8,10 +8,10 @@ import (
"sync" "sync"
"syscall" "syscall"
"github.com/containerd/console"
shimapi "github.com/containerd/containerd/api/services/shim" shimapi "github.com/containerd/containerd/api/services/shim"
"github.com/containerd/containerd/api/types/container" "github.com/containerd/containerd/api/types/container"
"github.com/containerd/containerd/reaper" "github.com/containerd/containerd/reaper"
"github.com/crosbymichael/console"
google_protobuf "github.com/golang/protobuf/ptypes/empty" google_protobuf "github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"

View File

@ -3,10 +3,10 @@ package cgroups
import ( import (
"time" "time"
"github.com/containerd/cgroups"
"github.com/containerd/cgroups/prometheus"
"github.com/containerd/containerd" "github.com/containerd/containerd"
"github.com/containerd/containerd/plugin" "github.com/containerd/containerd/plugin"
"github.com/crosbymichael/cgroups"
"github.com/crosbymichael/cgroups/prometheus"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"golang.org/x/net/context" "golang.org/x/net/context"
) )

View File

@ -1,7 +1,7 @@
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6 github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
github.com/crosbymichael/go-runc 65847bfc51952703ca24b564d10de50d3f2db6e7 github.com/containerd/go-runc 5fe4d8cb7fdc0fae5f5a7f4f1d65a565032401b2
github.com/crosbymichael/console 2a5cbd32a84cd1268c20c69bd090ec49e37009f8 github.com/containerd/console a3863895279f5104533fd999c1babf80faffd98c
github.com/crosbymichael/cgroups e950a27f3faf567abbf995bfbec90eaddc766d25 github.com/containerd/cgroups 7b2d1a0f50963678d5799e29d17a4d611f5a5dee
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87 github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f
github.com/prometheus/client_golang v0.8.0 github.com/prometheus/client_golang v0.8.0
@ -20,7 +20,7 @@ github.com/containerd/btrfs e9c546f46bccffefe71a6bc137e4c21b5503cc18
github.com/stretchr/testify v1.1.4 github.com/stretchr/testify v1.1.4
github.com/davecgh/go-spew v1.1.0 github.com/davecgh/go-spew v1.1.0
github.com/pmezard/go-difflib v1.0.0 github.com/pmezard/go-difflib v1.0.0
github.com/tonistiigi/fifo f071cd4a2739654fec4e768a14efd9332b3e8af1 github.com/containerd/fifo 1c36a62ed52ac0235d524d6371b746db4e4eef72
github.com/urfave/cli 8ba6f23b6e36d03666a14bd9421f5e3efcb59aca github.com/urfave/cli 8ba6f23b6e36d03666a14bd9421f5e3efcb59aca
golang.org/x/net 8b4af36cd21a1f85a7484b49feb7c79363106d8e golang.org/x/net 8b4af36cd21a1f85a7484b49feb7c79363106d8e
google.golang.org/grpc v1.0.5 google.golang.org/grpc v1.0.5

View File

@ -1,8 +1,8 @@
# cgroups # cgroups
[![Build Status](https://travis-ci.org/crosbymichael/cgroups.svg?branch=master)](https://travis-ci.org/crosbymichael/cgroups) [![Build Status](https://travis-ci.org/containerd/cgroups.svg?branch=master)](https://travis-ci.org/containerd/cgroups)
[![codecov](https://codecov.io/gh/crosbymichael/cgroups/branch/master/graph/badge.svg)](https://codecov.io/gh/crosbymichael/cgroups) [![codecov](https://codecov.io/gh/containerd/cgroups/branch/master/graph/badge.svg)](https://codecov.io/gh/containerd/cgroups)
Go package for creating, managing, inspecting, and destroying cgroups. Go package for creating, managing, inspecting, and destroying cgroups.
The resources format for settings on the cgroup uses the OCI runtime-spec found The resources format for settings on the cgroup uses the OCI runtime-spec found

View File

@ -1,7 +1,7 @@
package prometheus package prometheus
import ( import (
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -3,7 +3,7 @@ package prometheus
import ( import (
"strconv" "strconv"
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -1,7 +1,7 @@
package prometheus package prometheus
import ( import (
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -1,7 +1,7 @@
package prometheus package prometheus
import ( import (
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -1,7 +1,7 @@
package prometheus package prometheus
import ( import (
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -6,7 +6,7 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
) )

View File

@ -1,7 +1,7 @@
package prometheus package prometheus
import ( import (
"github.com/crosbymichael/cgroups" "github.com/containerd/cgroups"
metrics "github.com/docker/go-metrics" metrics "github.com/docker/go-metrics"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
) )

View File

@ -1,5 +1,3 @@
// +build systemd
package cgroups package cgroups
import ( import (
@ -19,7 +17,7 @@ const (
) )
func Systemd() ([]Subsystem, error) { func Systemd() ([]Subsystem, error) {
root, err := unifiedMountPoint() root, err := v1MountPoint()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -39,8 +37,8 @@ func Slice(slice, name string) Path {
if slice == "" { if slice == "" {
slice = defaultSlice slice = defaultSlice
} }
return func(subsystem Name) string { return func(subsystem Name) (string, error) {
return filepath.Join(slice, unitName(name)) return filepath.Join(slice, unitName(name)), nil
} }
} }

View File

@ -1,6 +1,6 @@
# console # console
[![Build Status](https://travis-ci.org/crosbymichael/console.svg?branch=master)](https://travis-ci.org/crosbymichael/console) [![Build Status](https://travis-ci.org/containerd/console.svg?branch=master)](https://travis-ci.org/containerd/console)
Golang package for dealing with consoles. Light on deps and a simple API. Golang package for dealing with consoles. Light on deps and a simple API.

View File

@ -30,12 +30,12 @@ type Console interface {
// WinSize specifies the window size of the console // WinSize specifies the window size of the console
type WinSize struct { type WinSize struct {
// Width of the console
Width uint16
// Height of the console // Height of the console
Height uint16 Height uint16
x uint16 // Width of the console
y uint16 Width uint16
x uint16
y uint16
} }
// Current returns the current processes console // Current returns the current processes console

View File

@ -1,5 +1,7 @@
### fifo ### fifo
[![Build Status](https://travis-ci.org/containerd/fifo.svg?branch=master)](https://travis-ci.org/containerd/fifo)
Go package for handling fifos in a sane way. Go package for handling fifos in a sane way.
``` ```

View File

@ -1,6 +1,6 @@
# go-runc # go-runc
[![Build Status](https://travis-ci.org/crosbymichael/go-runc.svg?branch=master)](https://travis-ci.org/crosbymichael/go-runc) [![Build Status](https://travis-ci.org/containerd/go-runc.svg?branch=master)](https://travis-ci.org/containerd/go-runc)
This is a package for consuming the [runc](https://github.com/opencontainers/runc) binary in your Go applications. This is a package for consuming the [runc](https://github.com/opencontainers/runc) binary in your Go applications.
@ -11,7 +11,7 @@ or greater.
## Docs ## Docs
Docs can be found at [godoc.org](https://godoc.org/github.com/crosbymichael/go-runc). Docs can be found at [godoc.org](https://godoc.org/github.com/containerd/go-runc).
## LICENSE - MIT ## LICENSE - MIT

View File

@ -4,10 +4,12 @@ package runc
import ( import (
"fmt" "fmt"
"io/ioutil"
"net" "net"
"os"
"path/filepath" "path/filepath"
"github.com/crosbymichael/console" "github.com/containerd/console"
"github.com/opencontainers/runc/libcontainer/utils" "github.com/opencontainers/runc/libcontainer/utils"
) )
@ -28,10 +30,33 @@ func NewConsoleSocket(path string) (*Socket, error) {
}, nil }, nil
} }
// NewTempConsoleSocket returns a temp console socket for use with a container
// On Close(), the socket is deleted
func NewTempConsoleSocket() (*Socket, error) {
dir, err := ioutil.TempDir("", "pty")
if err != nil {
return nil, err
}
abs, err := filepath.Abs(filepath.Join(dir, "pty.sock"))
if err != nil {
return nil, err
}
l, err := net.Listen("unix", abs)
if err != nil {
return nil, err
}
return &Socket{
l: l,
rmdir: true,
path: abs,
}, nil
}
// Socket is a unix socket that accepts the pty master created by runc // Socket is a unix socket that accepts the pty master created by runc
type Socket struct { type Socket struct {
path string path string
l net.Listener rmdir bool
l net.Listener
} }
// Path returns the path to the unix socket on disk // Path returns the path to the unix socket on disk
@ -63,5 +88,11 @@ func (c *Socket) ReceiveMaster() (console.Console, error) {
// Close closes the unix socket // Close closes the unix socket
func (c *Socket) Close() error { func (c *Socket) Close() error {
return c.l.Close() err := c.l.Close()
if c.rmdir {
if rerr := os.RemoveAll(filepath.Dir(c.path)); err == nil {
err = rerr
}
}
return err
} }

View File

@ -1,6 +1,7 @@
package runc package runc
import ( import (
"bytes"
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
@ -36,6 +37,7 @@ type Runc struct {
Log string Log string
LogFormat Format LogFormat Format
PdeathSignal syscall.Signal PdeathSignal syscall.Signal
Criu string
} }
// List returns all containers created inside the provided runc root directory // List returns all containers created inside the provided runc root directory
@ -348,6 +350,160 @@ func (r *Runc) Ps(context context.Context, id string) ([]int, error) {
return pids, nil return pids, nil
} }
type CheckpointOpts struct {
// ImagePath is the path for saving the criu image file
ImagePath string
// WorkDir is the working directory for criu
WorkDir string
// ParentPath is the path for previous image files from a pre-dump
ParentPath string
// AllowOpenTCP allows open tcp connections to be checkpointed
AllowOpenTCP bool
// AllowExternalUnixSockets allows external unix sockets to be checkpointed
AllowExternalUnixSockets bool
// AllowTerminal allows the terminal(pty) to be checkpointed with a container
AllowTerminal bool
// CriuPageServer is the address:port for the criu page server
CriuPageServer string
// FileLocks handle file locks held by the container
FileLocks bool
// Cgroups is the cgroup mode for how to handle the checkpoint of a container's cgroups
Cgroups CgroupMode
// EmptyNamespaces creates a namespace for the container but does not save its properties
// Provide the namespaces you wish to be checkpointed without their settings on restore
EmptyNamespaces []string
}
type CgroupMode string
const (
Soft CgroupMode = "soft"
Full CgroupMode = "full"
Strict CgroupMode = "strict"
)
func (o *CheckpointOpts) args() (out []string) {
if o.ImagePath != "" {
out = append(out, "--image-path", o.ImagePath)
}
if o.WorkDir != "" {
out = append(out, "--work-path", o.WorkDir)
}
if o.ParentPath != "" {
out = append(out, "--parent-path", o.ParentPath)
}
if o.AllowOpenTCP {
out = append(out, "--tcp-established")
}
if o.AllowExternalUnixSockets {
out = append(out, "--ext-unix-sk")
}
if o.AllowTerminal {
out = append(out, "--shell-job")
}
if o.CriuPageServer != "" {
out = append(out, "--page-server", o.CriuPageServer)
}
if o.FileLocks {
out = append(out, "--file-locks")
}
if string(o.Cgroups) != "" {
out = append(out, "--manage-cgroups-mode", string(o.Cgroups))
}
for _, ns := range o.EmptyNamespaces {
out = append(out, "--empty-ns", ns)
}
return out
}
type CheckpointAction func([]string) []string
// LeaveRunning keeps the container running after the checkpoint has been completed
func LeaveRunning(args []string) []string {
return append(args, "--leave-running")
}
// PreDump allows a pre-dump of the checkpoint to be made and completed later
func PreDump(args []string) []string {
return append(args, "--pre-dump")
}
// Checkpoint allows you to checkpoint a container using criu
func (r *Runc) Checkpoint(context context.Context, id string, opts *CheckpointOpts, actions ...CheckpointAction) error {
args := []string{"checkpoint"}
if opts != nil {
args = append(args, opts.args()...)
}
for _, a := range actions {
args = a(args)
}
return r.runOrError(r.command(context, append(args, id)...))
}
type RestoreOpts struct {
CheckpointOpts
IO
Detach bool
PidFile string
NoSubreaper bool
NoPivot bool
}
func (o *RestoreOpts) args() ([]string, error) {
out := o.CheckpointOpts.args()
if o.Detach {
out = append(out, "--detach")
}
if o.PidFile != "" {
abs, err := filepath.Abs(o.PidFile)
if err != nil {
return nil, err
}
out = append(out, "--pid-file", abs)
}
if o.NoPivot {
out = append(out, "--no-pivot")
}
if o.NoSubreaper {
out = append(out, "-no-subreaper")
}
return out, nil
}
// Restore restores a container with the provide id from an existing checkpoint
func (r *Runc) Restore(context context.Context, id, bundle string, opts *RestoreOpts) (int, error) {
args := []string{"restore"}
if opts != nil {
oargs, err := opts.args()
if err != nil {
return -1, err
}
args = append(args, oargs...)
}
args = append(args, "--bundle", bundle)
cmd := r.command(context, append(args, id)...)
if opts != nil {
opts.Set(cmd)
}
if err := Monitor.Start(cmd); err != nil {
return -1, err
}
return Monitor.Wait(cmd)
}
// Update updates the current container with the provided resource spec
func (r *Runc) Update(context context.Context, id string, resources *specs.LinuxResources) error {
buf := bytes.NewBuffer(nil)
if err := json.NewEncoder(buf).Encode(resources); err != nil {
return err
}
args := []string{"update", "--resources", "-", id}
cmd := r.command(context, args...)
cmd.Stdin = buf
return r.runOrError(cmd)
}
func (r *Runc) args() (out []string) { func (r *Runc) args() (out []string) {
if r.Root != "" { if r.Root != "" {
out = append(out, "--root", r.Root) out = append(out, "--root", r.Root)
@ -361,6 +517,9 @@ func (r *Runc) args() (out []string) {
if r.LogFormat != none { if r.LogFormat != none {
out = append(out, "--log-format", string(r.LogFormat)) out = append(out, "--log-format", string(r.LogFormat))
} }
if r.Criu != "" {
out = append(out, "--criu", r.Criu)
}
return out return out
} }