diff options
| author | James Hartig <fastest963@gmail.com> | 2020-08-19 11:42:56 -0400 |
|---|---|---|
| committer | James Hartig <fastest963@gmail.com> | 2020-08-19 11:42:56 -0400 |
| commit | 3ccfa4c6adf967b550defea72c3691956e541e26 (patch) | |
| tree | 6ae6e995774fb4f7a554213202ff3300bf2b5bf8 /weed/server/volume_grpc_admin.go | |
| parent | 3b4b1d4a77f6ac57e35a47316cce1621010f0d7f (diff) | |
| download | seaweedfs-3ccfa4c6adf967b550defea72c3691956e541e26.tar.xz seaweedfs-3ccfa4c6adf967b550defea72c3691956e541e26.zip | |
Added VolumeMarkWritable and VolumeStatus grpc methods
This is necessary for copy to mark as read-only and then restore the
original state afterwards.
Diffstat (limited to 'weed/server/volume_grpc_admin.go')
| -rw-r--r-- | weed/server/volume_grpc_admin.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/weed/server/volume_grpc_admin.go b/weed/server/volume_grpc_admin.go index a058573a3..f81ec649d 100644 --- a/weed/server/volume_grpc_admin.go +++ b/weed/server/volume_grpc_admin.go @@ -149,7 +149,35 @@ func (vs *VolumeServer) VolumeMarkReadonly(ctx context.Context, req *volume_serv } return resp, err +} + +func (vs *VolumeServer) VolumeMarkWritable(ctx context.Context, req *volume_server_pb.VolumeMarkWritableRequest) (*volume_server_pb.VolumeMarkWritableResponse, error) { + + resp := &volume_server_pb.VolumeMarkWritableResponse{} + err := vs.store.MarkVolumeWritable(needle.VolumeId(req.VolumeId)) + + if err != nil { + glog.Errorf("volume mark writable %v: %v", req, err) + } else { + glog.V(2).Infof("volume mark writable %v", req) + } + + return resp, err +} + +func (vs *VolumeServer) VolumeStatus(ctx context.Context, req *volume_server_pb.VolumeStatusRequest) (*volume_server_pb.VolumeStatusResponse, error) { + + resp := &volume_server_pb.VolumeStatusResponse{} + + v := vs.store.GetVolume(needle.VolumeId(req.VolumeId)) + if v == nil { + return nil, fmt.Errorf("not found volume id %d", req.VolumeId) + } + + resp.IsReadOnly = v.IsReadOnly() + + return resp, nil } func (vs *VolumeServer) VolumeServerStatus(ctx context.Context, req *volume_server_pb.VolumeServerStatusRequest) (*volume_server_pb.VolumeServerStatusResponse, error) { |
