Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
f555dc3f
Commit
f555dc3f
authored
6 years ago
by
Alex Dadgar
Browse files
Options
Download
Email Patches
Plain Diff
Warn if IOPS is being used
parent
0953d913
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
command/agent/job_endpoint.go
+1
-0
command/agent/job_endpoint.go
nomad/structs/structs.go
+19
-0
nomad/structs/structs.go
with
20 additions
and
0 deletions
+20
-0
command/agent/job_endpoint.go
+
1
-
0
View file @
f555dc3f
...
@@ -853,6 +853,7 @@ func ApiResourcesToStructs(in *api.Resources) *structs.Resources {
...
@@ -853,6 +853,7 @@ func ApiResourcesToStructs(in *api.Resources) *structs.Resources {
out
:=
&
structs
.
Resources
{
out
:=
&
structs
.
Resources
{
CPU
:
*
in
.
CPU
,
CPU
:
*
in
.
CPU
,
MemoryMB
:
*
in
.
MemoryMB
,
MemoryMB
:
*
in
.
MemoryMB
,
IOPS
:
*
in
.
IOPS
,
// COMPAT(0.10): Only being used to issue warnings
}
}
if
l
:=
len
(
in
.
Networks
);
l
!=
0
{
if
l
:=
len
(
in
.
Networks
);
l
!=
0
{
...
...
This diff is collapsed.
Click to expand it.
nomad/structs/structs.go
+
19
-
0
View file @
f555dc3f
...
@@ -1698,6 +1698,7 @@ type Resources struct {
...
@@ -1698,6 +1698,7 @@ type Resources struct {
CPU
int
CPU
int
MemoryMB
int
MemoryMB
int
DiskMB
int
DiskMB
int
IOPS
int
// COMPAT(0.10): Only being used to issue warnings
Networks
Networks
Networks
Networks
Devices
[]
*
RequestedDevice
Devices
[]
*
RequestedDevice
}
}
...
@@ -4663,6 +4664,13 @@ func (tg *TaskGroup) Warnings(j *Job) error {
...
@@ -4663,6 +4664,13 @@ func (tg *TaskGroup) Warnings(j *Job) error {
}
}
}
}
for
_
,
t
:=
range
tg
.
Tasks
{
if
err
:=
t
.
Warnings
();
err
!=
nil
{
err
=
multierror
.
Prefix
(
err
,
fmt
.
Sprintf
(
"Task %q:"
,
t
.
Name
))
mErr
.
Errors
=
append
(
mErr
.
Errors
,
err
)
}
}
return
mErr
.
ErrorOrNil
()
return
mErr
.
ErrorOrNil
()
}
}
...
@@ -5506,6 +5514,17 @@ func validateServices(t *Task) error {
...
@@ -5506,6 +5514,17 @@ func validateServices(t *Task) error {
return
mErr
.
ErrorOrNil
()
return
mErr
.
ErrorOrNil
()
}
}
func
(
t
*
Task
)
Warnings
()
error
{
var
mErr
multierror
.
Error
// Validate the resources
if
t
.
Resources
!=
nil
&&
t
.
Resources
.
IOPS
!=
0
{
mErr
.
Errors
=
append
(
mErr
.
Errors
,
fmt
.
Errorf
(
"IOPS has been deprecated as of Nomad 0.9.0. Please remove IOPS from resource stanza."
))
}
return
mErr
.
ErrorOrNil
()
}
const
(
const
(
// TemplateChangeModeNoop marks that no action should be taken if the
// TemplateChangeModeNoop marks that no action should be taken if the
// template is re-rendered
// template is re-rendered
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help