review feedback

This commit is contained in:
Alex Dadgar 2018-08-07 12:49:37 -07:00
parent 97ccf42c64
commit ca121ce110
3 changed files with 193 additions and 174 deletions

View File

@ -1,5 +1,5 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// source: hashicorp/nomad/plugins/device/device.proto
// source: plugins/device/device.proto
package hashicorp_nomad_plugins_device
@ -27,14 +27,17 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
// DetectedDevices is the set of devices that the device plugin has
// detected and is exposing
type DetectedDevices struct {
// device_name is the name of the device. It should be scoped by
// vendor (“nvidia/gpu”, “intel/gpu”, “amd/gpu”, …)
DeviceName string `protobuf:"bytes,1,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`
// vendor is the name of the vendor of the device
Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor,omitempty"`
// device_type is the type of the device (gpu, fpga, etc).
DeviceType string `protobuf:"bytes,2,opt,name=device_type,json=deviceType,proto3" json:"device_type,omitempty"`
// device_name is the name of the device.
DeviceName string `protobuf:"bytes,3,opt,name=device_name,json=deviceName,proto3" json:"device_name,omitempty"`
// devices is the set of devices detected by the plugin.
Devices []*DetectedDevice `protobuf:"bytes,2,rep,name=devices,proto3" json:"devices,omitempty"`
Devices []*DetectedDevice `protobuf:"bytes,4,rep,name=devices,proto3" json:"devices,omitempty"`
// node_attributes allows adding node attributes to be used for
// constraints or affinities.
NodeAttributes map[string]string `protobuf:"bytes,3,rep,name=node_attributes,json=nodeAttributes,proto3" json:"node_attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
NodeAttributes map[string]string `protobuf:"bytes,5,rep,name=node_attributes,json=nodeAttributes,proto3" json:"node_attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -44,7 +47,7 @@ func (m *DetectedDevices) Reset() { *m = DetectedDevices{} }
func (m *DetectedDevices) String() string { return proto.CompactTextString(m) }
func (*DetectedDevices) ProtoMessage() {}
func (*DetectedDevices) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{0}
return fileDescriptor_device_ad09adbcf7924d2d, []int{0}
}
func (m *DetectedDevices) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DetectedDevices.Unmarshal(m, b)
@ -64,6 +67,20 @@ func (m *DetectedDevices) XXX_DiscardUnknown() {
var xxx_messageInfo_DetectedDevices proto.InternalMessageInfo
func (m *DetectedDevices) GetVendor() string {
if m != nil {
return m.Vendor
}
return ""
}
func (m *DetectedDevices) GetDeviceType() string {
if m != nil {
return m.DeviceType
}
return ""
}
func (m *DetectedDevices) GetDeviceName() string {
if m != nil {
return m.DeviceName
@ -107,7 +124,7 @@ func (m *DetectedDevice) Reset() { *m = DetectedDevice{} }
func (m *DetectedDevice) String() string { return proto.CompactTextString(m) }
func (*DetectedDevice) ProtoMessage() {}
func (*DetectedDevice) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{1}
return fileDescriptor_device_ad09adbcf7924d2d, []int{1}
}
func (m *DetectedDevice) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DetectedDevice.Unmarshal(m, b)
@ -155,9 +172,9 @@ func (m *DetectedDevice) GetPciBusId() string {
return ""
}
// AllocateRequest is used to ask the device driver for information on
// ReserveRequest is used to ask the device driver for information on
// how to allocate the requested devices.
type AllocateRequest struct {
type ReserveRequest struct {
// device_ids are the requested devices.
DeviceIds []string `protobuf:"bytes,1,rep,name=device_ids,json=deviceIds,proto3" json:"device_ids,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -165,83 +182,83 @@ type AllocateRequest struct {
XXX_sizecache int32 `json:"-"`
}
func (m *AllocateRequest) Reset() { *m = AllocateRequest{} }
func (m *AllocateRequest) String() string { return proto.CompactTextString(m) }
func (*AllocateRequest) ProtoMessage() {}
func (*AllocateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{2}
func (m *ReserveRequest) Reset() { *m = ReserveRequest{} }
func (m *ReserveRequest) String() string { return proto.CompactTextString(m) }
func (*ReserveRequest) ProtoMessage() {}
func (*ReserveRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_device_ad09adbcf7924d2d, []int{2}
}
func (m *AllocateRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AllocateRequest.Unmarshal(m, b)
func (m *ReserveRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReserveRequest.Unmarshal(m, b)
}
func (m *AllocateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AllocateRequest.Marshal(b, m, deterministic)
func (m *ReserveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReserveRequest.Marshal(b, m, deterministic)
}
func (dst *AllocateRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllocateRequest.Merge(dst, src)
func (dst *ReserveRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReserveRequest.Merge(dst, src)
}
func (m *AllocateRequest) XXX_Size() int {
return xxx_messageInfo_AllocateRequest.Size(m)
func (m *ReserveRequest) XXX_Size() int {
return xxx_messageInfo_ReserveRequest.Size(m)
}
func (m *AllocateRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AllocateRequest.DiscardUnknown(m)
func (m *ReserveRequest) XXX_DiscardUnknown() {
xxx_messageInfo_ReserveRequest.DiscardUnknown(m)
}
var xxx_messageInfo_AllocateRequest proto.InternalMessageInfo
var xxx_messageInfo_ReserveRequest proto.InternalMessageInfo
func (m *AllocateRequest) GetDeviceIds() []string {
func (m *ReserveRequest) GetDeviceIds() []string {
if m != nil {
return m.DeviceIds
}
return nil
}
// AllocateResponse informs Nomad how to expose the requested devices
// ReserveResponse informs Nomad how to expose the requested devices
// to the the task.
type AllocateResponse struct {
// container_alloc contains information on how to mount the device
type ReserveResponse struct {
// container_res contains information on how to mount the device
// into a task isolated using container technologies (where the
// host is shared)
ContainerAlloc *ContainerAllocation `protobuf:"bytes,1,opt,name=container_alloc,json=containerAlloc,proto3" json:"container_alloc,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
ContainerRes *ContainerReservation `protobuf:"bytes,1,opt,name=container_res,json=containerRes,proto3" json:"container_res,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AllocateResponse) Reset() { *m = AllocateResponse{} }
func (m *AllocateResponse) String() string { return proto.CompactTextString(m) }
func (*AllocateResponse) ProtoMessage() {}
func (*AllocateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{3}
func (m *ReserveResponse) Reset() { *m = ReserveResponse{} }
func (m *ReserveResponse) String() string { return proto.CompactTextString(m) }
func (*ReserveResponse) ProtoMessage() {}
func (*ReserveResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_device_ad09adbcf7924d2d, []int{3}
}
func (m *AllocateResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AllocateResponse.Unmarshal(m, b)
func (m *ReserveResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReserveResponse.Unmarshal(m, b)
}
func (m *AllocateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AllocateResponse.Marshal(b, m, deterministic)
func (m *ReserveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ReserveResponse.Marshal(b, m, deterministic)
}
func (dst *AllocateResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AllocateResponse.Merge(dst, src)
func (dst *ReserveResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_ReserveResponse.Merge(dst, src)
}
func (m *AllocateResponse) XXX_Size() int {
return xxx_messageInfo_AllocateResponse.Size(m)
func (m *ReserveResponse) XXX_Size() int {
return xxx_messageInfo_ReserveResponse.Size(m)
}
func (m *AllocateResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AllocateResponse.DiscardUnknown(m)
func (m *ReserveResponse) XXX_DiscardUnknown() {
xxx_messageInfo_ReserveResponse.DiscardUnknown(m)
}
var xxx_messageInfo_AllocateResponse proto.InternalMessageInfo
var xxx_messageInfo_ReserveResponse proto.InternalMessageInfo
func (m *AllocateResponse) GetContainerAlloc() *ContainerAllocation {
func (m *ReserveResponse) GetContainerRes() *ContainerReservation {
if m != nil {
return m.ContainerAlloc
return m.ContainerRes
}
return nil
}
// ContainerAllocation returns how to mount the device into a
// ContainerReservation returns how to mount the device into a
// container that shares the host OS.
type ContainerAllocation struct {
type ContainerReservation struct {
// List of environment variable to be set
Envs map[string]string `protobuf:"bytes,1,rep,name=envs,proto3" json:"envs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Mounts for the task.
@ -253,45 +270,45 @@ type ContainerAllocation struct {
XXX_sizecache int32 `json:"-"`
}
func (m *ContainerAllocation) Reset() { *m = ContainerAllocation{} }
func (m *ContainerAllocation) String() string { return proto.CompactTextString(m) }
func (*ContainerAllocation) ProtoMessage() {}
func (*ContainerAllocation) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{4}
func (m *ContainerReservation) Reset() { *m = ContainerReservation{} }
func (m *ContainerReservation) String() string { return proto.CompactTextString(m) }
func (*ContainerReservation) ProtoMessage() {}
func (*ContainerReservation) Descriptor() ([]byte, []int) {
return fileDescriptor_device_ad09adbcf7924d2d, []int{4}
}
func (m *ContainerAllocation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ContainerAllocation.Unmarshal(m, b)
func (m *ContainerReservation) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ContainerReservation.Unmarshal(m, b)
}
func (m *ContainerAllocation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ContainerAllocation.Marshal(b, m, deterministic)
func (m *ContainerReservation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ContainerReservation.Marshal(b, m, deterministic)
}
func (dst *ContainerAllocation) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContainerAllocation.Merge(dst, src)
func (dst *ContainerReservation) XXX_Merge(src proto.Message) {
xxx_messageInfo_ContainerReservation.Merge(dst, src)
}
func (m *ContainerAllocation) XXX_Size() int {
return xxx_messageInfo_ContainerAllocation.Size(m)
func (m *ContainerReservation) XXX_Size() int {
return xxx_messageInfo_ContainerReservation.Size(m)
}
func (m *ContainerAllocation) XXX_DiscardUnknown() {
xxx_messageInfo_ContainerAllocation.DiscardUnknown(m)
func (m *ContainerReservation) XXX_DiscardUnknown() {
xxx_messageInfo_ContainerReservation.DiscardUnknown(m)
}
var xxx_messageInfo_ContainerAllocation proto.InternalMessageInfo
var xxx_messageInfo_ContainerReservation proto.InternalMessageInfo
func (m *ContainerAllocation) GetEnvs() map[string]string {
func (m *ContainerReservation) GetEnvs() map[string]string {
if m != nil {
return m.Envs
}
return nil
}
func (m *ContainerAllocation) GetMounts() []*Mount {
func (m *ContainerReservation) GetMounts() []*Mount {
if m != nil {
return m.Mounts
}
return nil
}
func (m *ContainerAllocation) GetDevices() []*DeviceSpec {
func (m *ContainerReservation) GetDevices() []*DeviceSpec {
if m != nil {
return m.Devices
}
@ -316,7 +333,7 @@ func (m *Mount) Reset() { *m = Mount{} }
func (m *Mount) String() string { return proto.CompactTextString(m) }
func (*Mount) ProtoMessage() {}
func (*Mount) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{5}
return fileDescriptor_device_ad09adbcf7924d2d, []int{5}
}
func (m *Mount) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Mount.Unmarshal(m, b)
@ -377,7 +394,7 @@ func (m *DeviceSpec) Reset() { *m = DeviceSpec{} }
func (m *DeviceSpec) String() string { return proto.CompactTextString(m) }
func (*DeviceSpec) ProtoMessage() {}
func (*DeviceSpec) Descriptor() ([]byte, []int) {
return fileDescriptor_device_065b29983b00b222, []int{6}
return fileDescriptor_device_ad09adbcf7924d2d, []int{6}
}
func (m *DeviceSpec) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DeviceSpec.Unmarshal(m, b)
@ -422,10 +439,10 @@ func init() {
proto.RegisterType((*DetectedDevices)(nil), "hashicorp.nomad.plugins.device.DetectedDevices")
proto.RegisterMapType((map[string]string)(nil), "hashicorp.nomad.plugins.device.DetectedDevices.NodeAttributesEntry")
proto.RegisterType((*DetectedDevice)(nil), "hashicorp.nomad.plugins.device.DetectedDevice")
proto.RegisterType((*AllocateRequest)(nil), "hashicorp.nomad.plugins.device.AllocateRequest")
proto.RegisterType((*AllocateResponse)(nil), "hashicorp.nomad.plugins.device.AllocateResponse")
proto.RegisterType((*ContainerAllocation)(nil), "hashicorp.nomad.plugins.device.ContainerAllocation")
proto.RegisterMapType((map[string]string)(nil), "hashicorp.nomad.plugins.device.ContainerAllocation.EnvsEntry")
proto.RegisterType((*ReserveRequest)(nil), "hashicorp.nomad.plugins.device.ReserveRequest")
proto.RegisterType((*ReserveResponse)(nil), "hashicorp.nomad.plugins.device.ReserveResponse")
proto.RegisterType((*ContainerReservation)(nil), "hashicorp.nomad.plugins.device.ContainerReservation")
proto.RegisterMapType((map[string]string)(nil), "hashicorp.nomad.plugins.device.ContainerReservation.EnvsEntry")
proto.RegisterType((*Mount)(nil), "hashicorp.nomad.plugins.device.Mount")
proto.RegisterType((*DeviceSpec)(nil), "hashicorp.nomad.plugins.device.DeviceSpec")
}
@ -442,15 +459,15 @@ const _ = grpc.SupportPackageIsVersion4
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type DevicePluginClient interface {
// FingerprintDevices allows the device plugin to return a set of
// Fingerprint allows the device plugin to return a set of
// detected devices and provide a mechanism to update the state of
// the device.
FingerprintDevices(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (DevicePlugin_FingerprintDevicesClient, error)
// Allocate is called by the client before starting an allocation
Fingerprint(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (DevicePlugin_FingerprintClient, error)
// Reserve is called by the client before starting an allocation
// that requires access to the plugins devices. The plugin can use
// this to run any setup steps and provides the mounting details to
// the Nomad client
Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error)
Reserve(ctx context.Context, in *ReserveRequest, opts ...grpc.CallOption) (*ReserveResponse, error)
}
type devicePluginClient struct {
@ -461,12 +478,12 @@ func NewDevicePluginClient(cc *grpc.ClientConn) DevicePluginClient {
return &devicePluginClient{cc}
}
func (c *devicePluginClient) FingerprintDevices(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (DevicePlugin_FingerprintDevicesClient, error) {
stream, err := c.cc.NewStream(ctx, &_DevicePlugin_serviceDesc.Streams[0], "/hashicorp.nomad.plugins.device.DevicePlugin/FingerprintDevices", opts...)
func (c *devicePluginClient) Fingerprint(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (DevicePlugin_FingerprintClient, error) {
stream, err := c.cc.NewStream(ctx, &_DevicePlugin_serviceDesc.Streams[0], "/hashicorp.nomad.plugins.device.DevicePlugin/Fingerprint", opts...)
if err != nil {
return nil, err
}
x := &devicePluginFingerprintDevicesClient{stream}
x := &devicePluginFingerprintClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
@ -476,16 +493,16 @@ func (c *devicePluginClient) FingerprintDevices(ctx context.Context, in *empty.E
return x, nil
}
type DevicePlugin_FingerprintDevicesClient interface {
type DevicePlugin_FingerprintClient interface {
Recv() (*DetectedDevices, error)
grpc.ClientStream
}
type devicePluginFingerprintDevicesClient struct {
type devicePluginFingerprintClient struct {
grpc.ClientStream
}
func (x *devicePluginFingerprintDevicesClient) Recv() (*DetectedDevices, error) {
func (x *devicePluginFingerprintClient) Recv() (*DetectedDevices, error) {
m := new(DetectedDevices)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
@ -493,9 +510,9 @@ func (x *devicePluginFingerprintDevicesClient) Recv() (*DetectedDevices, error)
return m, nil
}
func (c *devicePluginClient) Allocate(ctx context.Context, in *AllocateRequest, opts ...grpc.CallOption) (*AllocateResponse, error) {
out := new(AllocateResponse)
err := c.cc.Invoke(ctx, "/hashicorp.nomad.plugins.device.DevicePlugin/Allocate", in, out, opts...)
func (c *devicePluginClient) Reserve(ctx context.Context, in *ReserveRequest, opts ...grpc.CallOption) (*ReserveResponse, error) {
out := new(ReserveResponse)
err := c.cc.Invoke(ctx, "/hashicorp.nomad.plugins.device.DevicePlugin/Reserve", in, out, opts...)
if err != nil {
return nil, err
}
@ -504,56 +521,56 @@ func (c *devicePluginClient) Allocate(ctx context.Context, in *AllocateRequest,
// DevicePluginServer is the server API for DevicePlugin service.
type DevicePluginServer interface {
// FingerprintDevices allows the device plugin to return a set of
// Fingerprint allows the device plugin to return a set of
// detected devices and provide a mechanism to update the state of
// the device.
FingerprintDevices(*empty.Empty, DevicePlugin_FingerprintDevicesServer) error
// Allocate is called by the client before starting an allocation
Fingerprint(*empty.Empty, DevicePlugin_FingerprintServer) error
// Reserve is called by the client before starting an allocation
// that requires access to the plugins devices. The plugin can use
// this to run any setup steps and provides the mounting details to
// the Nomad client
Allocate(context.Context, *AllocateRequest) (*AllocateResponse, error)
Reserve(context.Context, *ReserveRequest) (*ReserveResponse, error)
}
func RegisterDevicePluginServer(s *grpc.Server, srv DevicePluginServer) {
s.RegisterService(&_DevicePlugin_serviceDesc, srv)
}
func _DevicePlugin_FingerprintDevices_Handler(srv interface{}, stream grpc.ServerStream) error {
func _DevicePlugin_Fingerprint_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(empty.Empty)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(DevicePluginServer).FingerprintDevices(m, &devicePluginFingerprintDevicesServer{stream})
return srv.(DevicePluginServer).Fingerprint(m, &devicePluginFingerprintServer{stream})
}
type DevicePlugin_FingerprintDevicesServer interface {
type DevicePlugin_FingerprintServer interface {
Send(*DetectedDevices) error
grpc.ServerStream
}
type devicePluginFingerprintDevicesServer struct {
type devicePluginFingerprintServer struct {
grpc.ServerStream
}
func (x *devicePluginFingerprintDevicesServer) Send(m *DetectedDevices) error {
func (x *devicePluginFingerprintServer) Send(m *DetectedDevices) error {
return x.ServerStream.SendMsg(m)
}
func _DevicePlugin_Allocate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AllocateRequest)
func _DevicePlugin_Reserve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReserveRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DevicePluginServer).Allocate(ctx, in)
return srv.(DevicePluginServer).Reserve(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hashicorp.nomad.plugins.device.DevicePlugin/Allocate",
FullMethod: "/hashicorp.nomad.plugins.device.DevicePlugin/Reserve",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DevicePluginServer).Allocate(ctx, req.(*AllocateRequest))
return srv.(DevicePluginServer).Reserve(ctx, req.(*ReserveRequest))
}
return interceptor(ctx, in, info, handler)
}
@ -563,62 +580,62 @@ var _DevicePlugin_serviceDesc = grpc.ServiceDesc{
HandlerType: (*DevicePluginServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Allocate",
Handler: _DevicePlugin_Allocate_Handler,
MethodName: "Reserve",
Handler: _DevicePlugin_Reserve_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "FingerprintDevices",
Handler: _DevicePlugin_FingerprintDevices_Handler,
StreamName: "Fingerprint",
Handler: _DevicePlugin_Fingerprint_Handler,
ServerStreams: true,
},
},
Metadata: "hashicorp/nomad/plugins/device/device.proto",
Metadata: "plugins/device/device.proto",
}
func init() {
proto.RegisterFile("hashicorp/nomad/plugins/device/device.proto", fileDescriptor_device_065b29983b00b222)
}
func init() { proto.RegisterFile("plugins/device/device.proto", fileDescriptor_device_ad09adbcf7924d2d) }
var fileDescriptor_device_065b29983b00b222 = []byte{
// 608 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x5f, 0x6f, 0xd3, 0x3e,
0x14, 0x5d, 0xd3, 0xfd, 0x49, 0x6f, 0x7f, 0x6a, 0xf7, 0xf3, 0x10, 0x8a, 0x3a, 0xfe, 0x54, 0x91,
0x90, 0x26, 0x10, 0xe9, 0xd4, 0x3d, 0x80, 0x90, 0xf6, 0x30, 0xd6, 0x21, 0xfa, 0xc0, 0x18, 0xe1,
0x15, 0x11, 0xb9, 0xc9, 0xa5, 0xb1, 0x96, 0xda, 0x26, 0x76, 0x2a, 0xf5, 0x13, 0xf0, 0x4d, 0x78,
0xe3, 0x4b, 0xf1, 0x49, 0x50, 0xec, 0xa4, 0xa5, 0x68, 0xa2, 0x0c, 0x9e, 0x12, 0x9f, 0x7b, 0xce,
0xb9, 0x37, 0xf1, 0xb1, 0xe1, 0x49, 0x4a, 0x55, 0xca, 0x62, 0x91, 0xcb, 0x01, 0x17, 0x33, 0x9a,
0x0c, 0x64, 0x56, 0x4c, 0x19, 0x57, 0x83, 0x04, 0xe7, 0x2c, 0xc6, 0xea, 0x11, 0xc8, 0x5c, 0x68,
0x41, 0x1e, 0x2c, 0xc9, 0x81, 0x21, 0x07, 0x15, 0x39, 0xb0, 0xac, 0xde, 0xe1, 0x54, 0x88, 0x69,
0x86, 0x03, 0xc3, 0x9e, 0x14, 0x9f, 0x06, 0x38, 0x93, 0x7a, 0x61, 0xc5, 0xfe, 0x37, 0x07,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xef, 0x3f, 0x34, 0xe9, 0x43, 0x5b, 0x62, 0x3e, 0x63, 0x4a, 0x31, 0xc1, 0x55, 0x15, 0xdd, 0x9f,
0xa1, 0xe1, 0xf7, 0x06, 0xfc, 0x67, 0x5b, 0x5d, 0x99, 0xff, 0x45, 0x28, 0x90, 0x57, 0x8c, 0x4f,
0x31, 0x97, 0x39, 0xe3, 0xba, 0xbe, 0x63, 0xee, 0x06, 0xf6, 0x56, 0x0a, 0xea, 0x5b, 0x29, 0xb8,
0x28, 0x6f, 0xa5, 0xde, 0xe0, 0x96, 0xe7, 0xde, 0xdf, 0x3a, 0x6e, 0x10, 0x01, 0x6e, 0x1d, 0x6c,
0xb2, 0xd1, 0xe0, 0x97, 0x43, 0xd3, 0x3b, 0xfe, 0x73, 0x81, 0x3d, 0x33, 0xfe, 0xd6, 0x64, 0xd7,
0x4c, 0x7d, 0xf2, 0x23, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xe9, 0x62, 0x46, 0xa8, 0x05, 0x00, 0x00,
var fileDescriptor_device_ad09adbcf7924d2d = []byte{
// 625 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0xdb, 0x6e, 0xd3, 0x40,
0x10, 0xad, 0x9d, 0x5e, 0x92, 0x49, 0x49, 0x61, 0xa9, 0x2a, 0x2b, 0xe5, 0x12, 0x59, 0x42, 0xaa,
0x90, 0x70, 0x50, 0x40, 0x02, 0x21, 0x81, 0x54, 0x9a, 0x22, 0xf2, 0x40, 0xa9, 0x0c, 0x2f, 0xf0,
0x80, 0xe5, 0xd8, 0x43, 0xbc, 0xaa, 0xb3, 0xbb, 0xec, 0xae, 0x23, 0xf9, 0x0b, 0xf8, 0x15, 0x3e,
0x89, 0x2f, 0xe0, 0x3b, 0x90, 0x77, 0x9d, 0x34, 0x41, 0x15, 0x51, 0xe1, 0xc9, 0xde, 0x99, 0x73,
0xce, 0x1c,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0x3a, 0xac, 0x49, 0x64, 0x78, 0x39, 0xcf, 0x0d, 0xc3, 0x7f, 0xb8, 0x7e, 0xfa,
0xaa, 0xc7, 0x07, 0x81, 0xc9, 0x62, 0x96, 0xbb, 0xcf, 0xa0, 0xb5, 0xf0, 0x75, 0xad, 0x99, 0xfa,
0x02, 0x5b, 0xc6, 0x0f, 0x39, 0x84, 0x96, 0x8e, 0xd5, 0x45, 0x24, 0x62, 0x9d, 0xd5, 0xd4, 0x66,
0x15, 0x38, 0x8f, 0x75, 0x56, 0x25, 0x33, 0xae, 0xb4, 0x4d, 0x5a, 0x8d, 0x66, 0x15, 0x98, 0x27,
0x25, 0xc6, 0x69, 0xc4, 0x59, 0x5e, 0x9a, 0x81, 0x6a, 0x86, 0xcd, 0x2a, 0xf0, 0x9e, 0xe5, 0xa5,
0x9f, 0x01, 0x5c, 0xfa, 0xfd, 0x8f, 0x22, 0x3d, 0x68, 0x0b, 0x94, 0x53, 0xaa, 0x14, 0xe5, 0x4c,
0xd5, 0x73, 0xbb, 0x1c, 0x1a, 0xfc, 0x74, 0x60, 0xd7, 0x96, 0x3a, 0x37, 0xfd, 0x22, 0x9f, 0xa1,
0xfd, 0x86, 0xb2, 0x09, 0x4a, 0x21, 0x29, 0xd3, 0xe4, 0x20, 0xb0, 0x4b, 0x2c, 0x98, 0x2f, 0xb1,
0xe0, 0xb4, 0x5a, 0x62, 0xdd, 0xfe, 0x35, 0x6f, 0xbb, 0xbf, 0xf1, 0xd8, 0x21, 0x39, 0xec, 0xd4,
0xf3, 0x4c, 0xd6, 0xee, 0x9f, 0xd5, 0x9b, 0xb2, 0xbe, 0xde, 0x1f, 0x17, 0xc5, 0xdf, 0x18, 0x6f,
0x1b, 0xcb, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0xda, 0xf3, 0x34, 0xb8, 0xc4, 0x05, 0x00,
0x00,
}

View File

@ -5,31 +5,36 @@ import "google/protobuf/empty.proto";
// DevicePlugin is the API exposed by device plugins
service DevicePlugin {
// FingerprintDevices allows the device plugin to return a set of
// Fingerprint allows the device plugin to return a set of
// detected devices and provide a mechanism to update the state of
// the device.
rpc FingerprintDevices(google.protobuf.Empty) returns (stream DetectedDevices) {}
rpc Fingerprint(google.protobuf.Empty) returns (stream DetectedDevices) {}
// Allocate is called by the client before starting an allocation
// Reserve is called by the client before starting an allocation
// that requires access to the plugins devices. The plugin can use
// this to run any setup steps and provides the mounting details to
// the Nomad client
rpc Allocate(AllocateRequest) returns (AllocateResponse) {}
rpc Reserve(ReserveRequest) returns (ReserveResponse) {}
}
// DetectedDevices is the set of devices that the device plugin has
// detected and is exposing
message DetectedDevices {
// device_name is the name of the device. It should be scoped by
// vendor (nvidia/gpu, intel/gpu, amd/gpu, )
string device_name = 1;
// vendor is the name of the vendor of the device
string vendor = 1;
// device_type is the type of the device (gpu, fpga, etc).
string device_type = 2;
// device_name is the name of the device.
string device_name = 3;
// devices is the set of devices detected by the plugin.
repeated DetectedDevice devices = 2;
repeated DetectedDevice devices = 4;
// node_attributes allows adding node attributes to be used for
// constraints or affinities.
map<string, string> node_attributes = 3;
map<string, string> node_attributes = 5;
}
// DetectedDevice is a single detected device.
@ -50,25 +55,25 @@ message DetectedDevice {
string pci_bus_id = 4;
}
// AllocateRequest is used to ask the device driver for information on
// ReserveRequest is used to ask the device driver for information on
// how to allocate the requested devices.
message AllocateRequest {
message ReserveRequest {
// device_ids are the requested devices.
repeated string device_ids = 1;
}
// AllocateResponse informs Nomad how to expose the requested devices
// ReserveResponse informs Nomad how to expose the requested devices
// to the the task.
message AllocateResponse {
// container_alloc contains information on how to mount the device
message ReserveResponse {
// container_res contains information on how to mount the device
// into a task isolated using container technologies (where the
// host is shared)
ContainerAllocation container_alloc = 1;
ContainerReservation container_res = 1;
}
// ContainerAllocation returns how to mount the device into a
// ContainerReservation returns how to mount the device into a
// container that shares the host OS.
message ContainerAllocation {
message ContainerReservation {
// List of environment variable to be set
map<string, string> envs = 1;

BIN
vendor/.DS_Store (Stored with Git LFS) vendored

Binary file not shown.