Skip to content

Commit

Permalink
lxd/storage/drivers: Add named results to 'thinPoolVolumeUsage'
Browse files Browse the repository at this point in the history
Signed-off-by: Kadin Sayani <[email protected]>
  • Loading branch information
kadinsayani committed Oct 7, 2024
1 parent dedd690 commit 0dc112b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lxd/storage/drivers/driver_lvm_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ func (d *lvm) logicalVolumeSize(volDevPath string) (int64, error) {
return strconv.ParseInt(output, 10, 64)
}

func (d *lvm) thinPoolVolumeUsage(volDevPath string) (uint64, uint64, error) {
func (d *lvm) thinPoolVolumeUsage(volDevPath string) (totalSize uint64, usedSize uint64, err error) {
args := []string{
volDevPath,
"--noheadings",
Expand All @@ -718,7 +718,7 @@ func (d *lvm) thinPoolVolumeUsage(volDevPath string) (uint64, uint64, error) {
return 0, 0, fmt.Errorf("Failed parsing thin volume total size (%q): %w", parts[0], err)
}

totalSize := total
totalSize = total

// Used percentage is not available if thin volume isn't activated.
if parts[1] == "" {
Expand All @@ -740,7 +740,7 @@ func (d *lvm) thinPoolVolumeUsage(volDevPath string) (uint64, uint64, error) {
}
}

usedSize := uint64(float64(total) * ((dataPerc + metaPerc) / 100))
usedSize = uint64(float64(total) * ((dataPerc + metaPerc) / 100))

return totalSize, usedSize, nil
}
Expand Down

0 comments on commit 0dc112b

Please sign in to comment.