mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 08:56:32 +00:00
runtime: remote hypervisor updates to ttrpc
- Update the remote hypervisor code to match the re-genned code for the ttrpc Hypervisor Service Fixes: #8519 Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
@@ -6,19 +6,19 @@ package virtcontainers
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cri "github.com/containerd/containerd/pkg/cri/annotations"
|
cri "github.com/containerd/containerd/pkg/cri/annotations"
|
||||||
|
"github.com/containerd/ttrpc"
|
||||||
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
persistapi "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
||||||
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
|
pb "github.com/kata-containers/kata-containers/src/runtime/protocols/hypervisor"
|
||||||
hypannotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
|
hypannotations "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/annotations"
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
"github.com/kata-containers/kata-containers/src/runtime/virtcontainers/types"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"google.golang.org/grpc"
|
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultMinTimeout = 60
|
const defaultMinTimeout = 60
|
||||||
@@ -32,18 +32,20 @@ type remoteHypervisor struct {
|
|||||||
type remoteHypervisorSandboxID string
|
type remoteHypervisorSandboxID string
|
||||||
|
|
||||||
type remoteService struct {
|
type remoteService struct {
|
||||||
conn *grpc.ClientConn
|
conn net.Conn
|
||||||
client pb.HypervisorClient
|
client pb.HypervisorService
|
||||||
}
|
}
|
||||||
|
|
||||||
func openRemoteService(socketPath string) (*remoteService, error) {
|
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 {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to connect to remote hypervisor socket: %w", err)
|
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{
|
s := &remoteService{
|
||||||
conn: conn,
|
conn: conn,
|
||||||
|
Reference in New Issue
Block a user