本文整理汇总了Golang中github.com/coreos/rkt/common/cgroup.IsControllerMounted函数的典型用法代码示例。如果您正苦于以下问题:Golang IsControllerMounted函数的具体用法?Golang IsControllerMounted怎么用?Golang IsControllerMounted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsControllerMounted函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: areHostCgroupsMounted
func areHostCgroupsMounted(enabledCgroups map[int][]string) bool {
controllers := cgroup.GetControllerDirs(enabledCgroups)
for _, c := range controllers {
if !cgroup.IsControllerMounted(c) {
return false
}
}
return true
}
开发者ID:carriercomm,项目名称:rkt,代码行数:10,代码来源:init.go
示例2: mountHostCgroups
// mountHostCgroups mounts the host cgroup hierarchy as required by
// systemd-nspawn. We need this because some distributions don't have the
// "name=systemd" cgroup or don't mount the cgroup controllers in
// "/sys/fs/cgroup", and systemd-nspawn needs this. Since this is mounted
// inside the rkt mount namespace, it doesn't affect the host.
func mountHostCgroups(enabledCgroups map[int][]string) error {
systemdControllerPath := "/sys/fs/cgroup/systemd"
if !areHostCgroupsMounted(enabledCgroups) {
if err := cgroup.CreateCgroups("/", enabledCgroups); err != nil {
return fmt.Errorf("error creating host cgroups: %v\n", err)
}
}
if !cgroup.IsControllerMounted("systemd") {
if err := os.MkdirAll(systemdControllerPath, 0700); err != nil {
return err
}
if err := syscall.Mount("cgroup", systemdControllerPath, "cgroup", 0, "none,name=systemd"); err != nil {
return fmt.Errorf("error mounting name=systemd hierarchy on %q: %v", systemdControllerPath, err)
}
}
return nil
}
开发者ID:jshxu,项目名称:rkt,代码行数:24,代码来源:init.go
示例3: mountHostCgroups
// mountHostCgroups mounts the host cgroup hierarchy as required by
// systemd-nspawn. We need this because some distributions don't have the
// "name=systemd" cgroup or don't mount the cgroup controllers in
// "/sys/fs/cgroup", and systemd-nspawn needs this. Since this is mounted
// inside the rkt mount namespace, it doesn't affect the host.
func mountHostCgroups(enabledCgroups map[int][]string) error {
systemdControllerPath := "/sys/fs/cgroup/systemd"
if !areHostCgroupsMounted(enabledCgroups) {
mountContext := os.Getenv(common.EnvSELinuxMountContext)
if err := cgroup.CreateCgroups("/", enabledCgroups, mountContext); err != nil {
return errwrap.Wrap(errors.New("error creating host cgroups"), err)
}
}
if !cgroup.IsControllerMounted("systemd") {
if err := os.MkdirAll(systemdControllerPath, 0700); err != nil {
return err
}
if err := syscall.Mount("cgroup", systemdControllerPath, "cgroup", 0, "none,name=systemd"); err != nil {
return errwrap.Wrap(fmt.Errorf("error mounting name=systemd hierarchy on %q", systemdControllerPath), err)
}
}
return nil
}
开发者ID:carriercomm,项目名称:rkt,代码行数:25,代码来源:init.go
注:本文中的github.com/coreos/rkt/common/cgroup.IsControllerMounted函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论