Skip to content

Conversation

jellonek
Copy link
Contributor

@jellonek jellonek commented Oct 12, 2018

  • pass cpusets to vmwrapper
  • use by vmwrapper passed value to set particular cpuset in cgroups

This change is Reviewable

@jellonek jellonek force-pushed the jell/cpusets branch 3 times, most recently from 316e435 to c5fcaff Compare October 12, 2018 16:42
@jellonek jellonek changed the title [WIP] Cpusets support Cpusets support Oct 22, 2018
Copy link
Contributor

@ivan4th ivan4th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 2 approvals obtained (waiting on @jellonek)


pkg/utils/strings.go, line 41 at r1 (raw file):

// Stringify returns string representation for provided value.
func Stringify(value interface{}) (string, error) {

Perhaps can just use fmt.Sprintf("%v", value) instead?


pkg/utils/cgroups/controllers.go, line 36 at r1 (raw file):

// GetProcessControllers returns mapping between controller types and theirs
// paths inside cgroups fs mount for particular process identificator

Returns the mapping between controller types and their paths inside cgroup fs for the specified PID


pkg/utils/cgroups/controllers.go, line 76 at r1 (raw file):

}

// Controller represents named controller for particular process

Controller represents a named controller for a process


pkg/utils/cgroups/controllers.go, line 82 at r1 (raw file):

}

// GetProcessController returns named resource Controller for given process identificator

returns a named resource controller for the specified PID


pkg/utils/cgroups/controllers.go, line 105 at r1 (raw file):

}

// Set sets value for particular setting using this controller

Set sets the value of a controller setting

Copy link
Contributor Author

@jellonek jellonek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 2 approvals obtained (waiting on @jellonek and @ivan4th)


pkg/utils/strings.go, line 41 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

Perhaps can just use fmt.Sprintf("%v", value) instead?

That would succeed always. With my version you have additional validation if correct type was passed.
Maybe in fact simpler version would be better as this check is done on runtime, not on compile time. WDYT?


pkg/utils/cgroups/controllers.go, line 36 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

Returns the mapping between controller types and their paths inside cgroup fs for the specified PID

Done.


pkg/utils/cgroups/controllers.go, line 76 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

Controller represents a named controller for a process

Done.


pkg/utils/cgroups/controllers.go, line 82 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

returns a named resource controller for the specified PID

Done.


pkg/utils/cgroups/controllers.go, line 105 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

Set sets the value of a controller setting

Done.

Copy link
Contributor

@ivan4th ivan4th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 2 approvals obtained (waiting on @jellonek)


pkg/utils/strings.go, line 41 at r1 (raw file):

Previously, jellonek (Piotr Skamruk) wrote…

That would succeed always. With my version you have additional validation if correct type was passed.
Maybe in fact simpler version would be better as this check is done on runtime, not on compile time. WDYT?

In this case neither the func name (which is quite important) nor its description tells about what value type is expected. I'd go with plain fmt.Sprintf(). If this func needs to be kept (it still needs another name, like StringifySomeKindOfValue), it still can be done via fmt.Sprintf() with some kind of type check in place.

BTW, the current impl checks the type during runtime. You can only do compile-time checking by making several funcs for different types (as there's no func overloading in Go)

Copy link
Contributor Author

@jellonek jellonek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 change requests, 0 of 2 approvals obtained (waiting on @ivan4th)


pkg/utils/strings.go, line 41 at r1 (raw file):

Previously, ivan4th (Ivan Shvedunov) wrote…

In this case neither the func name (which is quite important) nor its description tells about what value type is expected. I'd go with plain fmt.Sprintf(). If this func needs to be kept (it still needs another name, like StringifySomeKindOfValue), it still can be done via fmt.Sprintf() with some kind of type check in place.

BTW, the current impl checks the type during runtime. You can only do compile-time checking by making several funcs for different types (as there's no func overloading in Go)

I understand that it's done on runtime (it's in second part of my comment).
Ok, changed that to simple fmt.Sprintf without type checking as lack of stringer interface implementation on particular interface simply should not occur.

Copy link
Contributor

@ivan4th ivan4th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 6 files at r1, 2 of 2 files at r2.
Reviewable status: 1 change requests, 0 of 2 approvals obtained (waiting on @ivan4th)

Copy link
Contributor

@ivan4th ivan4th left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 approvals obtained

@jellonek jellonek merged commit 2f92ca3 into master Nov 7, 2018
@jellonek jellonek deleted the jell/cpusets branch November 7, 2018 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants