mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Internal change.
PiperOrigin-RevId: 739263572
This commit is contained in:
@@ -570,13 +570,13 @@ func (c *Container) CopyFiles(opts *RunOpts, target string, sources ...string) {
|
||||
}
|
||||
|
||||
// Stats returns a snapshot of container stats similar to `docker stats`.
|
||||
func (c *Container) Stats(ctx context.Context) (*types.StatsJSON, error) {
|
||||
func (c *Container) Stats(ctx context.Context) (*container.StatsResponse, error) {
|
||||
responseBody, err := c.client.ContainerStats(ctx, c.id, false /*stream*/)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("ContainerStats failed: %v", err)
|
||||
}
|
||||
defer responseBody.Body.Close()
|
||||
var v types.StatsJSON
|
||||
var v container.StatsResponse
|
||||
if err := json.NewDecoder(responseBody.Body).Decode(&v); err != nil {
|
||||
return nil, fmt.Errorf("failed to decode container stats: %v", err)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/moby/moby/pkg/stdcopy"
|
||||
)
|
||||
|
||||
@@ -102,7 +103,7 @@ func (c *Container) doExec(ctx context.Context, r ExecOpts, args []string) (Proc
|
||||
return Process{}, fmt.Errorf("exec create failed with err: %v", err)
|
||||
}
|
||||
|
||||
hijack, err := c.client.ContainerExecAttach(ctx, resp.ID, types.ExecStartCheck{})
|
||||
hijack, err := c.client.ContainerExecAttach(ctx, resp.ID, container.ExecStartOptions{})
|
||||
if err != nil {
|
||||
return Process{}, fmt.Errorf("exec attach failed with err: %v", err)
|
||||
}
|
||||
@@ -114,12 +115,12 @@ func (c *Container) doExec(ctx context.Context, r ExecOpts, args []string) (Proc
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Container) execConfig(r ExecOpts, cmd []string) types.ExecConfig {
|
||||
func (c *Container) execConfig(r ExecOpts, cmd []string) container.ExecOptions {
|
||||
env := append(r.Env, fmt.Sprintf("RUNSC_TEST_NAME=%s", c.Name))
|
||||
if !r.NoWrap && c.sniffGPUOpts != nil {
|
||||
cmd = c.sniffGPUOpts.prepend(cmd)
|
||||
}
|
||||
return types.ExecConfig{
|
||||
return container.ExecOptions{
|
||||
AttachStdin: r.UseTTY,
|
||||
AttachStderr: true,
|
||||
AttachStdout: true,
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/moby/moby/client"
|
||||
"gvisor.dev/gvisor/pkg/test/testutil"
|
||||
@@ -51,7 +50,7 @@ func NewNetwork(ctx context.Context, logger testutil.Logger) *Network {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *Network) networkCreate() types.NetworkCreate {
|
||||
func (n *Network) networkCreate() network.CreateOptions {
|
||||
|
||||
var subnet string
|
||||
if n.Subnet != nil {
|
||||
@@ -64,7 +63,7 @@ func (n *Network) networkCreate() types.NetworkCreate {
|
||||
}},
|
||||
}
|
||||
|
||||
return types.NetworkCreate{
|
||||
return network.CreateOptions{
|
||||
IPAM: &ipam,
|
||||
}
|
||||
}
|
||||
@@ -97,8 +96,8 @@ func (n *Network) Connect(ctx context.Context, container *Container, ipv4, ipv6
|
||||
}
|
||||
|
||||
// Inspect returns this network's info.
|
||||
func (n *Network) Inspect(ctx context.Context) (types.NetworkResource, error) {
|
||||
return n.client.NetworkInspect(ctx, n.id, types.NetworkInspectOptions{Verbose: true})
|
||||
func (n *Network) Inspect(ctx context.Context) (network.Inspect, error) {
|
||||
return n.client.NetworkInspect(ctx, n.id, network.InspectOptions{Verbose: true})
|
||||
}
|
||||
|
||||
// Cleanup cleans up the docker network.
|
||||
|
||||
@@ -94,6 +94,6 @@ benchmark_test(
|
||||
"//test/benchmarks/harness",
|
||||
"//test/benchmarks/tools",
|
||||
"//test/metricsviz",
|
||||
"@com_github_docker_docker//api/types:go_default_library",
|
||||
"@com_github_docker_docker//api/types/container:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"gvisor.dev/gvisor/pkg/test/dockerutil"
|
||||
"gvisor.dev/gvisor/test/benchmarks/base"
|
||||
"gvisor.dev/gvisor/test/benchmarks/harness"
|
||||
@@ -161,7 +161,7 @@ func BenchmarkSizeNode(b *testing.B) {
|
||||
reportMemoryUsage(b, sumMemoryUsage)
|
||||
}
|
||||
|
||||
func validateStats(stats *types.StatsJSON) error {
|
||||
func validateStats(stats *container.StatsResponse) error {
|
||||
// The runc empty container is on the order of multiple kB, so if this is smaller than that,
|
||||
// there is probably something wrong.
|
||||
var memoryAtLeast uint64 = 1000
|
||||
|
||||
Reference in New Issue
Block a user