mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
snap/quota: review feedback
rename IsZero to Unset
This commit is contained in:
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user