[shell]: volume balance capacity by min volume density (#8026)

volume balance by min volume density and active volumes
This commit is contained in:
Konstantin Lebedev
2026-02-20 02:30:59 +05:00
committed by GitHub
parent 7b8df39cf7
commit 01b3125815
6 changed files with 149 additions and 32 deletions

View File

@@ -67,10 +67,11 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre
diskType = req.DiskType
}
location := vs.store.FindFreeLocation(func(location *storage.DiskLocation) bool {
return location.DiskType == types.ToDiskType(diskType)
return location.DiskType == types.ToDiskType(diskType) &&
location.AvailableSpace.Load() > volFileInfoResp.DatFileSize
})
if location == nil {
return fmt.Errorf("no space left for disk type %s", types.ToDiskType(diskType).ReadableString())
return fmt.Errorf("%s %s", util.ErrVolumeNoSpaceLeft, types.ToDiskType(diskType).ReadableString())
}
dataBaseFileName = storage.VolumeFileName(location.Directory, volFileInfoResp.Collection, int(req.VolumeId))