Skip to content

Commit 2cb9f70

Browse files
committed
fix review comments
1 parent 86f87f3 commit 2cb9f70

File tree

4 files changed

+11
-24
lines changed

4 files changed

+11
-24
lines changed

client/fingerprint/storage.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,8 @@ func (f *StorageFingerprint) Fingerprint(req *FingerprintRequest, resp *Fingerpr
4848
total = uint64(cfg.DiskTotalMB) * bytesPerMegabyte
4949
}
5050

51-
free := total - f.reservedDisk(req)
52-
53-
// DEPRECATED: remove in 1.13.0
54-
if cfg.DiskFreeMB > 0 {
55-
f.logger.Warn("disk_free_mb is deprecated, please use reserved.disk")
56-
free = uint64(cfg.DiskFreeMB) * bytesPerMegabyte
57-
}
58-
5951
resp.AddAttribute("unique.storage.volume", volume)
6052
resp.AddAttribute("unique.storage.bytestotal", strconv.FormatUint(total, 10))
61-
resp.AddAttribute("unique.storage.bytesfree", strconv.FormatUint(free, 10))
6253

6354
// set the disk size for the response
6455
resp.NodeResources = &structs.NodeResources{
@@ -70,14 +61,3 @@ func (f *StorageFingerprint) Fingerprint(req *FingerprintRequest, resp *Fingerpr
7061

7162
return nil
7263
}
73-
74-
func (f *StorageFingerprint) reservedDisk(req *FingerprintRequest) uint64 {
75-
switch {
76-
case req.Config.Node == nil:
77-
return 0
78-
case req.Config.Node.ReservedResources == nil:
79-
return 0
80-
default:
81-
return uint64(req.Config.Node.ReservedResources.Disk.DiskMB)
82-
}
83-
}

command/agent/agent.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,12 @@ func (a *Agent) finalizeClientConfig(c *clientconfig.Config) error {
771771
to configure Nomad to work with Consul.`)
772772
}
773773

774+
// Log deprecation message about setting disk_free_mb
775+
if c.DiskFreeMB != 0 {
776+
a.logger.Warn(`disk_free_mb is deprecated and ignored by Nomad.
777+
Please use client.reserved.disk to configure reservable disk for scheduling.`)
778+
}
779+
774780
// If the operator has not set an intro token via the CLI or an environment
775781
// variable, attempt to read the intro token from the file system. This
776782
// cannot be used as a CLI override.

website/content/docs/configuration/client.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ client {
9797

9898
- `disk_free_mb` `(int:0)` - Specifies the disk space free for scheduling
9999
allocations. If set, this value overrides any detected free disk space. This
100-
value can be seen in `nomad node status` under Allocated Resources. Deprecated -
101-
please use client.reserved.disk instead.
100+
value can be seen in `nomad node status` under Allocated Resources. Deprecated.
101+
Use [`client.reserved.disk`](#reserved-parameters) instead.
102102

103103
- `min_dynamic_port` `(int:20000)` - Specifies the minimum dynamic port to be
104104
assigned. Individual ports and ranges of ports may be excluded from dynamic

website/content/docs/upgrade/upgrade-specific.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ used to document those details separately from the standard upgrade flow.
1919
Nomad now calculates the storage available for scheduling using only
2020
`totalBytes - client.reserved.disk`. The previous strategy using free disk
2121
space could lead to incorrect values when clients with running allocations
22-
restarted. We recommend that you reserve at least the amount of disk that
23-
is used by the host OS.
22+
restarted. The `unique.storage.bytesfree` attribute has also been removed.
23+
We recommend that you reserve at least the amount of disk that is used
24+
by the host OS.
2425

2526
#### Sysbatch jobs will no longer accept `reschedule` blocks
2627

0 commit comments

Comments
 (0)