Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/device/device-util.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func findBestPart(diskMetaName string, partSize uint64) (string, uint64, error)
return pList[i].SizeMiB < pList[j].SizeMiB
})
for _, tmp := range pList {
if tmp.SizeMiB > partSize {
if tmp.SizeMiB >= partSize {
return tmp.DiskName, tmp.StartMiB, nil
}
}
Expand Down Expand Up @@ -295,7 +295,8 @@ func parsePartFree(row partedOutput) partFree {
endMib := math.Floor(float64(row.endBytes) / 1024 / 1024)
sizeMib := uint64(0)
if endMib > beginMib {
sizeMib = uint64(endMib - beginMib)
// calculate the part free size, needs increase the difference by 1
sizeMib = uint64(math.Floor(float64(row.endBytes-row.beginBytes+1) / 1024 / 1024))
}

return partFree{
Expand Down