snap/quota: review feedback

rename IsZero to Unset
This commit is contained in:
Philip Meulengracht
2022-09-01 09:43:16 +02:00
parent a087b0ce07
commit 0e5affc574
2 changed files with 4 additions and 4 deletions

View File

@@ -416,7 +416,7 @@ func quotaRemove(st *state.State, action QuotaControlAction, allGrps map[string]
return nil, nil, false, fmt.Errorf("internal error, AddSnaps option cannot be used with remove action")
}
if !action.ResourceLimits.IsZero() {
if !action.ResourceLimits.Unset() {
return nil, nil, false, fmt.Errorf("internal error, quota limit options cannot be used with remove action")
}

View File

@@ -203,8 +203,8 @@ func (qr *Resources) CheckFeatureRequirements() error {
return nil
}
// IsZero returns true if there is no limit set
func (qr *Resources) IsZero() bool {
// Unset returns true if there is no limit set
func (qr *Resources) Unset() bool {
return qr.Memory == nil && qr.CPU == nil && qr.CPUSet == nil && qr.Threads == nil && qr.Journal == nil
}
@@ -215,7 +215,7 @@ func (qr *Resources) IsZero() bool {
// Note that before applying the quota to the system
// CheckFeatureRequirements() should be called.
func (qr *Resources) Validate() error {
if qr.IsZero() {
if qr.Unset() {
return fmt.Errorf("quota group must have at least one resource limit set")
}