From 8ac9a22097d807c87d8d8fa0a9c23f187f6520b5 Mon Sep 17 00:00:00 2001 From: Yohei Ueda Date: Thu, 17 Feb 2022 10:45:40 +0900 Subject: [PATCH] runtime: Add hypervisor proto to support peer pod VMs This patch adds a protobuf definiton of the remote hypervisor type. Signed-off-by: Yohei Ueda Co-authored-by: stevenhorsman (based on commit 150e8aba6dbc7c0520bb9495d52f320f83127101) --- .../hack/update-generated-hypervisor-proto.sh | 14 + .../protocols/hypervisor/hypervisor.pb.go | 619 ++++++++++++++++++ .../protocols/hypervisor/hypervisor.proto | 45 ++ .../hypervisor/hypervisor_grpc.pb.go | 223 +++++++ 4 files changed, 901 insertions(+) create mode 100755 src/runtime/hack/update-generated-hypervisor-proto.sh create mode 100644 src/runtime/protocols/hypervisor/hypervisor.pb.go create mode 100644 src/runtime/protocols/hypervisor/hypervisor.proto create mode 100644 src/runtime/protocols/hypervisor/hypervisor_grpc.pb.go diff --git a/src/runtime/hack/update-generated-hypervisor-proto.sh b/src/runtime/hack/update-generated-hypervisor-proto.sh new file mode 100755 index 000000000000..172ea6eefa99 --- /dev/null +++ b/src/runtime/hack/update-generated-hypervisor-proto.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# (C) Copyright IBM Corp. 2022, 2023 +# SPDX-License-Identifier: Apache-2.0 + +set -o errexit -o pipefail -o nounset + +HYPERVISOR_PATH="protocols/hypervisor" + +protoc \ + -I=$GOPATH/src \ + --proto_path=$HYPERVISOR_PATH \ + --go_out=$HYPERVISOR_PATH \ + --go-grpc_out=$HYPERVISOR_PATH \ + $HYPERVISOR_PATH/hypervisor.proto diff --git a/src/runtime/protocols/hypervisor/hypervisor.pb.go b/src/runtime/protocols/hypervisor/hypervisor.pb.go new file mode 100644 index 000000000000..0195a2c82cd1 --- /dev/null +++ b/src/runtime/protocols/hypervisor/hypervisor.pb.go @@ -0,0 +1,619 @@ +// (C) Copyright IBM Corp. 2022. +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v3.12.4 +// source: hypervisor.proto + +package __ + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type VersionRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *VersionRequest) Reset() { + *x = VersionRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionRequest) ProtoMessage() {} + +func (x *VersionRequest) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_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 VersionRequest.ProtoReflect.Descriptor instead. +func (*VersionRequest) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{0} +} + +func (x *VersionRequest) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type VersionResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` +} + +func (x *VersionResponse) Reset() { + *x = VersionResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersionResponse) ProtoMessage() {} + +func (x *VersionResponse) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[1] + 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 VersionResponse.ProtoReflect.Descriptor instead. +func (*VersionResponse) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{1} +} + +func (x *VersionResponse) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +type CreateVMRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Annotations map[string]string `protobuf:"bytes,2,rep,name=annotations,proto3" json:"annotations,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + NetworkNamespacePath string `protobuf:"bytes,3,opt,name=networkNamespacePath,proto3" json:"networkNamespacePath,omitempty"` +} + +func (x *CreateVMRequest) Reset() { + *x = CreateVMRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateVMRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateVMRequest) ProtoMessage() {} + +func (x *CreateVMRequest) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[2] + 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 CreateVMRequest.ProtoReflect.Descriptor instead. +func (*CreateVMRequest) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateVMRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *CreateVMRequest) GetAnnotations() map[string]string { + if x != nil { + return x.Annotations + } + return nil +} + +func (x *CreateVMRequest) GetNetworkNamespacePath() string { + if x != nil { + return x.NetworkNamespacePath + } + return "" +} + +type CreateVMResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AgentSocketPath string `protobuf:"bytes,1,opt,name=agentSocketPath,proto3" json:"agentSocketPath,omitempty"` +} + +func (x *CreateVMResponse) Reset() { + *x = CreateVMResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateVMResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateVMResponse) ProtoMessage() {} + +func (x *CreateVMResponse) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[3] + 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 CreateVMResponse.ProtoReflect.Descriptor instead. +func (*CreateVMResponse) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateVMResponse) GetAgentSocketPath() string { + if x != nil { + return x.AgentSocketPath + } + return "" +} + +type StartVMRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *StartVMRequest) Reset() { + *x = StartVMRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartVMRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartVMRequest) ProtoMessage() {} + +func (x *StartVMRequest) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[4] + 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 StartVMRequest.ProtoReflect.Descriptor instead. +func (*StartVMRequest) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{4} +} + +func (x *StartVMRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type StartVMResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StartVMResponse) Reset() { + *x = StartVMResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartVMResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartVMResponse) ProtoMessage() {} + +func (x *StartVMResponse) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[5] + 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 StartVMResponse.ProtoReflect.Descriptor instead. +func (*StartVMResponse) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{5} +} + +type StopVMRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *StopVMRequest) Reset() { + *x = StopVMRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StopVMRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StopVMRequest) ProtoMessage() {} + +func (x *StopVMRequest) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[6] + 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 StopVMRequest.ProtoReflect.Descriptor instead. +func (*StopVMRequest) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{6} +} + +func (x *StopVMRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type StopVMResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StopVMResponse) Reset() { + *x = StopVMResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hypervisor_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StopVMResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StopVMResponse) ProtoMessage() {} + +func (x *StopVMResponse) ProtoReflect() protoreflect.Message { + mi := &file_hypervisor_proto_msgTypes[7] + 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 StopVMResponse.ProtoReflect.Descriptor instead. +func (*StopVMResponse) Descriptor() ([]byte, []int) { + return file_hypervisor_proto_rawDescGZIP(), []int{7} +} + +var File_hypervisor_proto protoreflect.FileDescriptor + +var file_hypervisor_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x0a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x22, 0x2a, + 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x2b, 0x0a, 0x0f, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0xe5, 0x01, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x4e, 0x0a, 0x0b, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x2c, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x41, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, + 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, + 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x50, 0x61, 0x74, 0x68, 0x1a, + 0x3e, 0x0a, 0x10, 0x41, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x3c, 0x0a, 0x10, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x63, 0x6b, + 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x22, 0x20, 0x0a, + 0x0e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, + 0x11, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x72, 0x74, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x53, 0x74, 0x6f, 0x70, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x74, 0x6f, 0x70, 0x56, 0x4d, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa4, 0x02, 0x0a, 0x0a, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, + 0x69, 0x73, 0x6f, 0x72, 0x12, 0x47, 0x0a, 0x08, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x56, 0x4d, + 0x12, 0x1b, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, + 0x07, 0x53, 0x74, 0x61, 0x72, 0x74, 0x56, 0x4d, 0x12, 0x1a, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, + 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x56, 0x4d, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, + 0x72, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x41, 0x0a, 0x06, 0x53, 0x74, 0x6f, 0x70, 0x56, 0x4d, 0x12, 0x19, 0x2e, + 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x56, + 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, + 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x44, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, + 0x6e, 0x12, 0x1a, 0x2e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x56, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, + 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x04, 0x5a, 0x02, + 0x2e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_hypervisor_proto_rawDescOnce sync.Once + file_hypervisor_proto_rawDescData = file_hypervisor_proto_rawDesc +) + +func file_hypervisor_proto_rawDescGZIP() []byte { + file_hypervisor_proto_rawDescOnce.Do(func() { + file_hypervisor_proto_rawDescData = protoimpl.X.CompressGZIP(file_hypervisor_proto_rawDescData) + }) + return file_hypervisor_proto_rawDescData +} + +var file_hypervisor_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_hypervisor_proto_goTypes = []interface{}{ + (*VersionRequest)(nil), // 0: hypervisor.VersionRequest + (*VersionResponse)(nil), // 1: hypervisor.VersionResponse + (*CreateVMRequest)(nil), // 2: hypervisor.CreateVMRequest + (*CreateVMResponse)(nil), // 3: hypervisor.CreateVMResponse + (*StartVMRequest)(nil), // 4: hypervisor.StartVMRequest + (*StartVMResponse)(nil), // 5: hypervisor.StartVMResponse + (*StopVMRequest)(nil), // 6: hypervisor.StopVMRequest + (*StopVMResponse)(nil), // 7: hypervisor.StopVMResponse + nil, // 8: hypervisor.CreateVMRequest.AnnotationsEntry +} +var file_hypervisor_proto_depIdxs = []int32{ + 8, // 0: hypervisor.CreateVMRequest.annotations:type_name -> hypervisor.CreateVMRequest.AnnotationsEntry + 2, // 1: hypervisor.Hypervisor.CreateVM:input_type -> hypervisor.CreateVMRequest + 4, // 2: hypervisor.Hypervisor.StartVM:input_type -> hypervisor.StartVMRequest + 6, // 3: hypervisor.Hypervisor.StopVM:input_type -> hypervisor.StopVMRequest + 0, // 4: hypervisor.Hypervisor.Version:input_type -> hypervisor.VersionRequest + 3, // 5: hypervisor.Hypervisor.CreateVM:output_type -> hypervisor.CreateVMResponse + 5, // 6: hypervisor.Hypervisor.StartVM:output_type -> hypervisor.StartVMResponse + 7, // 7: hypervisor.Hypervisor.StopVM:output_type -> hypervisor.StopVMResponse + 1, // 8: hypervisor.Hypervisor.Version:output_type -> hypervisor.VersionResponse + 5, // [5:9] is the sub-list for method output_type + 1, // [1:5] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_hypervisor_proto_init() } +func file_hypervisor_proto_init() { + if File_hypervisor_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_hypervisor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VersionResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateVMRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateVMResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartVMRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartVMResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopVMRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hypervisor_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopVMResponse); 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_hypervisor_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_hypervisor_proto_goTypes, + DependencyIndexes: file_hypervisor_proto_depIdxs, + MessageInfos: file_hypervisor_proto_msgTypes, + }.Build() + File_hypervisor_proto = out.File + file_hypervisor_proto_rawDesc = nil + file_hypervisor_proto_goTypes = nil + file_hypervisor_proto_depIdxs = nil +} diff --git a/src/runtime/protocols/hypervisor/hypervisor.proto b/src/runtime/protocols/hypervisor/hypervisor.proto new file mode 100644 index 000000000000..4840be284e9a --- /dev/null +++ b/src/runtime/protocols/hypervisor/hypervisor.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +option go_package = "./"; + +package hypervisor; + +service Hypervisor { + rpc CreateVM(CreateVMRequest) returns (CreateVMResponse) {} + rpc StartVM(StartVMRequest) returns (StartVMResponse) {} + rpc StopVM(StopVMRequest) returns (StopVMResponse) {} + rpc Version(VersionRequest) returns (VersionResponse) {} +} + + +message VersionRequest { + string version = 1; +} + +message VersionResponse { + string version = 1; +} + +message CreateVMRequest { + string id = 1; + map annotations = 2; + string networkNamespacePath = 3; +} + +message CreateVMResponse { + string agentSocketPath = 1; +} + +message StartVMRequest { + string id = 1; +} + +message StartVMResponse { +} + +message StopVMRequest { + string id = 1; +} + +message StopVMResponse { +} diff --git a/src/runtime/protocols/hypervisor/hypervisor_grpc.pb.go b/src/runtime/protocols/hypervisor/hypervisor_grpc.pb.go new file mode 100644 index 000000000000..96ec8df88913 --- /dev/null +++ b/src/runtime/protocols/hypervisor/hypervisor_grpc.pb.go @@ -0,0 +1,223 @@ +// (C) Copyright IBM Corp. 2022. +// 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.12.4 +// source: hypervisor.proto + +package __ + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// 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 ( + Hypervisor_CreateVM_FullMethodName = "/hypervisor.Hypervisor/CreateVM" + Hypervisor_StartVM_FullMethodName = "/hypervisor.Hypervisor/StartVM" + Hypervisor_StopVM_FullMethodName = "/hypervisor.Hypervisor/StopVM" + Hypervisor_Version_FullMethodName = "/hypervisor.Hypervisor/Version" +) + +// HypervisorClient is the client API for Hypervisor 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 HypervisorClient interface { + CreateVM(ctx context.Context, in *CreateVMRequest, opts ...grpc.CallOption) (*CreateVMResponse, error) + StartVM(ctx context.Context, in *StartVMRequest, opts ...grpc.CallOption) (*StartVMResponse, error) + StopVM(ctx context.Context, in *StopVMRequest, opts ...grpc.CallOption) (*StopVMResponse, error) + Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) +} + +type hypervisorClient struct { + cc grpc.ClientConnInterface +} + +func NewHypervisorClient(cc grpc.ClientConnInterface) HypervisorClient { + return &hypervisorClient{cc} +} + +func (c *hypervisorClient) CreateVM(ctx context.Context, in *CreateVMRequest, opts ...grpc.CallOption) (*CreateVMResponse, error) { + out := new(CreateVMResponse) + err := c.cc.Invoke(ctx, Hypervisor_CreateVM_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hypervisorClient) StartVM(ctx context.Context, in *StartVMRequest, opts ...grpc.CallOption) (*StartVMResponse, error) { + out := new(StartVMResponse) + err := c.cc.Invoke(ctx, Hypervisor_StartVM_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hypervisorClient) StopVM(ctx context.Context, in *StopVMRequest, opts ...grpc.CallOption) (*StopVMResponse, error) { + out := new(StopVMResponse) + err := c.cc.Invoke(ctx, Hypervisor_StopVM_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hypervisorClient) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionResponse, error) { + out := new(VersionResponse) + err := c.cc.Invoke(ctx, Hypervisor_Version_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HypervisorServer is the server API for Hypervisor service. +// All implementations must embed UnimplementedHypervisorServer +// for forward compatibility +type HypervisorServer interface { + CreateVM(context.Context, *CreateVMRequest) (*CreateVMResponse, error) + StartVM(context.Context, *StartVMRequest) (*StartVMResponse, error) + StopVM(context.Context, *StopVMRequest) (*StopVMResponse, error) + Version(context.Context, *VersionRequest) (*VersionResponse, error) + mustEmbedUnimplementedHypervisorServer() +} + +// UnimplementedHypervisorServer must be embedded to have forward compatible implementations. +type UnimplementedHypervisorServer struct { +} + +func (UnimplementedHypervisorServer) CreateVM(context.Context, *CreateVMRequest) (*CreateVMResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateVM not implemented") +} +func (UnimplementedHypervisorServer) StartVM(context.Context, *StartVMRequest) (*StartVMResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartVM not implemented") +} +func (UnimplementedHypervisorServer) StopVM(context.Context, *StopVMRequest) (*StopVMResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopVM not implemented") +} +func (UnimplementedHypervisorServer) Version(context.Context, *VersionRequest) (*VersionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Version not implemented") +} +func (UnimplementedHypervisorServer) mustEmbedUnimplementedHypervisorServer() {} + +// UnsafeHypervisorServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HypervisorServer will +// result in compilation errors. +type UnsafeHypervisorServer interface { + mustEmbedUnimplementedHypervisorServer() +} + +func RegisterHypervisorServer(s grpc.ServiceRegistrar, srv HypervisorServer) { + s.RegisterService(&Hypervisor_ServiceDesc, srv) +} + +func _Hypervisor_CreateVM_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateVMRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HypervisorServer).CreateVM(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Hypervisor_CreateVM_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HypervisorServer).CreateVM(ctx, req.(*CreateVMRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Hypervisor_StartVM_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartVMRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HypervisorServer).StartVM(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Hypervisor_StartVM_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HypervisorServer).StartVM(ctx, req.(*StartVMRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Hypervisor_StopVM_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopVMRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HypervisorServer).StopVM(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Hypervisor_StopVM_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HypervisorServer).StopVM(ctx, req.(*StopVMRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Hypervisor_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VersionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HypervisorServer).Version(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Hypervisor_Version_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HypervisorServer).Version(ctx, req.(*VersionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Hypervisor_ServiceDesc is the grpc.ServiceDesc for Hypervisor service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Hypervisor_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "hypervisor.Hypervisor", + HandlerType: (*HypervisorServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateVM", + Handler: _Hypervisor_CreateVM_Handler, + }, + { + MethodName: "StartVM", + Handler: _Hypervisor_StartVM_Handler, + }, + { + MethodName: "StopVM", + Handler: _Hypervisor_StopVM_Handler, + }, + { + MethodName: "Version", + Handler: _Hypervisor_Version_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "hypervisor.proto", +}