linux: Add RuntimeRoot to RuncOptions
This allow specifying wher the OCI runtime should store its state data. Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
ab0cb4e756
commit
1b79170849
@ -66,6 +66,11 @@ func main() {
|
||||
Name: "workdir,w",
|
||||
Usage: "path used to store large temporary data",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "runtime-root",
|
||||
Usage: "root directory for the runtime",
|
||||
Value: shim.RuncRoot,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "criu,c",
|
||||
Usage: "path to criu",
|
||||
@ -104,6 +109,7 @@ func main() {
|
||||
WorkDir: context.GlobalString("workdir"),
|
||||
Criu: context.GlobalString("criu"),
|
||||
SystemdCgroup: context.GlobalBool("systemd-cgroup"),
|
||||
RuntimeRoot: context.GlobalString("runtime-root"),
|
||||
},
|
||||
&remoteEventsPublisher{client: e},
|
||||
)
|
||||
|
@ -118,18 +118,20 @@ func (b *bundle) shimAddress(namespace string) string {
|
||||
func (b *bundle) shimConfig(namespace string, runcOptions *runcopts.RuncOptions) client.Config {
|
||||
var (
|
||||
criuPath string
|
||||
runtimeRoot string
|
||||
systemdCgroup bool
|
||||
)
|
||||
if runcOptions != nil {
|
||||
criuPath = runcOptions.CriuPath
|
||||
systemdCgroup = runcOptions.SystemdCgroup
|
||||
runtimeRoot = runcOptions.RuntimeRoot
|
||||
}
|
||||
return client.Config{
|
||||
Path: b.path,
|
||||
WorkDir: b.workDir,
|
||||
Namespace: namespace,
|
||||
Criu: criuPath,
|
||||
RuntimeRoot: runcOptions.RuntimeRoot,
|
||||
RuntimeRoot: runtimeRoot,
|
||||
SystemdCgroup: systemdCgroup,
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,9 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type RuncOptions struct {
|
||||
Runtime string `protobuf:"bytes,1,opt,name=runtime,proto3" json:"runtime,omitempty"`
|
||||
CriuPath string `protobuf:"bytes,2,opt,name=criu_path,json=criuPath,proto3" json:"criu_path,omitempty"`
|
||||
SystemdCgroup bool `protobuf:"varint,3,opt,name=systemd_cgroup,json=systemdCgroup,proto3" json:"systemd_cgroup,omitempty"`
|
||||
RuntimeRoot string `protobuf:"bytes,2,opt,name=runtime_root,json=runtimeRoot,proto3" json:"runtime_root,omitempty"`
|
||||
CriuPath string `protobuf:"bytes,3,opt,name=criu_path,json=criuPath,proto3" json:"criu_path,omitempty"`
|
||||
SystemdCgroup bool `protobuf:"varint,4,opt,name=systemd_cgroup,json=systemdCgroup,proto3" json:"systemd_cgroup,omitempty"`
|
||||
}
|
||||
|
||||
func (m *RuncOptions) Reset() { *m = RuncOptions{} }
|
||||
@ -102,14 +103,20 @@ func (m *RuncOptions) MarshalTo(dAtA []byte) (int, error) {
|
||||
i = encodeVarintRunc(dAtA, i, uint64(len(m.Runtime)))
|
||||
i += copy(dAtA[i:], m.Runtime)
|
||||
}
|
||||
if len(m.CriuPath) > 0 {
|
||||
if len(m.RuntimeRoot) > 0 {
|
||||
dAtA[i] = 0x12
|
||||
i++
|
||||
i = encodeVarintRunc(dAtA, i, uint64(len(m.RuntimeRoot)))
|
||||
i += copy(dAtA[i:], m.RuntimeRoot)
|
||||
}
|
||||
if len(m.CriuPath) > 0 {
|
||||
dAtA[i] = 0x1a
|
||||
i++
|
||||
i = encodeVarintRunc(dAtA, i, uint64(len(m.CriuPath)))
|
||||
i += copy(dAtA[i:], m.CriuPath)
|
||||
}
|
||||
if m.SystemdCgroup {
|
||||
dAtA[i] = 0x18
|
||||
dAtA[i] = 0x20
|
||||
i++
|
||||
if m.SystemdCgroup {
|
||||
dAtA[i] = 1
|
||||
@ -349,6 +356,10 @@ func (m *RuncOptions) Size() (n int) {
|
||||
if l > 0 {
|
||||
n += 1 + l + sovRunc(uint64(l))
|
||||
}
|
||||
l = len(m.RuntimeRoot)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovRunc(uint64(l))
|
||||
}
|
||||
l = len(m.CriuPath)
|
||||
if l > 0 {
|
||||
n += 1 + l + sovRunc(uint64(l))
|
||||
@ -447,6 +458,7 @@ func (this *RuncOptions) String() string {
|
||||
}
|
||||
s := strings.Join([]string{`&RuncOptions{`,
|
||||
`Runtime:` + fmt.Sprintf("%v", this.Runtime) + `,`,
|
||||
`RuntimeRoot:` + fmt.Sprintf("%v", this.RuntimeRoot) + `,`,
|
||||
`CriuPath:` + fmt.Sprintf("%v", this.CriuPath) + `,`,
|
||||
`SystemdCgroup:` + fmt.Sprintf("%v", this.SystemdCgroup) + `,`,
|
||||
`}`,
|
||||
@ -554,6 +566,35 @@ func (m *RuncOptions) Unmarshal(dAtA []byte) error {
|
||||
m.Runtime = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field RuntimeRoot", wireType)
|
||||
}
|
||||
var stringLen uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowRunc
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
stringLen |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
intStringLen := int(stringLen)
|
||||
if intStringLen < 0 {
|
||||
return ErrInvalidLengthRunc
|
||||
}
|
||||
postIndex := iNdEx + intStringLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.RuntimeRoot = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CriuPath", wireType)
|
||||
}
|
||||
@ -582,7 +623,7 @@ func (m *RuncOptions) Unmarshal(dAtA []byte) error {
|
||||
}
|
||||
m.CriuPath = string(dAtA[iNdEx:postIndex])
|
||||
iNdEx = postIndex
|
||||
case 3:
|
||||
case 4:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field SystemdCgroup", wireType)
|
||||
}
|
||||
@ -1198,34 +1239,35 @@ func init() {
|
||||
}
|
||||
|
||||
var fileDescriptorRunc = []byte{
|
||||
// 453 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0x41, 0x6f, 0xd3, 0x4e,
|
||||
0x14, 0xc4, 0xeb, 0xb6, 0xff, 0xc6, 0xde, 0x34, 0xfd, 0xc3, 0x42, 0x25, 0x53, 0x84, 0x09, 0x11,
|
||||
0x48, 0xe1, 0x92, 0x48, 0x70, 0x41, 0x70, 0x23, 0x47, 0xa0, 0x54, 0x06, 0x2e, 0x5c, 0x56, 0xee,
|
||||
0xe6, 0x61, 0xaf, 0x6c, 0xbf, 0xb7, 0xda, 0x5d, 0x53, 0xe7, 0xc6, 0xc7, 0xeb, 0x11, 0x71, 0xe2,
|
||||
0x48, 0xf3, 0x45, 0x40, 0xde, 0xc4, 0x85, 0x2b, 0x57, 0x6e, 0xf3, 0x7e, 0x33, 0xda, 0x91, 0x46,
|
||||
0x5a, 0xf6, 0x3c, 0x57, 0xae, 0x68, 0xce, 0x67, 0x92, 0xea, 0xb9, 0x24, 0x74, 0x99, 0x42, 0x30,
|
||||
0xcb, 0x3f, 0x65, 0xa5, 0xb0, 0x69, 0xe7, 0xa6, 0x41, 0x49, 0xda, 0x59, 0x2f, 0x66, 0xda, 0x90,
|
||||
0x23, 0x7e, 0xfc, 0x3b, 0x35, 0xf3, 0xa9, 0x59, 0x67, 0x9e, 0xdc, 0xce, 0x29, 0x27, 0x9f, 0x98,
|
||||
0x77, 0x6a, 0x13, 0x9e, 0x94, 0x6c, 0x98, 0x36, 0x28, 0xdf, 0x6a, 0xa7, 0x08, 0x2d, 0x8f, 0xd9,
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 0x8d, 0xd2,
|
||||
0xff, 0x3d, 0x3f, 0xbd, 0xc6, 0xfc, 0x01, 0x3b, 0xdc, 0x2c, 0x61, 0x45, 0x4d, 0x4b, 0x88, 0x07,
|
||||
0x7e, 0xb1, 0xe1, 0x96, 0xbd, 0xa1, 0x25, 0xf0, 0x87, 0xec, 0x08, 0x49, 0x20, 0x5c, 0x88, 0x12,
|
||||
0x56, 0x46, 0x61, 0x1e, 0x87, 0xbe, 0xf0, 0x10, 0xe9, 0x14, 0x2e, 0x5e, 0x6d, 0x18, 0xbf, 0xcf,
|
||||
0x86, 0xb6, 0x50, 0x75, 0xbf, 0x6b, 0xe4, 0xdf, 0x61, 0x1d, 0xda, 0x8e, 0xfa, 0x33, 0x60, 0x37,
|
||||
0x17, 0x05, 0xc8, 0x52, 0x93, 0x42, 0xd7, 0x0f, 0xcb, 0xd9, 0x3e, 0xb4, 0xaa, 0xdf, 0xd3, 0xeb,
|
||||
0x7f, 0x75, 0xc8, 0x97, 0xe9, 0xe5, 0x55, 0xb2, 0xf3, 0xfd, 0x2a, 0xd9, 0xf9, 0xb2, 0x4e, 0x82,
|
||||
0xcb, 0x75, 0x12, 0x7c, 0x5d, 0x27, 0xc1, 0x8f, 0x75, 0x12, 0x7c, 0x7c, 0xf6, 0x97, 0xdf, 0xe8,
|
||||
0x45, 0x2f, 0xce, 0x0f, 0xfc, 0xf7, 0x78, 0xfa, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xbc, 0x85, 0x79,
|
||||
0xc9, 0x89, 0x03, 0x00, 0x00,
|
||||
// 467 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x93, 0x41, 0x6f, 0xd3, 0x40,
|
||||
0x10, 0x85, 0xbb, 0x6d, 0x69, 0x9d, 0x4d, 0x53, 0x60, 0xa1, 0x92, 0x29, 0xc2, 0x84, 0x08, 0xa4,
|
||||
0x70, 0x49, 0x24, 0xb8, 0x20, 0xb8, 0x91, 0x23, 0x50, 0x2a, 0x03, 0x17, 0x2e, 0x2b, 0x77, 0x33,
|
||||
0x24, 0xab, 0xd8, 0x33, 0xab, 0xdd, 0x35, 0x75, 0x6e, 0xfc, 0x02, 0x7e, 0x57, 0x8f, 0x88, 0x13,
|
||||
0x47, 0x9a, 0x3f, 0x02, 0xf2, 0xda, 0x2e, 0x5c, 0xb9, 0x72, 0x7b, 0xf3, 0xbd, 0xb1, 0xe7, 0xe9,
|
||||
0x49, 0xcb, 0x9f, 0x2f, 0xb4, 0x5f, 0x96, 0x67, 0x13, 0x45, 0xc5, 0x54, 0x11, 0xfa, 0x4c, 0x23,
|
||||
0xd8, 0xf9, 0xdf, 0x32, 0xd7, 0x58, 0x56, 0x53, 0x5b, 0xa2, 0x22, 0xe3, 0x5d, 0x10, 0x13, 0x63,
|
||||
0xc9, 0x93, 0x38, 0xfa, 0xb3, 0x35, 0x09, 0x5b, 0x93, 0xda, 0x3c, 0xbe, 0xbd, 0xa0, 0x05, 0x85,
|
||||
0x8d, 0x69, 0xad, 0x9a, 0xe5, 0xd1, 0x57, 0xc6, 0xfb, 0x69, 0x89, 0xea, 0xad, 0xf1, 0x9a, 0xd0,
|
||||
0x89, 0x98, 0xef, 0xdb, 0x12, 0xbd, 0x2e, 0x20, 0x66, 0x43, 0x36, 0xee, 0xa5, 0xdd, 0x28, 0x1e,
|
||||
0xf0, 0x83, 0x56, 0x4a, 0x4b, 0xe4, 0xe3, 0xed, 0x60, 0xf7, 0x5b, 0x96, 0x12, 0x79, 0x71, 0x97,
|
||||
0xf7, 0x94, 0xd5, 0xa5, 0x34, 0x99, 0x5f, 0xc6, 0x3b, 0xc1, 0x8f, 0x6a, 0x70, 0x9a, 0xf9, 0xa5,
|
||||
0x78, 0xc4, 0x0f, 0xdd, 0xda, 0x79, 0x28, 0xe6, 0x52, 0x2d, 0x2c, 0x95, 0x26, 0xde, 0x1d, 0xb2,
|
||||
0x71, 0x94, 0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||||
0xea, 0xa2, 0xeb, 0xb5, 0x17, 0xfe, 0xc3, 0x6b, 0xd4, 0x96, 0xfa, 0x8b, 0xf1, 0x9b, 0xb3, 0x25,
|
||||
0xa8, 0x95, 0x21, 0x8d, 0xbe, 0x2b, 0x56, 0xf0, 0x5d, 0xa8, 0x74, 0xd7, 0x67, 0xd0, 0xff, 0x6b,
|
||||
0x91, 0x2f, 0xd3, 0x8b, 0xcb, 0x64, 0xeb, 0xc7, 0x65, 0xb2, 0xf5, 0x65, 0x93, 0xb0, 0x8b, 0x4d,
|
||||
0xc2, 0xbe, 0x6d, 0x12, 0xf6, 0x73, 0x93, 0xb0, 0x8f, 0xcf, 0xfe, 0xf1, 0xa9, 0xbd, 0xe8, 0xc4,
|
||||
0xd9, 0x5e, 0x78, 0x42, 0x4f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x26, 0x29, 0x60, 0xad,
|
||||
0x03, 0x00, 0x00,
|
||||
}
|
||||
|
@ -8,8 +8,9 @@ option go_package = "github.com/containerd/containerd/linux/runcopts;runcopts";
|
||||
|
||||
message RuncOptions {
|
||||
string runtime = 1;
|
||||
string criu_path = 2;
|
||||
bool systemd_cgroup = 3;
|
||||
string runtime_root = 2;
|
||||
string criu_path = 3;
|
||||
bool systemd_cgroup = 4;
|
||||
}
|
||||
|
||||
message CreateOptions {
|
||||
|
@ -70,6 +70,8 @@ type Config struct {
|
||||
Shim string `toml:"shim,omitempty"`
|
||||
// Runtime is a path or name of an OCI runtime used by the shim
|
||||
Runtime string `toml:"runtime,omitempty"`
|
||||
// RuntimeRoot is the path that shall be used by the OCI runtime for its data
|
||||
RuntimeRoot string `toml:"runtime_root,omitempty"`
|
||||
// NoShim calls runc directly from within the pkg
|
||||
NoShim bool `toml:"no_shim,omitempty"`
|
||||
// Debug enable debug on the shim
|
||||
@ -93,17 +95,14 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
}
|
||||
cfg := ic.Config.(*Config)
|
||||
r := &Runtime{
|
||||
root: ic.Root,
|
||||
state: ic.State,
|
||||
remote: !cfg.NoShim,
|
||||
shim: cfg.Shim,
|
||||
shimDebug: cfg.ShimDebug,
|
||||
runtime: cfg.Runtime,
|
||||
monitor: monitor.(runtime.TaskMonitor),
|
||||
tasks: runtime.NewTaskList(),
|
||||
db: m.(*bolt.DB),
|
||||
address: ic.Address,
|
||||
events: ic.Events,
|
||||
root: ic.Root,
|
||||
state: ic.State,
|
||||
monitor: monitor.(runtime.TaskMonitor),
|
||||
tasks: runtime.NewTaskList(),
|
||||
db: m.(*bolt.DB),
|
||||
address: ic.Address,
|
||||
events: ic.Events,
|
||||
config: cfg,
|
||||
}
|
||||
tasks, err := r.restoreTasks(ic.Context)
|
||||
if err != nil {
|
||||
@ -119,18 +118,16 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
}
|
||||
|
||||
type Runtime struct {
|
||||
root string
|
||||
state string
|
||||
shim string
|
||||
shimDebug bool
|
||||
runtime string
|
||||
remote bool
|
||||
address string
|
||||
root string
|
||||
state string
|
||||
address string
|
||||
|
||||
monitor runtime.TaskMonitor
|
||||
tasks *runtime.TaskList
|
||||
db *bolt.DB
|
||||
events *events.Exchange
|
||||
|
||||
config *Config
|
||||
}
|
||||
|
||||
func (r *Runtime) ID() string {
|
||||
@ -169,7 +166,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
|
||||
}()
|
||||
|
||||
shimopt := ShimLocal(r.events)
|
||||
if r.remote {
|
||||
if !r.config.NoShim {
|
||||
var cgroup string
|
||||
if opts.Options != nil {
|
||||
v, err := typeurl.UnmarshalAny(opts.Options)
|
||||
@ -178,7 +175,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
|
||||
}
|
||||
cgroup = v.(*runcopts.CreateOptions).ShimCgroup
|
||||
}
|
||||
shimopt = ShimRemote(r.shim, r.address, cgroup, r.shimDebug, func() {
|
||||
shimopt = ShimRemote(r.config.Shim, r.address, cgroup, r.config.ShimDebug, func() {
|
||||
t, err := r.tasks.Get(ctx, id)
|
||||
if err != nil {
|
||||
// Task was never started or was already sucessfully deleted
|
||||
@ -222,7 +219,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts runtime.CreateOpts
|
||||
}
|
||||
}()
|
||||
|
||||
runtime := r.runtime
|
||||
runtime := r.config.Runtime
|
||||
if ropts != nil && ropts.Runtime != "" {
|
||||
runtime = ropts.Runtime
|
||||
}
|
||||
@ -411,6 +408,7 @@ func (r *Runtime) terminate(ctx context.Context, bundle *bundle, ns, id string)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := rt.Delete(ctx, id, &runc.DeleteOpts{
|
||||
Force: true,
|
||||
}); err != nil {
|
||||
@ -431,16 +429,24 @@ func (r *Runtime) getRuntime(ctx context.Context, ns, id string) (*runc.Runc, er
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd := r.runtime
|
||||
if ropts != nil && ropts.Runtime != "" {
|
||||
cmd = ropts.Runtime
|
||||
var (
|
||||
cmd = r.config.Runtime
|
||||
root = client.RuncRoot
|
||||
)
|
||||
if ropts != nil {
|
||||
if ropts.Runtime != "" {
|
||||
cmd = ropts.Runtime
|
||||
}
|
||||
if ropts.RuntimeRoot != "" {
|
||||
root = ropts.RuntimeRoot
|
||||
}
|
||||
}
|
||||
|
||||
return &runc.Runc{
|
||||
Command: cmd,
|
||||
LogFormat: runc.JSON,
|
||||
PdeathSignal: unix.SIGKILL,
|
||||
Root: filepath.Join(client.RuncRoot, ns),
|
||||
Root: filepath.Join(root, ns),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,9 @@ func newCommand(binary, daemonAddress string, debug bool, config Config, socket
|
||||
if config.Criu != "" {
|
||||
args = append(args, "--criu-path", config.Criu)
|
||||
}
|
||||
if config.RuntimeRoot != "" {
|
||||
args = append(args, "--runtime-root", config.RuntimeRoot)
|
||||
}
|
||||
if config.SystemdCgroup {
|
||||
args = append(args, "--systemd-cgroup")
|
||||
}
|
||||
@ -182,6 +185,7 @@ type Config struct {
|
||||
Namespace string
|
||||
WorkDir string
|
||||
Criu string
|
||||
RuntimeRoot string
|
||||
SystemdCgroup bool
|
||||
}
|
||||
|
||||
|
@ -94,13 +94,13 @@ func (s *Service) newInitProcess(context context.Context, r *shimapi.CreateTaskR
|
||||
}
|
||||
}
|
||||
runtime := &runc.Runc{
|
||||
Command: r.Runtime,
|
||||
Log: filepath.Join(s.config.Path, "log.json"),
|
||||
LogFormat: runc.JSON,
|
||||
PdeathSignal: syscall.SIGKILL,
|
||||
Root: filepath.Join(RuncRoot, s.config.Namespace),
|
||||
Criu: s.config.Criu,
|
||||
// SystemdCgroup: s.config.SystemdCgroup,
|
||||
Command: r.Runtime,
|
||||
Log: filepath.Join(s.config.Path, "log.json"),
|
||||
LogFormat: runc.JSON,
|
||||
PdeathSignal: syscall.SIGKILL,
|
||||
Root: filepath.Join(s.config.RuntimeRoot, s.config.Namespace),
|
||||
Criu: s.config.Criu,
|
||||
SystemdCgroup: s.config.SystemdCgroup,
|
||||
}
|
||||
p := &initProcess{
|
||||
id: r.ID,
|
||||
|
Loading…
Reference in New Issue
Block a user