Commit 846f87b8 authored by Seth Hoenig's avatar Seth Hoenig
Browse files

wip some cleanup

parent 047c4c20
Showing with 4 additions and 16 deletions
+4 -16
...@@ -992,6 +992,7 @@ func TestAlloc_ExecStreaming_ACL_WithIsolation_Image(t *testing.T) { ...@@ -992,6 +992,7 @@ func TestAlloc_ExecStreaming_ACL_WithIsolation_Image(t *testing.T) {
// TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot asserts that token only needs // TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot asserts that token only needs
// alloc-exec acl policy when chroot isolation is used // alloc-exec acl policy when chroot isolation is used
func TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot(t *testing.T) { func TestAlloc_ExecStreaming_ACL_WithIsolation_Chroot(t *testing.T) {
ci.SkipSlow(t, "flaky on GHA; too much disk IO")
ci.Parallel(t) ci.Parallel(t)
if runtime.GOOS != "linux" || unix.Geteuid() != 0 { if runtime.GOOS != "linux" || unix.Geteuid() != 0 {
......
...@@ -61,16 +61,12 @@ func CgroupScope(allocID, task string) string { ...@@ -61,16 +61,12 @@ func CgroupScope(allocID, task string) string {
// Not useful in cgroups.v2 // Not useful in cgroups.v2
func ConfigureBasicCgroups(config *lcc.Config) error { func ConfigureBasicCgroups(config *lcc.Config) error {
if UseV2 { if UseV2 {
fmt.Println("ConfigureBasicCgroups UseV2, exit")
// In v2 the default behavior is to create inherited interface files for // In v2 the default behavior is to create inherited interface files for
// all mounted subsystems automatically. // all mounted subsystems automatically.
return nil return nil
} }
fmt.Println("ConfigureBasicCgroups v1 continue")
id := uuid.Generate() id := uuid.Generate()
// In V1 we must setup the freezer cgroup ourselves // In V1 we must setup the freezer cgroup ourselves
subsystem := "freezer" subsystem := "freezer"
path, err := GetCgroupPathHelperV1(subsystem, filepath.Join(DefaultCgroupV1Parent, id)) path, err := GetCgroupPathHelperV1(subsystem, filepath.Join(DefaultCgroupV1Parent, id))
......
...@@ -134,7 +134,6 @@ type allocTaskCgroupInfo map[string]*TaskCgroupInfo ...@@ -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 // If the cgroup parent is set to /nomad then this will ensure that the /nomad/shared
// cgroup is initialized. // cgroup is initialized.
func (c *cpusetManagerV1) Init(_ []uint16) error { func (c *cpusetManagerV1) Init(_ []uint16) error {
fmt.Println("Init")
cgroupParentPath, err := GetCgroupPathHelperV1("cpuset", c.cgroupParent) cgroupParentPath, err := GetCgroupPathHelperV1("cpuset", c.cgroupParent)
if err != nil { if err != nil {
return err return err
......
...@@ -70,7 +70,7 @@ func NewCpusetManagerV2(parent string, logger hclog.Logger) CpusetManager { ...@@ -70,7 +70,7 @@ func NewCpusetManagerV2(parent string, logger hclog.Logger) CpusetManager {
} }
func (c *cpusetManagerV2) Init(cores []uint16) error { 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 { if err := c.ensureParent(); err != nil {
c.logger.Error("failed to init cpuset manager", "err", err) c.logger.Error("failed to init cpuset manager", "err", err)
return err return err
...@@ -83,7 +83,6 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) { ...@@ -83,7 +83,6 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) {
if alloc == nil || alloc.AllocatedResources == nil { if alloc == nil || alloc.AllocatedResources == nil {
return return
} }
c.logger.Trace("add allocation", "name", alloc.Name, "id", alloc.ID) c.logger.Trace("add allocation", "name", alloc.Name, "id", alloc.ID)
// grab write lock while we recompute and apply changes // grab write lock while we recompute and apply changes
...@@ -110,7 +109,7 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) { ...@@ -110,7 +109,7 @@ func (c *cpusetManagerV2) AddAlloc(alloc *structs.Allocation) {
} }
func (c *cpusetManagerV2) RemoveAlloc(allocID string) { 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. // grab write lock while we recompute and apply changes.
c.lock.Lock() c.lock.Lock()
...@@ -152,11 +151,8 @@ func (c *cpusetManagerV2) recalculate() { ...@@ -152,11 +151,8 @@ func (c *cpusetManagerV2) recalculate() {
} }
func (c *cpusetManagerV2) CgroupPathFor(allocID, task string) CgroupPathGetter { 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 // The CgroupPathFor implementation must block until cgroup for allocID.task
// exists [and can accept a PID]. // exists [and can accept a PID].
return func(ctx context.Context) (string, error) { return func(ctx context.Context) (string, error) {
ticks, cancel := helper.NewSafeTimer(100 * time.Millisecond) ticks, cancel := helper.NewSafeTimer(100 * time.Millisecond)
defer cancel() defer cancel()
...@@ -294,7 +290,7 @@ func (c *cpusetManagerV2) ensureParent() error { ...@@ -294,7 +290,7 @@ func (c *cpusetManagerV2) ensureParent() error {
return err return err
} }
c.logger.Debug("established initial cgroup hierarchy", "parent", c.parent) c.logger.Trace("establish cgroup hierarchy", "parent", c.parent)
return nil return nil
} }
......
...@@ -531,8 +531,6 @@ func TestExecutor_Start_Kill_Immediately_NoGrace(t *testing.T) { ...@@ -531,8 +531,6 @@ func TestExecutor_Start_Kill_Immediately_NoGrace(t *testing.T) {
executor := factory.new(testlog.HCLogger(t)) executor := factory.new(testlog.HCLogger(t))
defer executor.Shutdown("", 0) defer executor.Shutdown("", 0)
fmt.Println("execCmd.ResourceLimits:", execCmd.ResourceLimits)
ps, err := executor.Launch(execCmd) ps, err := executor.Launch(execCmd)
require.NoError(err) require.NoError(err)
require.NotZero(ps.Pid) require.NotZero(ps.Pid)
...@@ -569,8 +567,6 @@ func TestExecutor_Start_Kill_Immediately_WithGrace(t *testing.T) { ...@@ -569,8 +567,6 @@ func TestExecutor_Start_Kill_Immediately_WithGrace(t *testing.T) {
executor := factory.new(testlog.HCLogger(t)) executor := factory.new(testlog.HCLogger(t))
defer executor.Shutdown("", 0) defer executor.Shutdown("", 0)
fmt.Println("execCmd.ResourceLimits:", execCmd.ResourceLimits)
ps, err := executor.Launch(execCmd) ps, err := executor.Launch(execCmd)
require.NoError(err) require.NoError(err)
require.NotZero(ps.Pid) require.NotZero(ps.Pid)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment