Browse Source

Merge pull request #4598 from creack/fix_lxc

Fix lxc
Victor Vieux 11 years ago
parent
commit
f9fde52a07
3 changed files with 10 additions and 1 deletions
  1. 3 0
      execdriver/lxc/driver.go
  2. 1 1
      execdriver/lxc/info.go
  3. 6 0
      server.go

+ 3 - 0
execdriver/lxc/driver.go

@@ -168,6 +168,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
 	// Poll lxc for RUNNING status
 	// Poll lxc for RUNNING status
 	pid, err := d.waitForStart(c, waitLock)
 	pid, err := d.waitForStart(c, waitLock)
 	if err != nil {
 	if err != nil {
+		if c.Process != nil {
+			c.Process.Kill()
+		}
 		return -1, err
 		return -1, err
 	}
 	}
 	c.ContainerPid = pid
 	c.ContainerPid = pid

+ 1 - 1
execdriver/lxc/info.go

@@ -36,7 +36,7 @@ func parseLxcInfo(raw string) (*lxcInfo, error) {
 		if len(parts) < 2 {
 		if len(parts) < 2 {
 			continue
 			continue
 		}
 		}
-		switch strings.TrimSpace(parts[0]) {
+		switch strings.ToLower(strings.TrimSpace(parts[0])) {
 		case "state":
 		case "state":
 			info.Running = strings.TrimSpace(parts[1]) == "RUNNING"
 			info.Running = strings.TrimSpace(parts[1]) == "RUNNING"
 		case "pid":
 		case "pid":

+ 6 - 0
server.go

@@ -2384,7 +2384,13 @@ func (srv *Server) IsRunning() bool {
 }
 }
 
 
 func (srv *Server) Close() error {
 func (srv *Server) Close() error {
+	if srv == nil {
+		return nil
+	}
 	srv.SetRunning(false)
 	srv.SetRunning(false)
+	if srv.runtime == nil {
+		return nil
+	}
 	return srv.runtime.Close()
 	return srv.runtime.Close()
 }
 }