Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: Update hypervisor generated code #8520

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/runtime/hack/update-generated-hypervisor-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ protoc \
-I=$GOPATH/src \
--proto_path=$HYPERVISOR_PATH \
--go_out=$HYPERVISOR_PATH \
--go-grpc_out=$HYPERVISOR_PATH \
--go-ttrpc_out=$HYPERVISOR_PATH \
$HYPERVISOR_PATH/hypervisor.proto
223 changes: 0 additions & 223 deletions src/runtime/protocols/hypervisor/hypervisor_grpc.pb.go

This file was deleted.

92 changes: 92 additions & 0 deletions src/runtime/protocols/hypervisor/hypervisor_ttrpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions src/runtime/virtcontainers/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ package virtcontainers
import (
"context"
"fmt"
"net"
"os"
"strconv"
"time"

cri "github.com/containerd/containerd/pkg/cri/annotations"
"github.com/containerd/ttrpc"
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
hypannotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

const defaultMinTimeout = 60
Expand All @@ -32,18 +32,20 @@ type remoteHypervisor struct {
type remoteHypervisorSandboxID string

type remoteService struct {
conn *grpc.ClientConn
client pb.HypervisorClient
conn net.Conn
client pb.HypervisorService
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevenhorsman HypervisorClient (struct) implements HypervisorService (Interface), so it compiles. Any special reason to replace the type from the struct to interface?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HypervisorClient isn't in this code base anymore? That was a grpc generated code IIRC?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm there is a hypervisorClient (lower case 'h') in 613c75b#diff-0df604aba3c29a070a7ed40486ce8193ecb2a36c2dabf91bb29e7627cff969d8R52 . This should be a private date structure so never mind.

}

func openRemoteService(socketPath string) (*remoteService, error) {

conn, err := grpc.Dial(fmt.Sprintf("unix://%s", socketPath), grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := net.Dial("unix", socketPath)
if err != nil {
return nil, fmt.Errorf("failed to connect to remote hypervisor socket: %w", err)
}
defer conn.Close()
client := pb.NewHypervisorClient(conn)

ttrpcClient := ttrpc.NewClient(conn)

client := pb.NewHypervisorClient(ttrpcClient)

s := &remoteService{
conn: conn,
Expand Down