func (s *rpcServer) Destroy(ctx context.Context, in *pb.ContainerRequest) (*pb.None, error) { container := s.manager.Container(in.Uuid) if container == nil { return nil, fmt.Errorf("specified container not found") } if err := container.Stop(); err != nil { return nil, err } return &pb.None{}, nil }
// startUdev handles launching the udev service. func (r *runner) startUdev() error { if r.config.Services.Udev.Enabled == nil || !*r.config.Services.Udev.Enabled { r.log.Trace("Skipping udev") return nil } f, err := aciremote.RetrieveImage(r.config.Services.Udev.ACI, true) if err != nil { r.log.Errorf("Failed to retrieve udev image: %v", err) return nil } defer f.Close() manifest, err := findManifest(f) if err != nil { r.log.Errorf("Failed to find manifest in udev image: %v", err) return nil } if _, err := f.Seek(0, 0); err != nil { r.log.Errorf("Failed to set up udev image: %v", err) return nil } container, err := r.manager.Create("udev", manifest, f) if err != nil { r.log.Warnf("Failed to launch udev: %v", err) return nil } r.log.Debug("Started udev") container.Wait() r.log.Trace("Udev is finished") if err := container.Stop(); err != nil { r.log.Errorf("Failed to stop udev cleanly: %v", err) return nil } return nil }