cephfs admin: rename "NewSize" type to "QuotaSize"

This clarifies what the size values are for when this interface is used
and hopefully clarifies what the size actually does to a subvolume. This
also generalizes the type a bit in preparation for it being used in
other upcoming functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-09-02 08:29:48 -04:00 committed by John Mulligan
parent fbb4f957eb
commit d8143f5bae
2 changed files with 12 additions and 12 deletions

View File

@ -13,25 +13,25 @@ const (
tebiByte = 1024 * gibiByte tebiByte = 1024 * gibiByte
) )
// newSizeValue returns a size value as a string, as needed by the subvolume // resizeValue returns a size value as a string, as needed by the subvolume
// resize command json. // resize command json.
func (bc ByteCount) newSizeValue() string { func (bc ByteCount) resizeValue() string {
return uint64String(uint64(bc)) return uint64String(uint64(bc))
} }
// NewSize interface values can be used to change the size of a volume. // QuotaSize interface values can be used to change the size of a volume.
type NewSize interface { type QuotaSize interface {
newSizeValue() string resizeValue() string
} }
// specialSize is a custom non-numeric new size value. // specialSize is a custom non-numeric quota size value.
type specialSize string type specialSize string
// newSizeValue for a specialSize returns the literal string. // resizeValue for a specialSize returns the original string value.
func (s specialSize) newSizeValue() string { func (s specialSize) resizeValue() string {
return string(s) return string(s)
} }
// Infinite is a special NewSize value that can be used to clear size limits on // Infinite is a special QuotaSize value that can be used to clear size limits
// a subvolume. // on a subvolume.
const Infinite = specialSize("infinite") const Infinite = specialSize("infinite")

View File

@ -125,7 +125,7 @@ type SubVolumeResizeResult struct {
// ceph fs subvolume resize <volume> --group-name=<group> <name> ... // ceph fs subvolume resize <volume> --group-name=<group> <name> ...
func (fsa *FSAdmin) ResizeSubVolume( func (fsa *FSAdmin) ResizeSubVolume(
volume, group, name string, volume, group, name string,
newSize NewSize, noShrink bool) (*SubVolumeResizeResult, error) { newSize QuotaSize, noShrink bool) (*SubVolumeResizeResult, error) {
f := &subVolumeResizeFields{ f := &subVolumeResizeFields{
Prefix: "fs subvolume resize", Prefix: "fs subvolume resize",
@ -133,7 +133,7 @@ func (fsa *FSAdmin) ResizeSubVolume(
VolName: volume, VolName: volume,
GroupName: group, GroupName: group,
SubName: name, SubName: name,
NewSize: newSize.newSizeValue(), NewSize: newSize.resizeValue(),
NoShrink: noShrink, NoShrink: noShrink,
} }
var result []*SubVolumeResizeResult var result []*SubVolumeResizeResult