MCPcopy
hub / github.com/opencontainers/runc / criuOptions

Function criuOptions

checkpoint.go:115–179  ·  view source on GitHub ↗
(context *cli.Context)

Source from the content-addressed store, hash-verified

113}
114
115func criuOptions(context *cli.Context) (*libcontainer.CriuOpts, error) {
116 imagePath, parentPath, err := prepareImagePaths(context)
117 if err != nil {
118 return nil, err
119 }
120
121 opts := &libcontainer.CriuOpts{
122 ImagesDirectory: imagePath,
123 WorkDirectory: context.String("work-path"),
124 ParentImage: parentPath,
125 LeaveRunning: context.Bool("leave-running"),
126 TcpEstablished: context.Bool("tcp-established"),
127 TcpSkipInFlight: context.Bool("tcp-skip-in-flight"),
128 LinkRemap: context.Bool("link-remap"),
129 ExternalUnixConnections: context.Bool("ext-unix-sk"),
130 ShellJob: context.Bool("shell-job"),
131 FileLocks: context.Bool("file-locks"),
132 PreDump: context.Bool("pre-dump"),
133 AutoDedup: context.Bool("auto-dedup"),
134 LazyPages: context.Bool("lazy-pages"),
135 StatusFd: context.Int("status-fd"),
136 LsmProfile: context.String("lsm-profile"),
137 LsmMountContext: context.String("lsm-mount-context"),
138 ManageCgroupsMode: context.String("manage-cgroups-mode"),
139 }
140
141 // CRIU options below may or may not be set.
142
143 if psOpt := context.String("page-server"); psOpt != "" {
144 address, port, err := net.SplitHostPort(psOpt)
145
146 if err != nil || address == "" || port == "" {
147 return nil, errors.New("Use --page-server ADDRESS:PORT to specify page server")
148 }
149 portInt, err := strconv.Atoi(port)
150 if err != nil {
151 return nil, errors.New("Invalid port number")
152 }
153 opts.PageServer = libcontainer.CriuPageServerInfo{
154 Address: address,
155 Port: int32(portInt),
156 }
157 }
158
159 // runc doesn't manage network devices and their configuration.
160 nsmask := unix.CLONE_NEWNET
161
162 if context.IsSet("empty-ns") {
163 namespaceMapping := map[specs.LinuxNamespaceType]int{
164 specs.NetworkNamespace: unix.CLONE_NEWNET,
165 }
166
167 for _, ns := range context.StringSlice("empty-ns") {
168 f, exists := namespaceMapping[specs.LinuxNamespaceType(ns)]
169 if !exists {
170 return nil, fmt.Errorf("namespace %q is not supported", ns)
171 }
172 nsmask |= f

Callers 2

restore.goFile · 0.85
checkpoint.goFile · 0.85

Calls 2

prepareImagePathsFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…