Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContainerdCommand = cli.Command{ Name: "containerd", Usage: usage, Flags: []cli.Flag{ cli.StringFlag{ Name: "state-dir", Value: defaultStateDir, Usage: "runtime state directory", }, cli.StringFlag{ Name: "containerd-dir", Value: defaultStateDir, Usage: "containerd daemon state directory", }, cli.StringFlag{ Name: "listen,l", Value: defaultGRPCEndpoint, Usage: "Address on which GRPC API will listen", }, cli.BoolFlag{ Name: "solo-namespaced", Usage: "launch as a solo namespaced for shared containers", }, }, Action: func(context *cli.Context) { driver := context.GlobalString("driver") kernel := context.GlobalString("kernel") initrd := context.GlobalString("initrd") template := context.GlobalString("template") stateDir := context.String("state-dir") containerdDir := context.String("containerd-dir") if containerdDir == "" { containerdDir = stateDir } if context.GlobalBool("debug") { flag.CommandLine.Parse([]string{"-v", "3", "--log_dir", context.GlobalString("log_dir"), "--alsologtostderr"}) } else { flag.CommandLine.Parse([]string{"-v", "1", "--log_dir", context.GlobalString("log_dir")}) } var tconfig *templatecore.TemplateVmConfig if template != "" { path := filepath.Join(template, "config.json") f, err := os.Open(path) if err != nil { glog.Errorf("open template JSON configuration file failed: %v\n", err) os.Exit(-1) } if err := json.NewDecoder(f).Decode(&tconfig); err != nil { glog.Errorf("parse template JSON configuration file failed: %v\n", err) f.Close() os.Exit(-1) } f.Close() if (driver != "" && driver != tconfig.Driver) || (kernel != "" && kernel != tconfig.Kernel) || (initrd != "" && initrd != tconfig.Initrd) { glog.Infof("template config is not match the driver, kernel or initrd argument, disable template") template = "" } else if driver == "" { driver = tconfig.Driver } } else if kernel == "" || initrd == "" { glog.Infof("argument kernel and initrd must be set") os.Exit(1) } hypervisor.InterfaceCount = 0 var err error if hypervisor.HDriver, err = driverloader.Probe(driver); err != nil { glog.V(1).Infof("%s\n", err.Error()) os.Exit(1) } var f factory.Factory if template != "" { f = singlefactory.New(templatefactory.NewFromExisted(tconfig)) } else { f = factory.NewFromConfigs(kernel, initrd, nil) } sv, err := supervisor.New(stateDir, containerdDir, f) if err != nil { glog.Infof("%v", err) os.Exit(1) } if context.Bool("solo-namespaced") { go namespaceShare(sv, containerdDir, stateDir) } if err = daemon(sv, context.String("listen")); err != nil { glog.Infof("%v", err) os.Exit(1) } if context.Bool("solo-namespaced") { os.RemoveAll(containerdDir) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.