| 326 | } |
| 327 | |
| 328 | func (c *container) handleMounts(ctx context.Context, request *tasks.CreateTaskRequest) error { |
| 329 | r, err := c.get(ctx) |
| 330 | if err != nil { |
| 331 | return err |
| 332 | } |
| 333 | |
| 334 | if r.SnapshotKey != "" { |
| 335 | if r.Snapshotter == "" { |
| 336 | return fmt.Errorf("unable to resolve rootfs mounts without snapshotter on container: %w", errdefs.ErrInvalidArgument) |
| 337 | } |
| 338 | |
| 339 | // get the rootfs from the snapshotter and add it to the request |
| 340 | s, err := c.client.getSnapshotter(ctx, r.Snapshotter) |
| 341 | if err != nil { |
| 342 | return err |
| 343 | } |
| 344 | mounts, err := s.Mounts(ctx, r.SnapshotKey) |
| 345 | if err != nil { |
| 346 | return err |
| 347 | } |
| 348 | spec, err := c.Spec(ctx) |
| 349 | if err != nil { |
| 350 | return err |
| 351 | } |
| 352 | for _, m := range mounts { |
| 353 | if spec.Linux != nil && spec.Linux.MountLabel != "" { |
| 354 | ml := fmt.Sprintf("context=%q", spec.Linux.MountLabel) |
| 355 | m.Options = append(m.Options, ml) |
| 356 | } |
| 357 | request.Rootfs = append(request.Rootfs, &types.Mount{ |
| 358 | Type: m.Type, |
| 359 | Source: m.Source, |
| 360 | Target: m.Target, |
| 361 | Options: m.Options, |
| 362 | }) |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | return nil |
| 367 | } |
| 368 | |
| 369 | func (c *container) Restore(ctx context.Context, ioCreate cio.Creator, rootDir string) (_ int, retErr error) { |
| 370 | errorPid := -1 |