Add cimfs differ and snapshotter
Details about CimFs project are discussed in #8346 Signed-off-by: Amit Barve <ambarve@microsoft.com>
This commit is contained in:
10
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs.go
generated
vendored
10
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs.go
generated
vendored
@@ -89,7 +89,7 @@ func putBuf(b *bytes.Buffer) {
|
||||
bytesBufferPool.Put(b)
|
||||
}
|
||||
|
||||
// Runhcs is the client to the runhcs cli
|
||||
// Runhcs is the client to the runhcs cli.
|
||||
type Runhcs struct {
|
||||
// Debug enables debug output for logging.
|
||||
Debug bool
|
||||
@@ -130,8 +130,8 @@ func (r *Runhcs) args() []string {
|
||||
return out
|
||||
}
|
||||
|
||||
func (r *Runhcs) command(context context.Context, args ...string) *exec.Cmd {
|
||||
cmd := exec.CommandContext(context, getCommandPath(), append(r.args(), args...)...)
|
||||
func (r *Runhcs) command(ctx context.Context, args ...string) *exec.Cmd {
|
||||
cmd := exec.CommandContext(ctx, getCommandPath(), append(r.args(), args...)...)
|
||||
cmd.Env = os.Environ()
|
||||
return cmd
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (r *Runhcs) command(context context.Context, args ...string) *exec.Cmd {
|
||||
// runOrError will run the provided command. If an error is
|
||||
// encountered and neither Stdout or Stderr was set the error and the
|
||||
// stderr of the command will be returned in the format of <error>:
|
||||
// <stderr>
|
||||
// <stderr>.
|
||||
func (r *Runhcs) runOrError(cmd *exec.Cmd) error {
|
||||
if cmd.Stdout != nil || cmd.Stderr != nil {
|
||||
ec, err := runc.Monitor.Start(cmd)
|
||||
@@ -154,7 +154,7 @@ func (r *Runhcs) runOrError(cmd *exec.Cmd) error {
|
||||
}
|
||||
data, err := cmdOutput(cmd, true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s", err, data)
|
||||
return fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
8
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_create-scratch.go
generated
vendored
8
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_create-scratch.go
generated
vendored
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
// CreateScratch creates a scratch vhdx at 'destpath' that is ext4 formatted.
|
||||
func (r *Runhcs) CreateScratch(context context.Context, destpath string) error {
|
||||
return r.CreateScratchWithOpts(context, destpath, nil)
|
||||
func (r *Runhcs) CreateScratch(ctx context.Context, destpath string) error {
|
||||
return r.CreateScratchWithOpts(ctx, destpath, nil)
|
||||
}
|
||||
|
||||
// CreateScratchOpts is the set of options that can be used with the
|
||||
@@ -43,7 +43,7 @@ func (opt *CreateScratchOpts) args() ([]string, error) {
|
||||
|
||||
// CreateScratchWithOpts creates a scratch vhdx at 'destpath' that is ext4
|
||||
// formatted based on `opts`.
|
||||
func (r *Runhcs) CreateScratchWithOpts(context context.Context, destpath string, opts *CreateScratchOpts) error {
|
||||
func (r *Runhcs) CreateScratchWithOpts(ctx context.Context, destpath string, opts *CreateScratchOpts) error {
|
||||
args := []string{"create-scratch", "--destpath", destpath}
|
||||
if opts != nil {
|
||||
oargs, err := opts.args()
|
||||
@@ -52,5 +52,5 @@ func (r *Runhcs) CreateScratchWithOpts(context context.Context, destpath string,
|
||||
}
|
||||
args = append(args, oargs...)
|
||||
}
|
||||
return r.runOrError(r.command(context, args...))
|
||||
return r.runOrError(r.command(ctx, args...))
|
||||
}
|
||||
|
||||
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_create.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_create.go
generated
vendored
@@ -64,7 +64,7 @@ func (opt *CreateOpts) args() ([]string, error) {
|
||||
|
||||
// Create creates a new container and returns its pid if it was created
|
||||
// successfully.
|
||||
func (r *Runhcs) Create(context context.Context, id, bundle string, opts *CreateOpts) error {
|
||||
func (r *Runhcs) Create(ctx context.Context, id, bundle string, opts *CreateOpts) error {
|
||||
args := []string{"create", "--bundle", bundle}
|
||||
if opts != nil {
|
||||
oargs, err := opts.args()
|
||||
@@ -73,14 +73,14 @@ func (r *Runhcs) Create(context context.Context, id, bundle string, opts *Create
|
||||
}
|
||||
args = append(args, oargs...)
|
||||
}
|
||||
cmd := r.command(context, append(args, id)...)
|
||||
cmd := r.command(ctx, append(args, id)...)
|
||||
if opts != nil && opts.IO != nil {
|
||||
opts.Set(cmd)
|
||||
}
|
||||
if cmd.Stdout == nil && cmd.Stderr == nil {
|
||||
data, err := cmdOutput(cmd, true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s", err, data)
|
||||
return fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_delete.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_delete.go
generated
vendored
@@ -22,7 +22,7 @@ func (opt *DeleteOpts) args() ([]string, error) {
|
||||
|
||||
// Delete any resources held by the container often used with detached
|
||||
// containers.
|
||||
func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) error {
|
||||
func (r *Runhcs) Delete(ctx context.Context, id string, opts *DeleteOpts) error {
|
||||
args := []string{"delete"}
|
||||
if opts != nil {
|
||||
oargs, err := opts.args()
|
||||
@@ -31,5 +31,5 @@ func (r *Runhcs) Delete(context context.Context, id string, opts *DeleteOpts) er
|
||||
}
|
||||
args = append(args, oargs...)
|
||||
}
|
||||
return r.runOrError(r.command(context, append(args, id)...))
|
||||
return r.runOrError(r.command(ctx, append(args, id)...))
|
||||
}
|
||||
|
||||
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_exec.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_exec.go
generated
vendored
@@ -51,7 +51,7 @@ func (opt *ExecOpts) args() ([]string, error) {
|
||||
|
||||
// Exec executes an additional process inside the container based on the
|
||||
// oci.Process spec found at processFile.
|
||||
func (r *Runhcs) Exec(context context.Context, id, processFile string, opts *ExecOpts) error {
|
||||
func (r *Runhcs) Exec(ctx context.Context, id, processFile string, opts *ExecOpts) error {
|
||||
args := []string{"exec", "--process", processFile}
|
||||
if opts != nil {
|
||||
oargs, err := opts.args()
|
||||
@@ -60,14 +60,14 @@ func (r *Runhcs) Exec(context context.Context, id, processFile string, opts *Exe
|
||||
}
|
||||
args = append(args, oargs...)
|
||||
}
|
||||
cmd := r.command(context, append(args, id)...)
|
||||
cmd := r.command(ctx, append(args, id)...)
|
||||
if opts != nil && opts.IO != nil {
|
||||
opts.Set(cmd)
|
||||
}
|
||||
if cmd.Stdout == nil && cmd.Stderr == nil {
|
||||
data, err := cmdOutput(cmd, true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %s", err, data)
|
||||
return fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_kill.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_kill.go
generated
vendored
@@ -8,6 +8,6 @@ import (
|
||||
|
||||
// Kill sends the specified signal (default: SIGTERM) to the container's init
|
||||
// process.
|
||||
func (r *Runhcs) Kill(context context.Context, id, signal string) error {
|
||||
return r.runOrError(r.command(context, "kill", id, signal))
|
||||
func (r *Runhcs) Kill(ctx context.Context, id, signal string) error {
|
||||
return r.runOrError(r.command(ctx, "kill", id, signal))
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_list.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_list.go
generated
vendored
@@ -17,8 +17,8 @@ type ContainerState = irunhcs.ContainerState
|
||||
//
|
||||
// Note: This is specific to the Runhcs.Root namespace provided in the global
|
||||
// settings.
|
||||
func (r *Runhcs) List(context context.Context) ([]*ContainerState, error) {
|
||||
data, err := cmdOutput(r.command(context, "list", "--format=json"), false)
|
||||
func (r *Runhcs) List(ctx context.Context) ([]*ContainerState, error) {
|
||||
data, err := cmdOutput(r.command(ctx, "list", "--format=json"), false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_pause.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_pause.go
generated
vendored
@@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
// Pause suspends all processes inside the container.
|
||||
func (r *Runhcs) Pause(context context.Context, id string) error {
|
||||
return r.runOrError(r.command(context, "pause", id))
|
||||
func (r *Runhcs) Pause(ctx context.Context, id string) error {
|
||||
return r.runOrError(r.command(ctx, "pause", id))
|
||||
}
|
||||
|
||||
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_ps.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_ps.go
generated
vendored
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
// Ps displays the processes running inside a container.
|
||||
func (r *Runhcs) Ps(context context.Context, id string) ([]int, error) {
|
||||
data, err := cmdOutput(r.command(context, "ps", "--format=json", id), true)
|
||||
func (r *Runhcs) Ps(ctx context.Context, id string) ([]int, error) {
|
||||
data, err := cmdOutput(r.command(ctx, "ps", "--format=json", id), true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %s", err, data)
|
||||
return nil, fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
|
||||
}
|
||||
var out []int
|
||||
if err := json.Unmarshal(data, &out); err != nil {
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_resize-tty.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_resize-tty.go
generated
vendored
@@ -22,7 +22,7 @@ func (opt *ResizeTTYOpts) args() ([]string, error) {
|
||||
}
|
||||
|
||||
// ResizeTTY updates the terminal size for a container process.
|
||||
func (r *Runhcs) ResizeTTY(context context.Context, id string, width, height uint16, opts *ResizeTTYOpts) error {
|
||||
func (r *Runhcs) ResizeTTY(ctx context.Context, id string, width, height uint16, opts *ResizeTTYOpts) error {
|
||||
args := []string{"resize-tty"}
|
||||
if opts != nil {
|
||||
oargs, err := opts.args()
|
||||
@@ -31,5 +31,5 @@ func (r *Runhcs) ResizeTTY(context context.Context, id string, width, height uin
|
||||
}
|
||||
args = append(args, oargs...)
|
||||
}
|
||||
return r.runOrError(r.command(context, append(args, id, strconv.FormatUint(uint64(width), 10), strconv.FormatUint(uint64(height), 10))...))
|
||||
return r.runOrError(r.command(ctx, append(args, id, strconv.FormatUint(uint64(width), 10), strconv.FormatUint(uint64(height), 10))...))
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_resume.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_resume.go
generated
vendored
@@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
// Resume resumes all processes that have been previously paused.
|
||||
func (r *Runhcs) Resume(context context.Context, id string) error {
|
||||
return r.runOrError(r.command(context, "resume", id))
|
||||
func (r *Runhcs) Resume(ctx context.Context, id string) error {
|
||||
return r.runOrError(r.command(ctx, "resume", id))
|
||||
}
|
||||
|
||||
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_start.go
generated
vendored
4
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_start.go
generated
vendored
@@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
// Start will start an already created container.
|
||||
func (r *Runhcs) Start(context context.Context, id string) error {
|
||||
return r.runOrError(r.command(context, "start", id))
|
||||
func (r *Runhcs) Start(ctx context.Context, id string) error {
|
||||
return r.runOrError(r.command(ctx, "start", id))
|
||||
}
|
||||
|
||||
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_state.go
generated
vendored
6
vendor/github.com/Microsoft/hcsshim/pkg/go-runhcs/runhcs_state.go
generated
vendored
@@ -9,10 +9,10 @@ import (
|
||||
)
|
||||
|
||||
// State outputs the state of a container.
|
||||
func (r *Runhcs) State(context context.Context, id string) (*ContainerState, error) {
|
||||
data, err := cmdOutput(r.command(context, "state", id), true)
|
||||
func (r *Runhcs) State(ctx context.Context, id string) (*ContainerState, error) {
|
||||
data, err := cmdOutput(r.command(ctx, "state", id), true)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %s", err, data)
|
||||
return nil, fmt.Errorf("%s: %s", err, data) //nolint:errorlint // legacy code
|
||||
}
|
||||
var out ContainerState
|
||||
if err := json.Unmarshal(data, &out); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user