protocols: replace gogo/types.Empty and Any

by Google versions.

Signed-off-by: Beraldo Leal <bleal@redhat.com>
This commit is contained in:
Beraldo Leal
2023-11-01 23:15:32 +00:00
parent c61f4a8592
commit 16fa2c39e6
21 changed files with 10547 additions and 32526 deletions

View File

@@ -54,11 +54,13 @@ generate_go_sources() {
[ "$dir_path" == "$proto_file" ] && dir_path="." [ "$dir_path" == "$proto_file" ] && dir_path="."
local root_path=$(realpath ../)/libs/protocols/protos local root_path=$(realpath ../)/libs/protocols/protos
local output_path=$(realpath ../)/runtime/virtcontainers/pkg/agent/protocols/$dir_path
local mapping="Mgoogle/protobuf/empty.proto=google.golang.org/protobuf/types/known/emptypb"
local cmd="protoc -I$GOPATH/src:${root_path} \ local cmd="protoc -I$GOPATH/src:${root_path} \
--gogottrpc_out=plugins=ttrpc,paths=source_relative,\ --go_out=paths=source_relative,$mapping:$output_path \
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types\ --go-ttrpc_out=paths=source_relative,$mapping:$output_path \
:$(realpath ../)/runtime/virtcontainers/pkg/agent/protocols/$dir_path \ ${root_path}/$file_name"
${root_path}/$file_name"
echo $cmd echo $cmd
$cmd $cmd

View File

@@ -15,7 +15,6 @@ import (
"syscall" "syscall"
"time" "time"
"github.com/gogo/protobuf/types"
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci" "github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache" pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache"
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers" vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
@@ -25,6 +24,7 @@ import (
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
emptypb "google.golang.org/protobuf/types/known/emptypb"
) )
var factorySubCmds = []cli.Command{ var factorySubCmds = []cli.Command{
@@ -51,7 +51,7 @@ type cacheServer struct {
var jsonVMConfig *pb.GrpcVMConfig var jsonVMConfig *pb.GrpcVMConfig
// Config requests base factory config and convert it to gRPC protocol. // Config requests base factory config and convert it to gRPC protocol.
func (s *cacheServer) Config(ctx context.Context, empty *types.Empty) (*pb.GrpcVMConfig, error) { func (s *cacheServer) Config(ctx context.Context, empty *emptypb.Empty) (*pb.GrpcVMConfig, error) {
if jsonVMConfig == nil { if jsonVMConfig == nil {
config := s.factory.Config() config := s.factory.Config()
@@ -66,7 +66,7 @@ func (s *cacheServer) Config(ctx context.Context, empty *types.Empty) (*pb.GrpcV
} }
// GetBaseVM requests a paused VM and convert it to gRPC protocol. // GetBaseVM requests a paused VM and convert it to gRPC protocol.
func (s *cacheServer) GetBaseVM(ctx context.Context, empty *types.Empty) (*pb.GrpcVM, error) { func (s *cacheServer) GetBaseVM(ctx context.Context, empty *emptypb.Empty) (*pb.GrpcVM, error) {
config := s.factory.Config() config := s.factory.Config()
vm, err := s.factory.GetBaseVM(ctx, config) vm, err := s.factory.GetBaseVM(ctx, config)
@@ -83,16 +83,16 @@ func (s *cacheServer) quit() {
} }
// Quit will stop VMCache server after 1 second. // Quit will stop VMCache server after 1 second.
func (s *cacheServer) Quit(ctx context.Context, empty *types.Empty) (*types.Empty, error) { func (s *cacheServer) Quit(ctx context.Context, empty *emptypb.Empty) (*emptypb.Empty, error) {
go func() { go func() {
kataLog.Info("VM cache server will stop after 1 second") kataLog.Info("VM cache server will stop after 1 second")
time.Sleep(time.Second) time.Sleep(time.Second)
s.quit() s.quit()
}() }()
return &types.Empty{}, nil return &emptypb.Empty{}, nil
} }
func (s *cacheServer) Status(ctx context.Context, empty *types.Empty) (*pb.GrpcStatus, error) { func (s *cacheServer) Status(ctx context.Context, empty *emptypb.Empty) (*pb.GrpcStatus, error) {
stat := pb.GrpcStatus{ stat := pb.GrpcStatus{
Pid: int64(os.Getpid()), Pid: int64(os.Getpid()),
Vmstatus: s.factory.GetVMStatus(), Vmstatus: s.factory.GetVMStatus(),
@@ -241,7 +241,7 @@ var destroyFactoryCommand = cli.Command{
return errors.Wrapf(err, "failed to connect %q", runtimeConfig.FactoryConfig.VMCacheEndpoint) return errors.Wrapf(err, "failed to connect %q", runtimeConfig.FactoryConfig.VMCacheEndpoint)
} }
defer conn.Close() defer conn.Close()
_, err = pb.NewCacheServiceClient(conn).Quit(ctx, &types.Empty{}) _, err = pb.NewCacheServiceClient(conn).Quit(ctx, &emptypb.Empty{})
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to call gRPC Quit") return errors.Wrapf(err, "failed to call gRPC Quit")
} }
@@ -291,7 +291,7 @@ var statusFactoryCommand = cli.Command{
fmt.Fprintln(defaultOutputFile, errors.Wrapf(err, "failed to connect %q", runtimeConfig.FactoryConfig.VMCacheEndpoint)) fmt.Fprintln(defaultOutputFile, errors.Wrapf(err, "failed to connect %q", runtimeConfig.FactoryConfig.VMCacheEndpoint))
} else { } else {
defer conn.Close() defer conn.Close()
status, err := pb.NewCacheServiceClient(conn).Status(ctx, &types.Empty{}) status, err := pb.NewCacheServiceClient(conn).Status(ctx, &emptypb.Empty{})
if err != nil { if err != nil {
fmt.Fprintln(defaultOutputFile, errors.Wrapf(err, "failed to call gRPC Status\n")) fmt.Fprintln(defaultOutputFile, errors.Wrapf(err, "failed to call gRPC Status\n"))
} else { } else {

View File

@@ -54,6 +54,7 @@ require (
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2 golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2
golang.org/x/sys v0.6.0 golang.org/x/sys v0.6.0
google.golang.org/grpc v1.47.0 google.golang.org/grpc v1.47.0
google.golang.org/protobuf v1.28.1
k8s.io/apimachinery v0.22.5 k8s.io/apimachinery v0.22.5
k8s.io/cri-api v0.23.1 k8s.io/cri-api v0.23.1
) )
@@ -107,7 +108,6 @@ require (
golang.org/x/text v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect

View File

@@ -4,11 +4,11 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
CACHE_PATH="protocols/cache"
protoc \ protoc \
-I=$GOPATH/src \ -I=$GOPATH/src \
-I=$GOPATH/src/github.com/gogo/protobuf/protobuf \ --proto_path=$CACHE_PATH \
--proto_path=protocols/cache \ --go_out=$CACHE_PATH \
--gogofast_out=\ --go-grpc_out=$CACHE_PATH \
Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\ $CACHE_PATH/cache.proto
plugins=grpc:protocols/cache \
protocols/cache/cache.proto

View File

@@ -14,8 +14,8 @@ import (
"github.com/containerd/containerd/api/types/task" "github.com/containerd/containerd/api/types/task"
"github.com/containerd/containerd/errdefs" "github.com/containerd/containerd/errdefs"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
googleProtobuf "github.com/gogo/protobuf/types"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
anypb "google.golang.org/protobuf/types/known/anypb"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
) )
@@ -69,12 +69,12 @@ func getEnvs(envs []string) []types.EnvVar {
return vcEnvs return vcEnvs
} }
func newExec(c *container, stdin, stdout, stderr string, terminal bool, jspec *googleProtobuf.Any) (*exec, error) { func newExec(c *container, stdin, stdout, stderr string, terminal bool, jspec *anypb.Any) (*exec, error) {
var height uint32 var height uint32
var width uint32 var width uint32
if jspec == nil { if jspec == nil {
return nil, errdefs.ToGRPCf(errdefs.ErrInvalidArgument, "googleProtobuf.Any points to nil") return nil, errdefs.ToGRPCf(errdefs.ErrInvalidArgument, "anypb.Any points to nil")
} }
// process exec request // process exec request

View File

@@ -12,12 +12,12 @@ import (
cgroupsv2 "github.com/containerd/cgroups/v2/stats" cgroupsv2 "github.com/containerd/cgroups/v2/stats"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
google_protobuf "github.com/gogo/protobuf/types"
resCtrl "github.com/kata-containers/kata-containers/src/runtime/pkg/resourcecontrol" resCtrl "github.com/kata-containers/kata-containers/src/runtime/pkg/resourcecontrol"
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers" vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
anypb "google.golang.org/protobuf/types/known/anypb"
) )
func marshalMetrics(ctx context.Context, s *service, containerID string) (*google_protobuf.Any, error) { func marshalMetrics(ctx context.Context, s *service, containerID string) (*anypb.Any, error) {
stats, err := s.sandbox.StatsContainer(ctx, containerID) stats, err := s.sandbox.StatsContainer(ctx, containerID)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@@ -24,12 +24,12 @@ import (
cdshim "github.com/containerd/containerd/runtime/v2/shim" cdshim "github.com/containerd/containerd/runtime/v2/shim"
taskAPI "github.com/containerd/containerd/runtime/v2/task" taskAPI "github.com/containerd/containerd/runtime/v2/task"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
ptypes "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"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
otelTrace "go.opentelemetry.io/otel/trace" otelTrace "go.opentelemetry.io/otel/trace"
"golang.org/x/sys/unix" "golang.org/x/sys/unix"
emptypb "google.golang.org/protobuf/types/known/emptypb"
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils" "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils"
"github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace" "github.com/kata-containers/kata-containers/src/runtime/pkg/katautils/katatrace"
@@ -57,7 +57,7 @@ const (
) )
var ( var (
empty = &ptypes.Empty{} empty = &emptypb.Empty{}
_ taskAPI.TaskService = (taskAPI.TaskService)(&service{}) _ taskAPI.TaskService = (taskAPI.TaskService)(&service{})
) )
@@ -544,7 +544,7 @@ func (s *service) Delete(ctx context.Context, r *taskAPI.DeleteRequest) (_ *task
} }
// Exec an additional process inside the container // Exec an additional process inside the container
func (s *service) Exec(ctx context.Context, r *taskAPI.ExecProcessRequest) (_ *ptypes.Empty, err error) { func (s *service) Exec(ctx context.Context, r *taskAPI.ExecProcessRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Exec() start") shimLog.WithField("container", r.ID).Debug("Exec() start")
defer shimLog.WithField("container", r.ID).Debug("Exec() end") defer shimLog.WithField("container", r.ID).Debug("Exec() end")
span, _ := katatrace.Trace(s.rootCtx, shimLog, "Exec", shimTracingTags) span, _ := katatrace.Trace(s.rootCtx, shimLog, "Exec", shimTracingTags)
@@ -584,7 +584,7 @@ func (s *service) Exec(ctx context.Context, r *taskAPI.ExecProcessRequest) (_ *p
} }
// ResizePty of a process // ResizePty of a process
func (s *service) ResizePty(ctx context.Context, r *taskAPI.ResizePtyRequest) (_ *ptypes.Empty, err error) { func (s *service) ResizePty(ctx context.Context, r *taskAPI.ResizePtyRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("ResizePty() start") shimLog.WithField("container", r.ID).Debug("ResizePty() start")
defer shimLog.WithField("container", r.ID).Debug("ResizePty() end") defer shimLog.WithField("container", r.ID).Debug("ResizePty() end")
span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "ResizePty", shimTracingTags) span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "ResizePty", shimTracingTags)
@@ -681,7 +681,7 @@ func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (_ *taskAP
} }
// Pause the container // Pause the container
func (s *service) Pause(ctx context.Context, r *taskAPI.PauseRequest) (_ *ptypes.Empty, err error) { func (s *service) Pause(ctx context.Context, r *taskAPI.PauseRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Pause() start") shimLog.WithField("container", r.ID).Debug("Pause() start")
defer shimLog.WithField("container", r.ID).Debug("Pause() end") defer shimLog.WithField("container", r.ID).Debug("Pause() end")
span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Pause", shimTracingTags) span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Pause", shimTracingTags)
@@ -722,7 +722,7 @@ func (s *service) Pause(ctx context.Context, r *taskAPI.PauseRequest) (_ *ptypes
} }
// Resume the container // Resume the container
func (s *service) Resume(ctx context.Context, r *taskAPI.ResumeRequest) (_ *ptypes.Empty, err error) { func (s *service) Resume(ctx context.Context, r *taskAPI.ResumeRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Resume() start") shimLog.WithField("container", r.ID).Debug("Resume() start")
defer shimLog.WithField("container", r.ID).Debug("Resume() end") defer shimLog.WithField("container", r.ID).Debug("Resume() end")
span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Resume", shimTracingTags) span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Resume", shimTracingTags)
@@ -761,7 +761,7 @@ func (s *service) Resume(ctx context.Context, r *taskAPI.ResumeRequest) (_ *ptyp
} }
// Kill a process with the provided signal // Kill a process with the provided signal
func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (_ *ptypes.Empty, err error) { func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Kill() start") shimLog.WithField("container", r.ID).Debug("Kill() start")
defer shimLog.WithField("container", r.ID).Debug("Kill() end") defer shimLog.WithField("container", r.ID).Debug("Kill() end")
span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Kill", shimTracingTags) span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Kill", shimTracingTags)
@@ -851,7 +851,7 @@ func (s *service) Pids(ctx context.Context, r *taskAPI.PidsRequest) (_ *taskAPI.
} }
// CloseIO of a process // CloseIO of a process
func (s *service) CloseIO(ctx context.Context, r *taskAPI.CloseIORequest) (_ *ptypes.Empty, err error) { func (s *service) CloseIO(ctx context.Context, r *taskAPI.CloseIORequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("CloseIO() start") shimLog.WithField("container", r.ID).Debug("CloseIO() start")
defer shimLog.WithField("container", r.ID).Debug("CloseIO() end") defer shimLog.WithField("container", r.ID).Debug("CloseIO() end")
span, _ := katatrace.Trace(s.rootCtx, shimLog, "CloseIO", shimTracingTags) span, _ := katatrace.Trace(s.rootCtx, shimLog, "CloseIO", shimTracingTags)
@@ -894,7 +894,7 @@ func (s *service) CloseIO(ctx context.Context, r *taskAPI.CloseIORequest) (_ *pt
} }
// Checkpoint the container // Checkpoint the container
func (s *service) Checkpoint(ctx context.Context, r *taskAPI.CheckpointTaskRequest) (_ *ptypes.Empty, err error) { func (s *service) Checkpoint(ctx context.Context, r *taskAPI.CheckpointTaskRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Checkpoint() start") shimLog.WithField("container", r.ID).Debug("Checkpoint() start")
defer shimLog.WithField("container", r.ID).Debug("Checkpoint() end") defer shimLog.WithField("container", r.ID).Debug("Checkpoint() end")
span, _ := katatrace.Trace(s.rootCtx, shimLog, "Checkpoint", shimTracingTags) span, _ := katatrace.Trace(s.rootCtx, shimLog, "Checkpoint", shimTracingTags)
@@ -932,7 +932,7 @@ func (s *service) Connect(ctx context.Context, r *taskAPI.ConnectRequest) (_ *ta
}, nil }, nil
} }
func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ *ptypes.Empty, err error) { func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Shutdown() start") shimLog.WithField("container", r.ID).Debug("Shutdown() start")
defer shimLog.WithField("container", r.ID).Debug("Shutdown() end") defer shimLog.WithField("container", r.ID).Debug("Shutdown() end")
span, _ := katatrace.Trace(s.rootCtx, shimLog, "Shutdown", shimTracingTags) span, _ := katatrace.Trace(s.rootCtx, shimLog, "Shutdown", shimTracingTags)
@@ -1009,7 +1009,7 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (_ *taskAP
} }
// Update a running container // Update a running container
func (s *service) Update(ctx context.Context, r *taskAPI.UpdateTaskRequest) (_ *ptypes.Empty, err error) { func (s *service) Update(ctx context.Context, r *taskAPI.UpdateTaskRequest) (_ *emptypb.Empty, err error) {
shimLog.WithField("container", r.ID).Debug("Update() start") shimLog.WithField("container", r.ID).Debug("Update() start")
defer shimLog.WithField("container", r.ID).Debug("Update() end") defer shimLog.WithField("container", r.ID).Debug("Update() end")
span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Update", shimTracingTags) span, spanCtx := katatrace.Trace(s.rootCtx, shimLog, "Update", shimTracingTags)

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,8 @@ syntax = "proto3";
package cache; package cache;
option go_package = "./";
import "google/protobuf/empty.proto"; import "google/protobuf/empty.proto";
service CacheService { service CacheService {

View File

@@ -0,0 +1,227 @@
//
// Copyright 2019 HyperHQ Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v3.21.12
// source: cache.proto
package __
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
CacheService_Config_FullMethodName = "/cache.CacheService/Config"
CacheService_GetBaseVM_FullMethodName = "/cache.CacheService/GetBaseVM"
CacheService_Status_FullMethodName = "/cache.CacheService/Status"
CacheService_Quit_FullMethodName = "/cache.CacheService/Quit"
)
// CacheServiceClient is the client API for CacheService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type CacheServiceClient interface {
Config(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcVMConfig, error)
GetBaseVM(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcVM, error)
Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcStatus, error)
Quit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
type cacheServiceClient struct {
cc grpc.ClientConnInterface
}
func NewCacheServiceClient(cc grpc.ClientConnInterface) CacheServiceClient {
return &cacheServiceClient{cc}
}
func (c *cacheServiceClient) Config(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcVMConfig, error) {
out := new(GrpcVMConfig)
err := c.cc.Invoke(ctx, CacheService_Config_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cacheServiceClient) GetBaseVM(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcVM, error) {
out := new(GrpcVM)
err := c.cc.Invoke(ctx, CacheService_GetBaseVM_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cacheServiceClient) Status(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GrpcStatus, error) {
out := new(GrpcStatus)
err := c.cc.Invoke(ctx, CacheService_Status_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *cacheServiceClient) Quit(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, CacheService_Quit_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CacheServiceServer is the server API for CacheService service.
// All implementations must embed UnimplementedCacheServiceServer
// for forward compatibility
type CacheServiceServer interface {
Config(context.Context, *emptypb.Empty) (*GrpcVMConfig, error)
GetBaseVM(context.Context, *emptypb.Empty) (*GrpcVM, error)
Status(context.Context, *emptypb.Empty) (*GrpcStatus, error)
Quit(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
mustEmbedUnimplementedCacheServiceServer()
}
// UnimplementedCacheServiceServer must be embedded to have forward compatible implementations.
type UnimplementedCacheServiceServer struct {
}
func (UnimplementedCacheServiceServer) Config(context.Context, *emptypb.Empty) (*GrpcVMConfig, error) {
return nil, status.Errorf(codes.Unimplemented, "method Config not implemented")
}
func (UnimplementedCacheServiceServer) GetBaseVM(context.Context, *emptypb.Empty) (*GrpcVM, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBaseVM not implemented")
}
func (UnimplementedCacheServiceServer) Status(context.Context, *emptypb.Empty) (*GrpcStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method Status not implemented")
}
func (UnimplementedCacheServiceServer) Quit(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method Quit not implemented")
}
func (UnimplementedCacheServiceServer) mustEmbedUnimplementedCacheServiceServer() {}
// UnsafeCacheServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CacheServiceServer will
// result in compilation errors.
type UnsafeCacheServiceServer interface {
mustEmbedUnimplementedCacheServiceServer()
}
func RegisterCacheServiceServer(s grpc.ServiceRegistrar, srv CacheServiceServer) {
s.RegisterService(&CacheService_ServiceDesc, srv)
}
func _CacheService_Config_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServiceServer).Config(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CacheService_Config_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServiceServer).Config(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _CacheService_GetBaseVM_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServiceServer).GetBaseVM(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CacheService_GetBaseVM_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServiceServer).GetBaseVM(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _CacheService_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServiceServer).Status(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CacheService_Status_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServiceServer).Status(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _CacheService_Quit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CacheServiceServer).Quit(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: CacheService_Quit_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CacheServiceServer).Quit(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
// CacheService_ServiceDesc is the grpc.ServiceDesc for CacheService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var CacheService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cache.CacheService",
HandlerType: (*CacheServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Config",
Handler: _CacheService_Config_Handler,
},
{
MethodName: "GetBaseVM",
Handler: _CacheService_GetBaseVM_Handler,
},
{
MethodName: "Status",
Handler: _CacheService_Status_Handler,
},
{
MethodName: "Quit",
Handler: _CacheService_Quit_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "cache.proto",
}

View File

@@ -0,0 +1,168 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: google/protobuf/empty.proto
package emptypb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
// A generic empty message that you can re-use to avoid defining duplicated
// empty messages in your APIs. A typical example is to use it as the request
// or the response type of an API method. For instance:
//
// service Foo {
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
// }
//
// The JSON representation for `Empty` is empty JSON object `{}`.
type Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Empty) Reset() {
*x = Empty{}
if protoimpl.UnsafeEnabled {
mi := &file_google_protobuf_empty_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_google_protobuf_empty_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_google_protobuf_empty_proto_rawDescGZIP(), []int{0}
}
var File_google_protobuf_empty_proto protoreflect.FileDescriptor
var file_google_protobuf_empty_proto_rawDesc = []byte{
0x0a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x22, 0x07,
0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x7d, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x42, 0x0a,
0x45, 0x6d, 0x70, 0x74, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x6b,
0x6e, 0x6f, 0x77, 0x6e, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x70, 0x62, 0xf8, 0x01, 0x01, 0xa2,
0x02, 0x03, 0x47, 0x50, 0x42, 0xaa, 0x02, 0x1e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x50,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77,
0x6e, 0x54, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_google_protobuf_empty_proto_rawDescOnce sync.Once
file_google_protobuf_empty_proto_rawDescData = file_google_protobuf_empty_proto_rawDesc
)
func file_google_protobuf_empty_proto_rawDescGZIP() []byte {
file_google_protobuf_empty_proto_rawDescOnce.Do(func() {
file_google_protobuf_empty_proto_rawDescData = protoimpl.X.CompressGZIP(file_google_protobuf_empty_proto_rawDescData)
})
return file_google_protobuf_empty_proto_rawDescData
}
var file_google_protobuf_empty_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_google_protobuf_empty_proto_goTypes = []interface{}{
(*Empty)(nil), // 0: google.protobuf.Empty
}
var file_google_protobuf_empty_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_google_protobuf_empty_proto_init() }
func file_google_protobuf_empty_proto_init() {
if File_google_protobuf_empty_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_google_protobuf_empty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_google_protobuf_empty_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_google_protobuf_empty_proto_goTypes,
DependencyIndexes: file_google_protobuf_empty_proto_depIdxs,
MessageInfos: file_google_protobuf_empty_proto_msgTypes,
}.Build()
File_google_protobuf_empty_proto = out.File
file_google_protobuf_empty_proto_rawDesc = nil
file_google_protobuf_empty_proto_goTypes = nil
file_google_protobuf_empty_proto_depIdxs = nil
}

View File

@@ -549,6 +549,7 @@ google.golang.org/protobuf/runtime/protoimpl
google.golang.org/protobuf/types/descriptorpb google.golang.org/protobuf/types/descriptorpb
google.golang.org/protobuf/types/known/anypb google.golang.org/protobuf/types/known/anypb
google.golang.org/protobuf/types/known/durationpb google.golang.org/protobuf/types/known/durationpb
google.golang.org/protobuf/types/known/emptypb
google.golang.org/protobuf/types/known/timestamppb google.golang.org/protobuf/types/known/timestamppb
# gopkg.in/inf.v0 v0.9.1 # gopkg.in/inf.v0 v0.9.1
## explicit ## explicit

View File

@@ -10,7 +10,7 @@ import (
"context" "context"
"fmt" "fmt"
types "github.com/gogo/protobuf/types" emptypb "google.golang.org/protobuf/types/known/emptypb"
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache" pb "github.com/kata-containers/kata-containers/src/runtime/protocols/cache"
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers" vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory/base" "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/factory/base"
@@ -31,7 +31,7 @@ func New(ctx context.Context, endpoint string) (base.FactoryBase, error) {
return nil, errors.Wrapf(err, "failed to connect %q", endpoint) return nil, errors.Wrapf(err, "failed to connect %q", endpoint)
} }
jConfig, err := pb.NewCacheServiceClient(conn).Config(ctx, &types.Empty{}) jConfig, err := pb.NewCacheServiceClient(conn).Config(ctx, &emptypb.Empty{})
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "failed to Config") return nil, errors.Wrapf(err, "failed to Config")
} }
@@ -52,7 +52,7 @@ func (g *grpccache) Config() vc.VMConfig {
// GetBaseVM create a new VM directly. // GetBaseVM create a new VM directly.
func (g *grpccache) GetBaseVM(ctx context.Context, config vc.VMConfig) (*vc.VM, error) { func (g *grpccache) GetBaseVM(ctx context.Context, config vc.VMConfig) (*vc.VM, error) {
defer g.conn.Close() defer g.conn.Close()
gVM, err := pb.NewCacheServiceClient(g.conn).GetBaseVM(ctx, &types.Empty{}) gVM, err := pb.NewCacheServiceClient(g.conn).GetBaseVM(ctx, &emptypb.Empty{})
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "failed to GetBaseVM") return nil, errors.Wrapf(err, "failed to GetBaseVM")
} }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,638 @@
// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: agent.proto
package grpc
import (
context "context"
ttrpc "github.com/containerd/ttrpc"
protocols "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
type AgentServiceService interface {
CreateContainer(context.Context, *CreateContainerRequest) (*emptypb.Empty, error)
StartContainer(context.Context, *StartContainerRequest) (*emptypb.Empty, error)
RemoveContainer(context.Context, *RemoveContainerRequest) (*emptypb.Empty, error)
ExecProcess(context.Context, *ExecProcessRequest) (*emptypb.Empty, error)
SignalProcess(context.Context, *SignalProcessRequest) (*emptypb.Empty, error)
WaitProcess(context.Context, *WaitProcessRequest) (*WaitProcessResponse, error)
UpdateContainer(context.Context, *UpdateContainerRequest) (*emptypb.Empty, error)
UpdateEphemeralMounts(context.Context, *UpdateEphemeralMountsRequest) (*emptypb.Empty, error)
StatsContainer(context.Context, *StatsContainerRequest) (*StatsContainerResponse, error)
PauseContainer(context.Context, *PauseContainerRequest) (*emptypb.Empty, error)
ResumeContainer(context.Context, *ResumeContainerRequest) (*emptypb.Empty, error)
RemoveStaleVirtiofsShareMounts(context.Context, *RemoveStaleVirtiofsShareMountsRequest) (*emptypb.Empty, error)
WriteStdin(context.Context, *WriteStreamRequest) (*WriteStreamResponse, error)
ReadStdout(context.Context, *ReadStreamRequest) (*ReadStreamResponse, error)
ReadStderr(context.Context, *ReadStreamRequest) (*ReadStreamResponse, error)
CloseStdin(context.Context, *CloseStdinRequest) (*emptypb.Empty, error)
TtyWinResize(context.Context, *TtyWinResizeRequest) (*emptypb.Empty, error)
UpdateInterface(context.Context, *UpdateInterfaceRequest) (*protocols.Interface, error)
UpdateRoutes(context.Context, *UpdateRoutesRequest) (*Routes, error)
ListInterfaces(context.Context, *ListInterfacesRequest) (*Interfaces, error)
ListRoutes(context.Context, *ListRoutesRequest) (*Routes, error)
AddARPNeighbors(context.Context, *AddARPNeighborsRequest) (*emptypb.Empty, error)
GetIPTables(context.Context, *GetIPTablesRequest) (*GetIPTablesResponse, error)
SetIPTables(context.Context, *SetIPTablesRequest) (*SetIPTablesResponse, error)
GetMetrics(context.Context, *GetMetricsRequest) (*Metrics, error)
CreateSandbox(context.Context, *CreateSandboxRequest) (*emptypb.Empty, error)
DestroySandbox(context.Context, *DestroySandboxRequest) (*emptypb.Empty, error)
OnlineCPUMem(context.Context, *OnlineCPUMemRequest) (*emptypb.Empty, error)
ReseedRandomDev(context.Context, *ReseedRandomDevRequest) (*emptypb.Empty, error)
GetGuestDetails(context.Context, *GuestDetailsRequest) (*GuestDetailsResponse, error)
MemHotplugByProbe(context.Context, *MemHotplugByProbeRequest) (*emptypb.Empty, error)
SetGuestDateTime(context.Context, *SetGuestDateTimeRequest) (*emptypb.Empty, error)
CopyFile(context.Context, *CopyFileRequest) (*emptypb.Empty, error)
GetOOMEvent(context.Context, *GetOOMEventRequest) (*OOMEvent, error)
AddSwap(context.Context, *AddSwapRequest) (*emptypb.Empty, error)
GetVolumeStats(context.Context, *VolumeStatsRequest) (*VolumeStatsResponse, error)
ResizeVolume(context.Context, *ResizeVolumeRequest) (*emptypb.Empty, error)
SetPolicy(context.Context, *SetPolicyRequest) (*emptypb.Empty, error)
}
func RegisterAgentServiceService(srv *ttrpc.Server, svc AgentServiceService) {
srv.RegisterService("grpc.AgentService", &ttrpc.ServiceDesc{
Methods: map[string]ttrpc.Method{
"CreateContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CreateContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.CreateContainer(ctx, &req)
},
"StartContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req StartContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.StartContainer(ctx, &req)
},
"RemoveContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req RemoveContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.RemoveContainer(ctx, &req)
},
"ExecProcess": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ExecProcessRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ExecProcess(ctx, &req)
},
"SignalProcess": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req SignalProcessRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.SignalProcess(ctx, &req)
},
"WaitProcess": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req WaitProcessRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.WaitProcess(ctx, &req)
},
"UpdateContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req UpdateContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.UpdateContainer(ctx, &req)
},
"UpdateEphemeralMounts": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req UpdateEphemeralMountsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.UpdateEphemeralMounts(ctx, &req)
},
"StatsContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req StatsContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.StatsContainer(ctx, &req)
},
"PauseContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req PauseContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.PauseContainer(ctx, &req)
},
"ResumeContainer": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ResumeContainerRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ResumeContainer(ctx, &req)
},
"RemoveStaleVirtiofsShareMounts": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req RemoveStaleVirtiofsShareMountsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.RemoveStaleVirtiofsShareMounts(ctx, &req)
},
"WriteStdin": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req WriteStreamRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.WriteStdin(ctx, &req)
},
"ReadStdout": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ReadStreamRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ReadStdout(ctx, &req)
},
"ReadStderr": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ReadStreamRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ReadStderr(ctx, &req)
},
"CloseStdin": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CloseStdinRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.CloseStdin(ctx, &req)
},
"TtyWinResize": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req TtyWinResizeRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.TtyWinResize(ctx, &req)
},
"UpdateInterface": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req UpdateInterfaceRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.UpdateInterface(ctx, &req)
},
"UpdateRoutes": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req UpdateRoutesRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.UpdateRoutes(ctx, &req)
},
"ListInterfaces": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ListInterfacesRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ListInterfaces(ctx, &req)
},
"ListRoutes": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ListRoutesRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ListRoutes(ctx, &req)
},
"AddARPNeighbors": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req AddARPNeighborsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.AddARPNeighbors(ctx, &req)
},
"GetIPTables": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req GetIPTablesRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.GetIPTables(ctx, &req)
},
"SetIPTables": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req SetIPTablesRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.SetIPTables(ctx, &req)
},
"GetMetrics": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req GetMetricsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.GetMetrics(ctx, &req)
},
"CreateSandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CreateSandboxRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.CreateSandbox(ctx, &req)
},
"DestroySandbox": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req DestroySandboxRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.DestroySandbox(ctx, &req)
},
"OnlineCPUMem": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req OnlineCPUMemRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.OnlineCPUMem(ctx, &req)
},
"ReseedRandomDev": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ReseedRandomDevRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ReseedRandomDev(ctx, &req)
},
"GetGuestDetails": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req GuestDetailsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.GetGuestDetails(ctx, &req)
},
"MemHotplugByProbe": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req MemHotplugByProbeRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.MemHotplugByProbe(ctx, &req)
},
"SetGuestDateTime": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req SetGuestDateTimeRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.SetGuestDateTime(ctx, &req)
},
"CopyFile": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CopyFileRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.CopyFile(ctx, &req)
},
"GetOOMEvent": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req GetOOMEventRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.GetOOMEvent(ctx, &req)
},
"AddSwap": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req AddSwapRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.AddSwap(ctx, &req)
},
"GetVolumeStats": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req VolumeStatsRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.GetVolumeStats(ctx, &req)
},
"ResizeVolume": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req ResizeVolumeRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.ResizeVolume(ctx, &req)
},
"SetPolicy": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req SetPolicyRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.SetPolicy(ctx, &req)
},
},
})
}
type agentserviceClient struct {
client *ttrpc.Client
}
func NewAgentServiceClient(client *ttrpc.Client) AgentServiceService {
return &agentserviceClient{
client: client,
}
}
func (c *agentserviceClient) CreateContainer(ctx context.Context, req *CreateContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "CreateContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) StartContainer(ctx context.Context, req *StartContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "StartContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) RemoveContainer(ctx context.Context, req *RemoveContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "RemoveContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ExecProcess(ctx context.Context, req *ExecProcessRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "ExecProcess", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) SignalProcess(ctx context.Context, req *SignalProcessRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "SignalProcess", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) WaitProcess(ctx context.Context, req *WaitProcessRequest) (*WaitProcessResponse, error) {
var resp WaitProcessResponse
if err := c.client.Call(ctx, "grpc.AgentService", "WaitProcess", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) UpdateContainer(ctx context.Context, req *UpdateContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "UpdateContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) UpdateEphemeralMounts(ctx context.Context, req *UpdateEphemeralMountsRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "UpdateEphemeralMounts", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) StatsContainer(ctx context.Context, req *StatsContainerRequest) (*StatsContainerResponse, error) {
var resp StatsContainerResponse
if err := c.client.Call(ctx, "grpc.AgentService", "StatsContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) PauseContainer(ctx context.Context, req *PauseContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "PauseContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ResumeContainer(ctx context.Context, req *ResumeContainerRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "ResumeContainer", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) RemoveStaleVirtiofsShareMounts(ctx context.Context, req *RemoveStaleVirtiofsShareMountsRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "RemoveStaleVirtiofsShareMounts", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) WriteStdin(ctx context.Context, req *WriteStreamRequest) (*WriteStreamResponse, error) {
var resp WriteStreamResponse
if err := c.client.Call(ctx, "grpc.AgentService", "WriteStdin", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ReadStdout(ctx context.Context, req *ReadStreamRequest) (*ReadStreamResponse, error) {
var resp ReadStreamResponse
if err := c.client.Call(ctx, "grpc.AgentService", "ReadStdout", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ReadStderr(ctx context.Context, req *ReadStreamRequest) (*ReadStreamResponse, error) {
var resp ReadStreamResponse
if err := c.client.Call(ctx, "grpc.AgentService", "ReadStderr", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) CloseStdin(ctx context.Context, req *CloseStdinRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "CloseStdin", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) TtyWinResize(ctx context.Context, req *TtyWinResizeRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "TtyWinResize", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) UpdateInterface(ctx context.Context, req *UpdateInterfaceRequest) (*protocols.Interface, error) {
var resp protocols.Interface
if err := c.client.Call(ctx, "grpc.AgentService", "UpdateInterface", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) UpdateRoutes(ctx context.Context, req *UpdateRoutesRequest) (*Routes, error) {
var resp Routes
if err := c.client.Call(ctx, "grpc.AgentService", "UpdateRoutes", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ListInterfaces(ctx context.Context, req *ListInterfacesRequest) (*Interfaces, error) {
var resp Interfaces
if err := c.client.Call(ctx, "grpc.AgentService", "ListInterfaces", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ListRoutes(ctx context.Context, req *ListRoutesRequest) (*Routes, error) {
var resp Routes
if err := c.client.Call(ctx, "grpc.AgentService", "ListRoutes", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) AddARPNeighbors(ctx context.Context, req *AddARPNeighborsRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "AddARPNeighbors", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) GetIPTables(ctx context.Context, req *GetIPTablesRequest) (*GetIPTablesResponse, error) {
var resp GetIPTablesResponse
if err := c.client.Call(ctx, "grpc.AgentService", "GetIPTables", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) SetIPTables(ctx context.Context, req *SetIPTablesRequest) (*SetIPTablesResponse, error) {
var resp SetIPTablesResponse
if err := c.client.Call(ctx, "grpc.AgentService", "SetIPTables", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) GetMetrics(ctx context.Context, req *GetMetricsRequest) (*Metrics, error) {
var resp Metrics
if err := c.client.Call(ctx, "grpc.AgentService", "GetMetrics", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) CreateSandbox(ctx context.Context, req *CreateSandboxRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "CreateSandbox", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) DestroySandbox(ctx context.Context, req *DestroySandboxRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "DestroySandbox", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) OnlineCPUMem(ctx context.Context, req *OnlineCPUMemRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "OnlineCPUMem", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ReseedRandomDev(ctx context.Context, req *ReseedRandomDevRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "ReseedRandomDev", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) GetGuestDetails(ctx context.Context, req *GuestDetailsRequest) (*GuestDetailsResponse, error) {
var resp GuestDetailsResponse
if err := c.client.Call(ctx, "grpc.AgentService", "GetGuestDetails", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) MemHotplugByProbe(ctx context.Context, req *MemHotplugByProbeRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "MemHotplugByProbe", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) SetGuestDateTime(ctx context.Context, req *SetGuestDateTimeRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "SetGuestDateTime", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) CopyFile(ctx context.Context, req *CopyFileRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "CopyFile", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) GetOOMEvent(ctx context.Context, req *GetOOMEventRequest) (*OOMEvent, error) {
var resp OOMEvent
if err := c.client.Call(ctx, "grpc.AgentService", "GetOOMEvent", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) AddSwap(ctx context.Context, req *AddSwapRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "AddSwap", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) GetVolumeStats(ctx context.Context, req *VolumeStatsRequest) (*VolumeStatsResponse, error) {
var resp VolumeStatsResponse
if err := c.client.Call(ctx, "grpc.AgentService", "GetVolumeStats", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) ResizeVolume(ctx context.Context, req *ResizeVolumeRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "ResizeVolume", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *agentserviceClient) SetPolicy(ctx context.Context, req *SetPolicyRequest) (*emptypb.Empty, error) {
var resp emptypb.Empty
if err := c.client.Call(ctx, "grpc.AgentService", "SetPolicy", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,60 @@
// Code generated by protoc-gen-go-ttrpc. DO NOT EDIT.
// source: health.proto
package grpc
import (
context "context"
ttrpc "github.com/containerd/ttrpc"
)
type HealthService interface {
Check(context.Context, *CheckRequest) (*HealthCheckResponse, error)
Version(context.Context, *CheckRequest) (*VersionCheckResponse, error)
}
func RegisterHealthService(srv *ttrpc.Server, svc HealthService) {
srv.RegisterService("grpc.Health", &ttrpc.ServiceDesc{
Methods: map[string]ttrpc.Method{
"Check": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CheckRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.Check(ctx, &req)
},
"Version": func(ctx context.Context, unmarshal func(interface{}) error) (interface{}, error) {
var req CheckRequest
if err := unmarshal(&req); err != nil {
return nil, err
}
return svc.Version(ctx, &req)
},
},
})
}
type healthClient struct {
client *ttrpc.Client
}
func NewHealthClient(client *ttrpc.Client) HealthService {
return &healthClient{
client: client,
}
}
func (c *healthClient) Check(ctx context.Context, req *CheckRequest) (*HealthCheckResponse, error) {
var resp HealthCheckResponse
if err := c.client.Call(ctx, "grpc.Health", "Check", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}
func (c *healthClient) Version(ctx context.Context, req *CheckRequest) (*VersionCheckResponse, error) {
var resp VersionCheckResponse
if err := c.client.Call(ctx, "grpc.Health", "Version", req, &resp); err != nil {
return nil, err
}
return &resp, nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -16,9 +16,9 @@ import (
"strings" "strings"
"github.com/containerd/ttrpc" "github.com/containerd/ttrpc"
gpb "github.com/gogo/protobuf/types"
aTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols" aTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
pb "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc" pb "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/grpc"
gpb "google.golang.org/protobuf/types/known/emptypb"
) )
const VSockPrefix = "mock://" const VSockPrefix = "mock://"