diff --git a/command/quota_apply.go b/command/quota_apply.go index 4e91acf5e..9a7466c32 100644 --- a/command/quota_apply.go +++ b/command/quota_apply.go @@ -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) } diff --git a/nomad/state/state_store_host_volumes.go b/nomad/state/state_store_host_volumes.go index 961f1a16e..4a5c4702d 100644 --- a/nomad/state/state_store_host_volumes.go +++ b/nomad/state/state_store_host_volumes.go @@ -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) diff --git a/nomad/state/state_store_host_volumes_ce.go b/nomad/state/state_store_host_volumes_ce.go index b2022eaa1..8c25d2ad4 100644 --- a/nomad/state/state_store_host_volumes_ce.go +++ b/nomad/state/state_store_host_volumes_ce.go @@ -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 +}