aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_unmount.go
diff options
context:
space:
mode:
authoryulai.li <blacktear23@gmail.com>2022-06-26 22:43:37 +0800
committeryulai.li <blacktear23@gmail.com>2022-06-26 22:43:37 +0800
commit46e0b629e529f3aff535f90dd25eb719adf1c0d0 (patch)
tree734125b48b6d96f8796a2b89b924312cd169ef0e /weed/shell/command_volume_unmount.go
parenta5bd0b3a1644a77dcc0b9ff41c4ce8eb3ea0d566 (diff)
parentdc59ccd110a321db7d0b0480631aa95a3d9ba7e6 (diff)
downloadseaweedfs-46e0b629e529f3aff535f90dd25eb719adf1c0d0.tar.xz
seaweedfs-46e0b629e529f3aff535f90dd25eb719adf1c0d0.zip
Update tikv client version and add one PC support
Diffstat (limited to 'weed/shell/command_volume_unmount.go')
-rw-r--r--weed/shell/command_volume_unmount.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/weed/shell/command_volume_unmount.go b/weed/shell/command_volume_unmount.go
index f7e5a501b..85bec44f7 100644
--- a/weed/shell/command_volume_unmount.go
+++ b/weed/shell/command_volume_unmount.go
@@ -3,6 +3,7 @@ package shell
import (
"context"
"flag"
+ "github.com/chrislusf/seaweedfs/weed/pb"
"io"
"github.com/chrislusf/seaweedfs/weed/operation"
@@ -34,10 +35,6 @@ func (c *commandVolumeUnmount) Help() string {
func (c *commandVolumeUnmount) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
- if err = commandEnv.confirmIsLocked(); err != nil {
- return
- }
-
volUnmountCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
volumeIdInt := volUnmountCommand.Int("volumeId", 0, "the volume id")
nodeStr := volUnmountCommand.String("node", "", "the volume server <host>:<port>")
@@ -45,7 +42,11 @@ func (c *commandVolumeUnmount) Do(args []string, commandEnv *CommandEnv, writer
return nil
}
- sourceVolumeServer := *nodeStr
+ if err = commandEnv.confirmIsLocked(args); err != nil {
+ return
+ }
+
+ sourceVolumeServer := pb.ServerAddress(*nodeStr)
volumeId := needle.VolumeId(*volumeIdInt)
@@ -53,8 +54,8 @@ func (c *commandVolumeUnmount) Do(args []string, commandEnv *CommandEnv, writer
}
-func unmountVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer string) (err error) {
- return operation.WithVolumeServerClient(sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
+func unmountVolume(grpcDialOption grpc.DialOption, volumeId needle.VolumeId, sourceVolumeServer pb.ServerAddress) (err error) {
+ return operation.WithVolumeServerClient(false, sourceVolumeServer, grpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
_, unmountErr := volumeServerClient.VolumeUnmount(context.Background(), &volume_server_pb.VolumeUnmountRequest{
VolumeId: uint32(volumeId),
})