Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

volume.tier.move: passing non-empty disk type

Chris Lu30b30b8fe0bd
diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go
index 3b6524df84..cf9f9f7772 100644
--- a/weed/server/volume_grpc_copy.go
+++ b/weed/server/volume_grpc_copy.go
@@ -61,7 +61,7 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
}
location := vs.store.FindFreeLocation(types.ToDiskType(diskType))
if location == nil {
- return fmt.Errorf("no space left")
+ return fmt.Errorf("no space left for disk type %s", types.ToDiskType(diskType).ReadableString())
}
dataBaseFileName = storage.VolumeFileName(location.Directory, volFileInfoResp.Collection, int(req.VolumeId))
diff --git a/weed/shell/command_volume_tier_move.go b/weed/shell/command_volume_tier_move.go
index fb52c5d963..a15efd6b34 100644
--- a/weed/shell/command_volume_tier_move.go
+++ b/weed/shell/command_volume_tier_move.go
@@ -116,7 +116,7 @@ func doVolumeTierMove(commandEnv *CommandEnv, writer io.Writer, collection strin
if sourceVolumeServer == "" {
continue
}
- fmt.Fprintf(writer, "moving volume %d %s from %s to dataNode %s with disk type ...\n", vid, sourceVolumeServer, dst.dataNode.Id, toDiskType.String())
+ fmt.Fprintf(writer, "moving volume %d from %s to %s with disk type %s ...\n", vid, sourceVolumeServer, dst.dataNode.Id, toDiskType.ReadableString())
hasFoundTarget = true
if !applyChanges {
@@ -127,7 +127,7 @@ func doVolumeTierMove(commandEnv *CommandEnv, writer io.Writer, collection strin
if err = markVolumeReadonly(commandEnv.option.GrpcDialOption, vid, locations); err != nil {
return fmt.Errorf("mark volume %d as readonly on %s: %v", vid, locations[0].Url, err)
}
- if err = LiveMoveVolume(commandEnv.option.GrpcDialOption, vid, sourceVolumeServer, dst.dataNode.Id, 5*time.Second, toDiskType.String()); err != nil {
+ if err = LiveMoveVolume(commandEnv.option.GrpcDialOption, vid, sourceVolumeServer, dst.dataNode.Id, 5*time.Second, toDiskType.ReadableString()); err != nil {
return fmt.Errorf("move volume %d %s => %s : %v", vid, locations[0].Url, dst.dataNode.Id, err)
}
@@ -143,7 +143,7 @@ func doVolumeTierMove(commandEnv *CommandEnv, writer io.Writer, collection strin
}
if !hasFoundTarget {
- fmt.Fprintf(writer, "can not find disk type %s for volume %d\n", toDiskType.String(), vid)
+ fmt.Fprintf(writer, "can not find disk type %s for volume %d\n", toDiskType.ReadableString(), vid)
}
return nil
diff --git a/weed/storage/types/volume_disk_type.go b/weed/storage/types/volume_disk_type.go
index 25056ee105..c9b87d8026 100644
--- a/weed/storage/types/volume_disk_type.go
+++ b/weed/storage/types/volume_disk_type.go
@@ -31,3 +31,10 @@ func (diskType DiskType) String() string {
}
return string(diskType)
}
+
+func (diskType DiskType) ReadableString() string {
+ if diskType == "" {
+ return "hdd"
+ }
+ return string(diskType)
+}