Skip to content

Commit

Permalink
feature: add cgroupfs in Info API
Browse files Browse the repository at this point in the history
Signed-off-by: Allen Sun <allensun.shl@alibaba-inc.com>
  • Loading branch information
allencloud committed Aug 23, 2018
1 parent b7b42b1 commit 2859bff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions daemon/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ type Config struct {
DefaultNamespace string `json:"default-namespace,omitempty"`
}

// GetCgroupDriver gets cgroup driver used in runc.
func (cfg *Config) GetCgroupDriver() string {
// current pouchd only supports directly managing cgroupfs.
// TODO: add 'systemd' to make systemd manage cgroupfs rather than directly using it.
// In the future we will support this config in the daemon configuration.
return "cgroupfs"
}

// Validate validates the user input config.
func (cfg *Config) Validate() error {
// deduplicated elements in slice if there is any.
Expand Down
1 change: 1 addition & 0 deletions daemon/mgr/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (mgr *SystemManager) Info() (types.SystemInfo, error) {
HTTPProxy: mgr.config.ImageProxy,
// HTTPSProxy: ,
// ID: ,
CgroupDriver: mgr.config.GetCgroupDriver(),
Images: int64(len(images)),
IndexServerAddress: "https://index.docker.io/v1/",
DefaultRegistry: mgr.config.DefaultRegistry,
Expand Down
1 change: 1 addition & 0 deletions test/api_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (suite *APISystemSuite) TestInfo(c *check.C) {
c.Assert(got.Driver, check.Equals, "overlayfs")
c.Assert(got.NCPU, check.Equals, int64(runtime.NumCPU()))
c.Assert(got.CriEnabled, check.Equals, false)
c.Assert(got.CgroupDriver, check.Equals, "cgroupfs")

// Check the volume drivers
c.Assert(len(got.VolumeDrivers), check.Equals, 3)
Expand Down

0 comments on commit 2859bff

Please sign in to comment.