mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
dynamic host volumes: CE side of quota tweaks (#24972)
* quota spec: if `region_limit.storage.host_volumes` is set, do not require that `variables` also be set, and vice versa. * subtract from quota usage on volume delete * stub CE quota subtraction method
This commit is contained in:
@@ -355,6 +355,8 @@ func parseQuotaMegabytes(raw any) (int, error) {
|
||||
return int(b >> 20), nil
|
||||
case int:
|
||||
return val, nil
|
||||
case nil:
|
||||
return 0, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid type %T", raw)
|
||||
}
|
||||
|
||||
@@ -142,6 +142,11 @@ func (s *StateStore) DeleteHostVolume(index uint64, ns string, id string) error
|
||||
}
|
||||
}
|
||||
|
||||
err = s.subtractVolumeFromQuotaUsageTxn(txn, index, vol)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = txn.Delete(TableHostVolumes, vol)
|
||||
if err != nil {
|
||||
return fmt.Errorf("host volume delete: %w", err)
|
||||
|
||||
@@ -14,3 +14,7 @@ func (s *StateStore) EnforceHostVolumeQuota(_ *structs.HostVolume, _ *structs.Ho
|
||||
func (s *StateStore) enforceHostVolumeQuotaTxn(_ Txn, _ uint64, _ *structs.HostVolume, _ *structs.HostVolume, _ bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *StateStore) subtractVolumeFromQuotaUsageTxn(_ Txn, _ uint64, _ *structs.HostVolume) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user