move volume mount/unmount on volume server to grpc

This commit is contained in:
Chris Lu 2018-10-15 01:48:15 -07:00
parent 66a353dcb5
commit f8b2d3cacc
5 changed files with 220 additions and 66 deletions

View file

@ -23,6 +23,12 @@ service VolumeServer {
}
rpc VolumeSyncStatus (VolumeSyncStatusRequest) returns (VolumeSyncStatusResponse) {
}
rpc VolumeMount (VolumeMountRequest) returns (VolumeMountResponse) {
}
rpc VolumeUnmount (VolumeUnmountRequest) returns (VolumeUnmountResponse) {
}
}
//////////////////////////////////////////////////
@ -97,3 +103,15 @@ message VolumeSyncStatusResponse {
uint32 compact_revision = 7;
uint64 idx_file_size = 8;
}
message VolumeMountRequest {
uint32 volumd_id = 1;
}
message VolumeMountResponse {
}
message VolumeUnmountRequest {
uint32 volumd_id = 1;
}
message VolumeUnmountResponse {
}

View file

@ -27,6 +27,10 @@ It has these top-level messages:
AssignVolumeResponse
VolumeSyncStatusRequest
VolumeSyncStatusResponse
VolumeMountRequest
VolumeMountResponse
VolumeUnmountRequest
VolumeUnmountResponse
*/
package volume_server_pb
@ -394,6 +398,54 @@ func (m *VolumeSyncStatusResponse) GetIdxFileSize() uint64 {
return 0
}
type VolumeMountRequest struct {
VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
}
func (m *VolumeMountRequest) Reset() { *m = VolumeMountRequest{} }
func (m *VolumeMountRequest) String() string { return proto.CompactTextString(m) }
func (*VolumeMountRequest) ProtoMessage() {}
func (*VolumeMountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *VolumeMountRequest) GetVolumdId() uint32 {
if m != nil {
return m.VolumdId
}
return 0
}
type VolumeMountResponse struct {
}
func (m *VolumeMountResponse) Reset() { *m = VolumeMountResponse{} }
func (m *VolumeMountResponse) String() string { return proto.CompactTextString(m) }
func (*VolumeMountResponse) ProtoMessage() {}
func (*VolumeMountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
type VolumeUnmountRequest struct {
VolumdId uint32 `protobuf:"varint,1,opt,name=volumd_id,json=volumdId" json:"volumd_id,omitempty"`
}
func (m *VolumeUnmountRequest) Reset() { *m = VolumeUnmountRequest{} }
func (m *VolumeUnmountRequest) String() string { return proto.CompactTextString(m) }
func (*VolumeUnmountRequest) ProtoMessage() {}
func (*VolumeUnmountRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (m *VolumeUnmountRequest) GetVolumdId() uint32 {
if m != nil {
return m.VolumdId
}
return 0
}
type VolumeUnmountResponse struct {
}
func (m *VolumeUnmountResponse) Reset() { *m = VolumeUnmountResponse{} }
func (m *VolumeUnmountResponse) String() string { return proto.CompactTextString(m) }
func (*VolumeUnmountResponse) ProtoMessage() {}
func (*VolumeUnmountResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func init() {
proto.RegisterType((*BatchDeleteRequest)(nil), "volume_server_pb.BatchDeleteRequest")
proto.RegisterType((*BatchDeleteResponse)(nil), "volume_server_pb.BatchDeleteResponse")
@ -413,6 +465,10 @@ func init() {
proto.RegisterType((*AssignVolumeResponse)(nil), "volume_server_pb.AssignVolumeResponse")
proto.RegisterType((*VolumeSyncStatusRequest)(nil), "volume_server_pb.VolumeSyncStatusRequest")
proto.RegisterType((*VolumeSyncStatusResponse)(nil), "volume_server_pb.VolumeSyncStatusResponse")
proto.RegisterType((*VolumeMountRequest)(nil), "volume_server_pb.VolumeMountRequest")
proto.RegisterType((*VolumeMountResponse)(nil), "volume_server_pb.VolumeMountResponse")
proto.RegisterType((*VolumeUnmountRequest)(nil), "volume_server_pb.VolumeUnmountRequest")
proto.RegisterType((*VolumeUnmountResponse)(nil), "volume_server_pb.VolumeUnmountResponse")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -435,6 +491,8 @@ type VolumeServerClient interface {
DeleteCollection(ctx context.Context, in *DeleteCollectionRequest, opts ...grpc.CallOption) (*DeleteCollectionResponse, error)
AssignVolume(ctx context.Context, in *AssignVolumeRequest, opts ...grpc.CallOption) (*AssignVolumeResponse, error)
VolumeSyncStatus(ctx context.Context, in *VolumeSyncStatusRequest, opts ...grpc.CallOption) (*VolumeSyncStatusResponse, error)
VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error)
VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error)
}
type volumeServerClient struct {
@ -517,6 +575,24 @@ func (c *volumeServerClient) VolumeSyncStatus(ctx context.Context, in *VolumeSyn
return out, nil
}
func (c *volumeServerClient) VolumeMount(ctx context.Context, in *VolumeMountRequest, opts ...grpc.CallOption) (*VolumeMountResponse, error) {
out := new(VolumeMountResponse)
err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeMount", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *volumeServerClient) VolumeUnmount(ctx context.Context, in *VolumeUnmountRequest, opts ...grpc.CallOption) (*VolumeUnmountResponse, error) {
out := new(VolumeUnmountResponse)
err := grpc.Invoke(ctx, "/volume_server_pb.VolumeServer/VolumeUnmount", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for VolumeServer service
type VolumeServerServer interface {
@ -529,6 +605,8 @@ type VolumeServerServer interface {
DeleteCollection(context.Context, *DeleteCollectionRequest) (*DeleteCollectionResponse, error)
AssignVolume(context.Context, *AssignVolumeRequest) (*AssignVolumeResponse, error)
VolumeSyncStatus(context.Context, *VolumeSyncStatusRequest) (*VolumeSyncStatusResponse, error)
VolumeMount(context.Context, *VolumeMountRequest) (*VolumeMountResponse, error)
VolumeUnmount(context.Context, *VolumeUnmountRequest) (*VolumeUnmountResponse, error)
}
func RegisterVolumeServerServer(s *grpc.Server, srv VolumeServerServer) {
@ -679,6 +757,42 @@ func _VolumeServer_VolumeSyncStatus_Handler(srv interface{}, ctx context.Context
return interceptor(ctx, in, info, handler)
}
func _VolumeServer_VolumeMount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VolumeMountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VolumeServerServer).VolumeMount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/volume_server_pb.VolumeServer/VolumeMount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VolumeServerServer).VolumeMount(ctx, req.(*VolumeMountRequest))
}
return interceptor(ctx, in, info, handler)
}
func _VolumeServer_VolumeUnmount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(VolumeUnmountRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(VolumeServerServer).VolumeUnmount(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/volume_server_pb.VolumeServer/VolumeUnmount",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(VolumeServerServer).VolumeUnmount(ctx, req.(*VolumeUnmountRequest))
}
return interceptor(ctx, in, info, handler)
}
var _VolumeServer_serviceDesc = grpc.ServiceDesc{
ServiceName: "volume_server_pb.VolumeServer",
HandlerType: (*VolumeServerServer)(nil),
@ -715,6 +829,14 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
MethodName: "VolumeSyncStatus",
Handler: _VolumeServer_VolumeSyncStatus_Handler,
},
{
MethodName: "VolumeMount",
Handler: _VolumeServer_VolumeMount_Handler,
},
{
MethodName: "VolumeUnmount",
Handler: _VolumeServer_VolumeUnmount_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "volume_server.proto",
@ -723,48 +845,52 @@ var _VolumeServer_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("volume_server.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 683 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 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5, 0x57, 0x29, 0x76, 0xae, 0xa7, 0xa0, 0x5f, 0xb0, 0xdf, 0x64, 0xbf,
0x84, 0x25, 0xe5, 0x31, 0xd6, 0xeb, 0x8a, 0xd1, 0x73, 0xd5, 0x5b, 0x20, 0xf9, 0xe5, 0x27, 0x7b,
0xa5, 0x34, 0x7f, 0xcd, 0xc5, 0xda, 0xaf, 0x16, 0xbc, 0xb0, 0xd1, 0xc8, 0x16, 0x4a, 0x1b, 0x4d,
0x19, 0x4f, 0x69, 0xa3, 0x19, 0xaf, 0x59, 0x22, 0x37, 0xd0, 0xcb, 0x5a, 0x06, 0xd9, 0x59, 0xf4,
0x3b, 0x96, 0x73, 0x24, 0x6b, 0xb7, 0x4a, 0xe8, 0x5c, 0xcc, 0x81, 0x4e, 0x72, 0xb1, 0x49, 0xc1,
0xd0, 0x15, 0x58, 0x94, 0xf5, 0xaa, 0x2c, 0x2c, 0xd9, 0x4d, 0x76, 0xd1, 0x8b, 0xba, 0x59, 0xe0,
0x22, 0x45, 0xdd, 0x2c, 0xf2, 0x0d, 0xba, 0x74, 0xd1, 0xd4, 0x7f, 0x30, 0xde, 0xfe, 0x09, 0x00,
0x00, 0xff, 0xff, 0xf6, 0x2c, 0x4e, 0x35, 0x77, 0x08, 0x00, 0x00,
// 748 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x56, 0xdb, 0x6e, 0xd3, 0x40,
0x10, 0x8d, 0x9b, 0x6b, 0x27, 0x89, 0x08, 0x9b, 0xb6, 0x71, 0x5d, 0x28, 0x91, 0x81, 0x92, 0x5e,
0x28, 0xa2, 0x95, 0xa0, 0xbc, 0x01, 0x05, 0xa4, 0x3e, 0xa0, 0x4a, 0xae, 0xe8, 0x0b, 0x48, 0x96,
0xe3, 0x6c, 0xdb, 0x55, 0x37, 0xb6, 0xeb, 0x5d, 0x57, 0x2d, 0x5f, 0xc4, 0x27, 0xf0,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xec, 0xb9, 0xea, 0x0d, 0xa0, 0xac, 0x29, 0xa1,
0xdd, 0x42, 0x9a, 0x7f, 0xa6, 0xa7, 0xed, 0x95, 0x4b, 0x5e, 0xd8, 0xa8, 0xb4, 0xab, 0xc2, 0x46,
0x13, 0x86, 0x58, 0xd8, 0x68, 0xca, 0x03, 0x2b, 0xe8, 0x1a, 0x7a, 0x69, 0x2b, 0x43, 0xdb, 0x8b,
0x7e, 0x5f, 0x33, 0x4e, 0xa9, 0xed, 0x94, 0x49, 0x9d, 0x8b, 0x99, 0xd0, 0x89, 0x1b, 0x0e, 0xca,
0x19, 0xba, 0x1c, 0xeb, 0xd4, 0xb6, 0x8a, 0xd2, 0xe2, 0xdd, 0xa4, 0x0d, 0x28, 0xaf, 0x9b, 0x05,
0xee, 0x96, 0xd7, 0xcd, 0x22, 0x3f, 0xd3, 0x2b, 0xe1, 0x9e, 0xc5, 0xb6, 0x3b, 0x6f, 0xcf, 0xb2,
0x7e, 0x91, 0xb7, 0x67, 0x79, 0x16, 0x51, 0x41, 0x63, 0xe8, 0x26, 0xf6, 0x1d, 0x6d, 0x2d, 0x42,
0x26, 0x5d, 0x44, 0x7b, 0x51, 0x98, 0x37, 0xd3, 0x18, 0x37, 0xc4, 0x5f, 0xb7, 0xc3, 0xbf, 0x01,
0x00, 0x00, 0xff, 0xff, 0x32, 0xfe, 0x38, 0x2b, 0xd1, 0x09, 0x00, 0x00,
}

View file

@ -46,3 +46,35 @@ func (vs *VolumeServer) AssignVolume(ctx context.Context, req *volume_server_pb.
return resp, err
}
func (vs *VolumeServer) VolumeMount(ctx context.Context, req *volume_server_pb.VolumeMountRequest) (*volume_server_pb.VolumeMountResponse, error) {
resp := &volume_server_pb.VolumeMountResponse{}
err := vs.store.MountVolume(storage.VolumeId(req.VolumdId))
if err != nil {
glog.Errorf("volume mount %v: %v", req, err)
} else {
glog.V(2).Infof("volume mount %v", req)
}
return resp, err
}
func (vs *VolumeServer) VolumeUnmount(ctx context.Context, req *volume_server_pb.VolumeUnmountRequest) (*volume_server_pb.VolumeUnmountResponse, error) {
resp := &volume_server_pb.VolumeUnmountResponse{}
err := vs.store.UnmountVolume(storage.VolumeId(req.VolumdId))
if err != nil {
glog.Errorf("volume unmount %v: %v", req, err)
} else {
glog.V(2).Infof("volume unmount %v", req)
}
return resp, err
}

View file

@ -49,8 +49,6 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
adminMux.HandleFunc("/status", vs.guard.WhiteList(vs.statusHandler))
adminMux.HandleFunc("/admin/sync/index", vs.guard.WhiteList(vs.getVolumeIndexContentHandler))
adminMux.HandleFunc("/admin/sync/data", vs.guard.WhiteList(vs.getVolumeDataContentHandler))
adminMux.HandleFunc("/admin/volume/mount", vs.guard.WhiteList(vs.getVolumeMountHandler))
adminMux.HandleFunc("/admin/volume/unmount", vs.guard.WhiteList(vs.getVolumeUnmountHandler))
adminMux.HandleFunc("/stats/counter", vs.guard.WhiteList(statsCounterHandler))
adminMux.HandleFunc("/stats/memory", vs.guard.WhiteList(statsMemoryHandler))
adminMux.HandleFunc("/stats/disk", vs.guard.WhiteList(vs.statsDiskHandler))

View file

@ -41,23 +41,3 @@ func (vs *VolumeServer) getVolume(volumeParameterName string, r *http.Request) (
}
return v, nil
}
func (vs *VolumeServer) getVolumeMountHandler(w http.ResponseWriter, r *http.Request) {
vid, err := vs.getVolumeId("volume", r)
if err != nil {
writeJsonError(w, r, http.StatusNotFound, err)
return
}
vs.store.MountVolume(vid)
writeJsonQuiet(w, r, http.StatusOK, "Volume mounted")
}
func (vs *VolumeServer) getVolumeUnmountHandler(w http.ResponseWriter, r *http.Request) {
vid, err := vs.getVolumeId("volume", r)
if err != nil {
writeJsonError(w, r, http.StatusNotFound, err)
return
}
vs.store.UnmountVolume(vid)
writeJsonQuiet(w, r, http.StatusOK, "Volume unmounted")
}