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
846f87b8
Commit
846f87b8
authored
3 years ago
by
Seth Hoenig
Browse files
Options
Download
Email Patches
Plain Diff
wip some cleanup
parent
047c4c20
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
client/alloc_endpoint_test.go
+1
-0
client/alloc_endpoint_test.go
client/lib/cgutil/cgutil_linux.go
+0
-4
client/lib/cgutil/cgutil_linux.go
client/lib/cgutil/cpuset_manager_v1.go
+0
-1
client/lib/cgutil/cpuset_manager_v1.go
client/lib/cgutil/cpuset_manager_v2.go
+3
-7
client/lib/cgutil/cpuset_manager_v2.go
drivers/shared/executor/executor_test.go
+0
-4
drivers/shared/executor/executor_test.go
with
4 additions
and
16 deletions
+4
-16
client/alloc_endpoint_test.go
+
1
-
0
View file @
846f87b8
...
...
@@ -992,6 +992,7 @@ func TestAlloc_ExecStreaming_ACL_WithIsolation_Image(t *testing.T) {
// TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot asserts that token only needs
// alloc-exec acl policy when chroot isolation is used
func
TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot
(
t
*
testing
.
T
)
{
ci
.
SkipSlow
(
t
,
"flaky on GHA; too much disk IO"
)
ci
.
Parallel
(
t
)
if
runtime
.
GOOS
!=
"linux"
||
unix
.
Geteuid
()
!=
0
{
...
...
This diff is collapsed.
Click to expand it.
client/lib/cgutil/cgutil_linux.go
+
0
-
4
View file @
846f87b8
...
...
@@ -61,16 +61,12 @@ func CgroupScope(allocID, task string) string {
// Not useful in cgroups.v2
func
ConfigureBasicCgroups
(
config
*
lcc
.
Config
)
error
{
if
UseV2
{
fmt
.
Println
(
"ConfigureBasicCgroups UseV2, exit"
)
// In v2 the default behavior is to create inherited interface files for
// all mounted subsystems automatically.
return
nil
}
fmt
.
Println
(
"ConfigureBasicCgroups v1 continue"
)
id
:=
uuid
.
Generate
()
// In V1 we must setup the freezer cgroup ourselves
subsystem
:=
"freezer"
path
,
err
:=
GetCgroupPathHelperV1
(
subsystem
,
filepath
.
Join
(
DefaultCgroupV1Parent
,
id
))
...
...
This diff is collapsed.
Click to expand it.
client/lib/cgutil/cpuset_manager_v1.go
+
0
-
1
View file @
846f87b8
...
...
@@ -134,7 +134,6 @@ type allocTaskCgroupInfo map[string]*TaskCgroupInfo
// If the cgroup parent is set to /nomad then this will ensure that the /nomad/shared
// cgroup is initialized.
func
(
c
*
cpusetManagerV1
)
Init
(
_
[]
uint16
)
error
{
fmt
.
Println
(
"Init"
)
cgroupParentPath
,
err
:=
GetCgroupPathHelperV1
(
"cpuset"
,
c
.
cgroupParent
)
if
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
client/lib/cgutil/cpuset_manager_v2.go
+
3
-
7
View file @
846f87b8
...
...
@@ -70,7 +70,7 @@ func NewCpusetManagerV2(parent string, logger hclog.Logger) CpusetManager {
}
func
(
c
*
cpusetManagerV2
)
Init
(
cores
[]
uint16
)
error
{
c
.
logger
.
Info
(
"initializing with"
,
"cores"
,
cores
)
c
.
logger
.
Debug
(
"initializing with"
,
"cores"
,
cores
)
if
err
:=
c
.
ensureParent
();
err
!=
nil
{
c
.
logger
.
Error
(
"failed to init cpuset manager"
,
"err"
,
err
)
return
err
...
...
@@ -83,7 +83,6 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) {
if
alloc
==
nil
||
alloc
.
AllocatedResources
==
nil
{
return
}
c
.
logger
.
Trace
(
"add allocation"
,
"name"
,
alloc
.
Name
,
"id"
,
alloc
.
ID
)
// grab write lock while we recompute and apply changes
...
...
@@ -110,7 +109,7 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) {
}
func
(
c
*
cpusetManagerV2
)
RemoveAlloc
(
allocID
string
)
{
c
.
logger
.
Info
(
"remove allocation"
,
"id"
,
allocID
)
c
.
logger
.
Trace
(
"remove allocation"
,
"id"
,
allocID
)
// grab write lock while we recompute and apply changes.
c
.
lock
.
Lock
()
...
...
@@ -152,11 +151,8 @@ func (c *cpusetManagerV2) recalculate() {
}
func
(
c
*
cpusetManagerV2
)
CgroupPathFor
(
allocID
,
task
string
)
CgroupPathGetter
{
c
.
logger
.
Info
(
"cgroup path for"
,
"id"
,
allocID
,
"task"
,
task
)
// The CgroupPathFor implementation must block until cgroup for allocID.task
// exists [and can accept a PID].
return
func
(
ctx
context
.
Context
)
(
string
,
error
)
{
ticks
,
cancel
:=
helper
.
NewSafeTimer
(
100
*
time
.
Millisecond
)
defer
cancel
()
...
...
@@ -294,7 +290,7 @@ func (c *cpusetManagerV2) ensureParent() error {
return
err
}
c
.
logger
.
Debug
(
"establish
ed initial
cgroup hierarchy"
,
"parent"
,
c
.
parent
)
c
.
logger
.
Trace
(
"establish cgroup hierarchy"
,
"parent"
,
c
.
parent
)
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
drivers/shared/executor/executor_test.go
+
0
-
4
View file @
846f87b8
...
...
@@ -531,8 +531,6 @@ func TestExecutor_Start_Kill_Immediately_NoGrace(t *testing.T) {
executor
:=
factory
.
new
(
testlog
.
HCLogger
(
t
))
defer
executor
.
Shutdown
(
""
,
0
)
fmt
.
Println
(
"execCmd.ResourceLimits:"
,
execCmd
.
ResourceLimits
)
ps
,
err
:=
executor
.
Launch
(
execCmd
)
require
.
NoError
(
err
)
require
.
NotZero
(
ps
.
Pid
)
...
...
@@ -569,8 +567,6 @@ func TestExecutor_Start_Kill_Immediately_WithGrace(t *testing.T) {
executor
:=
factory
.
new
(
testlog
.
HCLogger
(
t
))
defer
executor
.
Shutdown
(
""
,
0
)
fmt
.
Println
(
"execCmd.ResourceLimits:"
,
execCmd
.
ResourceLimits
)
ps
,
err
:=
executor
.
Launch
(
execCmd
)
require
.
NoError
(
err
)
require
.
NotZero
(
ps
.
Pid
)
...
...
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