Deprecate IOPS

IOPS have been modelled as a resource since Nomad 0.1 but has never
actually been detected and there is no plan in the short term to add
detection. This is because IOPS is a bit simplistic of a unit to define
the performance requirements from the underlying storage system. In its
current state it adds unnecessary confusion and can be removed without
impacting any users. This PR leaves IOPS defined at the jobspec parsing
level and in the api/ resources since these are the two public uses of
the field. These should be considered deprecated and only exist to allow
users to stop using them during the Nomad 0.9.x release. In the future,
there should be no expectation that the field will exist.
This commit is contained in:
Alex Dadgar
2018-12-06 15:09:26 -08:00
parent 12dc187779
commit 0953d913ed
55 changed files with 53 additions and 253 deletions

View File

@@ -9,11 +9,10 @@ import (
"time"
humanize "github.com/dustin/go-humanize"
"github.com/posener/complete"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/api/contexts"
"github.com/hashicorp/nomad/helper"
"github.com/posener/complete"
)
const (
@@ -611,25 +610,22 @@ func getAllocatedResources(client *api.Client, runningAllocs []*api.Allocation,
total := computeNodeTotalResources(node)
// Get Resources
var cpu, mem, disk, iops int
var cpu, mem, disk int
for _, alloc := range runningAllocs {
cpu += *alloc.Resources.CPU
mem += *alloc.Resources.MemoryMB
disk += *alloc.Resources.DiskMB
iops += *alloc.Resources.IOPS
}
resources := make([]string, 2)
resources[0] = "CPU|Memory|Disk|IOPS"
resources[1] = fmt.Sprintf("%d/%d MHz|%s/%s|%s/%s|%d/%d",
resources[0] = "CPU|Memory|Disk"
resources[1] = fmt.Sprintf("%d/%d MHz|%s/%s|%s/%s",
cpu,
*total.CPU,
humanize.IBytes(uint64(mem*bytesPerMegabyte)),
humanize.IBytes(uint64(*total.MemoryMB*bytesPerMegabyte)),
humanize.IBytes(uint64(disk*bytesPerMegabyte)),
humanize.IBytes(uint64(*total.DiskMB*bytesPerMegabyte)),
iops,
*total.IOPS)
humanize.IBytes(uint64(*total.DiskMB*bytesPerMegabyte)))
return resources
}
@@ -647,7 +643,6 @@ func computeNodeTotalResources(node *api.Node) api.Resources {
total.CPU = helper.IntToPtr(*r.CPU - *res.CPU)
total.MemoryMB = helper.IntToPtr(*r.MemoryMB - *res.MemoryMB)
total.DiskMB = helper.IntToPtr(*r.DiskMB - *res.DiskMB)
total.IOPS = helper.IntToPtr(*r.IOPS - *res.IOPS)
return total
}