1 Star 0 Fork 0

xiaods / runc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
pause.go 1.71 KB
一键复制 编辑 原始数据 按行查看 历史
Kir Kolyshkin 提交于 2021-08-27 08:40 . Rm build tags from main pkg
package main
import (
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
var pauseCommand = cli.Command{
Name: "pause",
Usage: "pause suspends all processes inside the container",
ArgsUsage: `<container-id>
Where "<container-id>" is the name for the instance of the container to be
paused. `,
Description: `The pause command suspends all processes in the instance of the container.
Use runc list to identify instances of containers and their current status.`,
Action: func(context *cli.Context) error {
if err := checkArgs(context, 1, exactArgs); err != nil {
return err
}
rootlessCg, err := shouldUseRootlessCgroupManager(context)
if err != nil {
return err
}
if rootlessCg {
logrus.Warnf("runc pause may fail if you don't have the full access to cgroups")
}
container, err := getContainer(context)
if err != nil {
return err
}
return container.Pause()
},
}
var resumeCommand = cli.Command{
Name: "resume",
Usage: "resumes all processes that have been previously paused",
ArgsUsage: `<container-id>
Where "<container-id>" is the name for the instance of the container to be
resumed.`,
Description: `The resume command resumes all processes in the instance of the container.
Use runc list to identify instances of containers and their current status.`,
Action: func(context *cli.Context) error {
if err := checkArgs(context, 1, exactArgs); err != nil {
return err
}
rootlessCg, err := shouldUseRootlessCgroupManager(context)
if err != nil {
return err
}
if rootlessCg {
logrus.Warn("runc resume may fail if you don't have the full access to cgroups")
}
container, err := getContainer(context)
if err != nil {
return err
}
return container.Resume()
},
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/xds2000/runc.git
git@gitee.com:xds2000/runc.git
xds2000
runc
runc
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891