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:
parent
79e389e549
commit
23b2b09d13
@ -19,7 +19,7 @@ import (
|
||||
"github.com/containerd/containerd/linux/shim"
|
||||
"github.com/containerd/containerd/reaper"
|
||||
"github.com/containerd/containerd/sys"
|
||||
runc "github.com/crosbymichael/go-runc"
|
||||
runc "github.com/containerd/go-runc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
"github.com/crosbymichael/console"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
rootfsapi "github.com/containerd/containerd/api/services/rootfs"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/crosbymichael/console"
|
||||
"github.com/opencontainers/image-spec/identity"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -17,8 +17,8 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
"github.com/crosbymichael/console"
|
||||
protobuf "github.com/gogo/protobuf/types"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
@ -9,11 +9,11 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/services/execution"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/windows"
|
||||
"github.com/containerd/containerd/windows/hcs"
|
||||
"github.com/crosbymichael/console"
|
||||
protobuf "github.com/gogo/protobuf/types"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
"google.golang.org/grpc/grpclog"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/services/shim"
|
||||
"github.com/crosbymichael/console"
|
||||
protobuf "github.com/gogo/protobuf/types"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
|
@ -14,8 +14,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/fifo"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/tonistiigi/fifo"
|
||||
"github.com/urfave/cli"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
|
2
cmd/dist/common.go
vendored
2
cmd/dist/common.go
vendored
@ -11,13 +11,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/console"
|
||||
imagesapi "github.com/containerd/containerd/api/services/images"
|
||||
"github.com/containerd/containerd/content"
|
||||
"github.com/containerd/containerd/images"
|
||||
"github.com/containerd/containerd/remotes"
|
||||
"github.com/containerd/containerd/remotes/docker"
|
||||
imagesservice "github.com/containerd/containerd/services/images"
|
||||
"github.com/crosbymichael/console"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli"
|
||||
"google.golang.org/grpc"
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
"github.com/containerd/containerd/api/types/mount"
|
||||
"github.com/containerd/containerd/log"
|
||||
"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/sys/unix"
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
shimapi "github.com/containerd/containerd/api/services/shim"
|
||||
"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"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/sys/unix"
|
||||
|
@ -15,11 +15,11 @@ import (
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/containerd/console"
|
||||
shimapi "github.com/containerd/containerd/api/services/shim"
|
||||
"github.com/crosbymichael/console"
|
||||
runc "github.com/crosbymichael/go-runc"
|
||||
"github.com/containerd/fifo"
|
||||
runc "github.com/containerd/go-runc"
|
||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/tonistiigi/fifo"
|
||||
)
|
||||
|
||||
type execProcess struct {
|
||||
|
@ -13,11 +13,11 @@ import (
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd"
|
||||
shimapi "github.com/containerd/containerd/api/services/shim"
|
||||
"github.com/crosbymichael/console"
|
||||
runc "github.com/crosbymichael/go-runc"
|
||||
"github.com/tonistiigi/fifo"
|
||||
"github.com/containerd/fifo"
|
||||
runc "github.com/containerd/go-runc"
|
||||
)
|
||||
|
||||
type initProcess struct {
|
||||
|
@ -9,9 +9,9 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/crosbymichael/console"
|
||||
runc "github.com/crosbymichael/go-runc"
|
||||
"github.com/tonistiigi/fifo"
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/fifo"
|
||||
runc "github.com/containerd/go-runc"
|
||||
)
|
||||
|
||||
func copyConsole(ctx context.Context, console console.Console, stdin, stdout, stderr string, wg, cwg *sync.WaitGroup) error {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/crosbymichael/console"
|
||||
"github.com/containerd/console"
|
||||
)
|
||||
|
||||
type process interface {
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.com/containerd/console"
|
||||
shimapi "github.com/containerd/containerd/api/services/shim"
|
||||
"github.com/containerd/containerd/api/types/container"
|
||||
"github.com/containerd/containerd/reaper"
|
||||
"github.com/crosbymichael/console"
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/net/context"
|
||||
|
@ -3,10 +3,10 @@ package cgroups
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/containerd/cgroups"
|
||||
"github.com/containerd/cgroups/prometheus"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/crosbymichael/cgroups/prometheus"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
github.com/coreos/go-systemd 48702e0da86bd25e76cfef347e2adeb434a0d0a6
|
||||
github.com/crosbymichael/go-runc 65847bfc51952703ca24b564d10de50d3f2db6e7
|
||||
github.com/crosbymichael/console 2a5cbd32a84cd1268c20c69bd090ec49e37009f8
|
||||
github.com/crosbymichael/cgroups e950a27f3faf567abbf995bfbec90eaddc766d25
|
||||
github.com/containerd/go-runc 5fe4d8cb7fdc0fae5f5a7f4f1d65a565032401b2
|
||||
github.com/containerd/console a3863895279f5104533fd999c1babf80faffd98c
|
||||
github.com/containerd/cgroups 7b2d1a0f50963678d5799e29d17a4d611f5a5dee
|
||||
github.com/docker/go-metrics 8fd5772bf1584597834c6f7961a530f06cbfbb87
|
||||
github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f
|
||||
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/davecgh/go-spew v1.1.0
|
||||
github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/tonistiigi/fifo f071cd4a2739654fec4e768a14efd9332b3e8af1
|
||||
github.com/containerd/fifo 1c36a62ed52ac0235d524d6371b746db4e4eef72
|
||||
github.com/urfave/cli 8ba6f23b6e36d03666a14bd9421f5e3efcb59aca
|
||||
golang.org/x/net 8b4af36cd21a1f85a7484b49feb7c79363106d8e
|
||||
google.golang.org/grpc v1.0.5
|
||||
|
@ -1,8 +1,8 @@
|
||||
# cgroups
|
||||
|
||||
[](https://travis-ci.org/crosbymichael/cgroups)
|
||||
[](https://travis-ci.org/containerd/cgroups)
|
||||
|
||||
[](https://codecov.io/gh/crosbymichael/cgroups)
|
||||
[](https://codecov.io/gh/containerd/cgroups)
|
||||
|
||||
Go package for creating, managing, inspecting, and destroying cgroups.
|
||||
The resources format for settings on the cgroup uses the OCI runtime-spec found
|
@ -1,7 +1,7 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -3,7 +3,7 @@ package prometheus
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -1,7 +1,7 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -6,7 +6,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package prometheus
|
||||
|
||||
import (
|
||||
"github.com/crosbymichael/cgroups"
|
||||
"github.com/containerd/cgroups"
|
||||
metrics "github.com/docker/go-metrics"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
)
|
@ -1,5 +1,3 @@
|
||||
// +build systemd
|
||||
|
||||
package cgroups
|
||||
|
||||
import (
|
||||
@ -19,7 +17,7 @@ const (
|
||||
)
|
||||
|
||||
func Systemd() ([]Subsystem, error) {
|
||||
root, err := unifiedMountPoint()
|
||||
root, err := v1MountPoint()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -39,8 +37,8 @@ func Slice(slice, name string) Path {
|
||||
if slice == "" {
|
||||
slice = defaultSlice
|
||||
}
|
||||
return func(subsystem Name) string {
|
||||
return filepath.Join(slice, unitName(name))
|
||||
return func(subsystem Name) (string, error) {
|
||||
return filepath.Join(slice, unitName(name)), nil
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
# console
|
||||
|
||||
[](https://travis-ci.org/crosbymichael/console)
|
||||
[](https://travis-ci.org/containerd/console)
|
||||
|
||||
Golang package for dealing with consoles. Light on deps and a simple API.
|
||||
|
@ -30,12 +30,12 @@ type Console interface {
|
||||
|
||||
// WinSize specifies the window size of the console
|
||||
type WinSize struct {
|
||||
// Width of the console
|
||||
Width uint16
|
||||
// Height of the console
|
||||
Height uint16
|
||||
x uint16
|
||||
y uint16
|
||||
// Width of the console
|
||||
Width uint16
|
||||
x uint16
|
||||
y uint16
|
||||
}
|
||||
|
||||
// Current returns the current processes console
|
@ -1,5 +1,7 @@
|
||||
### fifo
|
||||
|
||||
[](https://travis-ci.org/containerd/fifo)
|
||||
|
||||
Go package for handling fifos in a sane way.
|
||||
|
||||
```
|
||||
@ -27,4 +29,4 @@ func (f *fifo) Write(b []byte) (int, error)
|
||||
// Close the fifo. Next reads/writes will error. This method can also be used
|
||||
// before open(2) has returned and fifo was never opened.
|
||||
func (f *fifo) Close() error
|
||||
```
|
||||
```
|
@ -1,6 +1,6 @@
|
||||
# go-runc
|
||||
|
||||
[](https://travis-ci.org/crosbymichael/go-runc)
|
||||
[](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.
|
||||
@ -11,7 +11,7 @@ or greater.
|
||||
|
||||
## 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
|
@ -4,10 +4,12 @@ package runc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/crosbymichael/console"
|
||||
"github.com/containerd/console"
|
||||
"github.com/opencontainers/runc/libcontainer/utils"
|
||||
)
|
||||
|
||||
@ -28,10 +30,33 @@ func NewConsoleSocket(path string) (*Socket, error) {
|
||||
}, 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
|
||||
type Socket struct {
|
||||
path string
|
||||
l net.Listener
|
||||
path string
|
||||
rmdir bool
|
||||
l net.Listener
|
||||
}
|
||||
|
||||
// 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
|
||||
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
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package runc
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
@ -36,6 +37,7 @@ type Runc struct {
|
||||
Log string
|
||||
LogFormat Format
|
||||
PdeathSignal syscall.Signal
|
||||
Criu string
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
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) {
|
||||
if r.Root != "" {
|
||||
out = append(out, "--root", r.Root)
|
||||
@ -361,6 +517,9 @@ func (r *Runc) args() (out []string) {
|
||||
if r.LogFormat != none {
|
||||
out = append(out, "--log-format", string(r.LogFormat))
|
||||
}
|
||||
if r.Criu != "" {
|
||||
out = append(out, "--criu", r.Criu)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user