Browse Source

Change drvier name to append version

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
Michael Crosby 11 years ago
parent
commit
cdfebc2a20
4 changed files with 8 additions and 11 deletions
  1. 2 5
      execdriver/chroot/driver.go
  2. 2 3
      execdriver/driver.go
  3. 3 2
      execdriver/lxc/driver.go
  4. 1 1
      server.go

+ 2 - 5
execdriver/chroot/driver.go

@@ -1,6 +1,7 @@
 package chroot
 
 import (
+	"fmt"
 	"github.com/dotcloud/docker/execdriver"
 	"github.com/dotcloud/docker/mount"
 	"os"
@@ -82,9 +83,5 @@ func (d *driver) Info(id string) execdriver.Info {
 }
 
 func (d *driver) Name() string {
-	return DriverName
-}
-
-func (d *driver) Version() string {
-	return Version
+	return fmt.Sprintf("%s-%s", DriverName, Version)
 }

+ 2 - 3
execdriver/driver.go

@@ -63,7 +63,6 @@ type Driver interface {
 	Run(c *Process, startCallback StartCallback) (int, error) // Run executes the process and blocks until the process exits and returns the exit code
 	Kill(c *Process, sig int) error
 	Wait(id string) error // Wait on an out of process...process - lxc ghosts
-	Version() string      // Driver version number
 	Name() string         // Driver name
 	Info(id string) Info  // "temporary" hack (until we move state from core to plugins)
 }
@@ -89,10 +88,10 @@ type Process struct {
 	Entrypoint string          `json:"entrypoint"`
 	Arguments  []string        `json:"arguments"`
 	WorkingDir string          `json:"working_dir"`
-	ConfigPath string          `json:"config_path"` // This should be able to be removed when the lxc template is moved into the driver
+	ConfigPath string          `json:"config_path"` // this should be able to be removed when the lxc template is moved into the driver
 	Tty        bool            `json:"tty"`
 	Network    *Network        `json:"network"` // if network is nil then networking is disabled
-	Config     []string        `json:"config"`
+	Config     []string        `json:"config"`  //  generic values that specific drivers can consume
 	Cgroups    *cgroups.Values `json:"cgroups"`
 }
 

+ 3 - 2
execdriver/lxc/driver.go

@@ -68,7 +68,8 @@ func NewDriver(root string, apparmor bool) (*driver, error) {
 }
 
 func (d *driver) Name() string {
-	return DriverName
+	version := d.version()
+	return fmt.Sprintf("%s-%s", DriverName, version)
 }
 
 func (d *driver) Run(c *execdriver.Process, startCallback execdriver.StartCallback) (int, error) {
@@ -186,7 +187,7 @@ func (d *driver) Wait(id string) error {
 	}
 }
 
-func (d *driver) Version() string {
+func (d *driver) version() string {
 	version := ""
 	if output, err := exec.Command("lxc-version").CombinedOutput(); err == nil {
 		outputStr := string(output)

+ 1 - 1
server.go

@@ -684,7 +684,7 @@ func (srv *Server) DockerInfo(job *engine.Job) engine.Status {
 	v.SetBool("Debug", os.Getenv("DEBUG") != "")
 	v.SetInt("NFd", utils.GetTotalUsedFds())
 	v.SetInt("NGoroutines", runtime.NumGoroutine())
-	v.Set("LXCVersion", srv.runtime.execDriver.Version())
+	v.Set("ExecutionDriver", srv.runtime.execDriver.Name())
 	v.SetInt("NEventsListener", len(srv.events))
 	v.Set("KernelVersion", kernelVersion)
 	v.Set("IndexServerAddress", auth.IndexServerAddress())