|
|
@ -3,6 +3,7 @@ package shell |
|
|
|
import ( |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/glog" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/pb/master_pb" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/storage/types" |
|
|
|
"github.com/chrislusf/seaweedfs/weed/wdclient" |
|
|
@ -172,10 +173,16 @@ func (c *commandVolumeTierMove) doVolumeTierMove(commandEnv *CommandEnv, writer |
|
|
|
func (c *commandVolumeTierMove) doMoveOneVolume(commandEnv *CommandEnv, writer io.Writer, vid needle.VolumeId, toDiskType types.DiskType, locations []wdclient.Location, sourceVolumeServer string, dst location) (err error) { |
|
|
|
|
|
|
|
// mark all replicas as read only
|
|
|
|
if err = markVolumeReadonly(commandEnv.option.GrpcDialOption, vid, locations); err != nil { |
|
|
|
if err = markVolumeReplicasWritable(commandEnv.option.GrpcDialOption, vid, locations, false); err != nil { |
|
|
|
return fmt.Errorf("mark volume %d as readonly on %s: %v", vid, locations[0].Url, err) |
|
|
|
} |
|
|
|
if err = LiveMoveVolume(commandEnv.option.GrpcDialOption, writer, vid, sourceVolumeServer, dst.dataNode.Id, 5*time.Second, toDiskType.ReadableString(), true); err != nil { |
|
|
|
|
|
|
|
// mark all replicas as writable
|
|
|
|
if err = markVolumeReplicasWritable(commandEnv.option.GrpcDialOption, vid, locations, true); err != nil { |
|
|
|
glog.Errorf("mark volume %d as writable on %s: %v", vid, locations[0].Url, err) |
|
|
|
} |
|
|
|
|
|
|
|
return fmt.Errorf("move volume %d %s => %s : %v", vid, locations[0].Url, dst.dataNode.Id, err) |
|
|
|
} |
|
|
|
|
|
|
|