Merge branch 'master' into add-libcontainer

Conflicts:
	execdriver/termconsole.go

Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Michael Crosby
2014-02-26 12:55:24 -08:00
27 changed files with 1636 additions and 255 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ func (d *driver) Name() string {
}
func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallback execdriver.StartCallback) (int, error) {
if err := SetTerminal(c, pipes); err != nil {
if err := execdriver.SetTerminal(c, pipes); err != nil {
return -1, err
}
configPath, err := d.generateLXCConfig(c)
+1
View File
@@ -12,6 +12,7 @@ const LxcTemplate = `
lxc.network.type = veth
lxc.network.link = {{.Network.Bridge}}
lxc.network.name = eth0
lxc.network.mtu = {{.Network.Mtu}}
{{else}}
# network is disabled (-n=false)
lxc.network.type = empty
+2 -3
View File
@@ -6,14 +6,13 @@ package native
import (
"github.com/dotcloud/docker/execdriver"
"github.com/dotcloud/docker/execdriver/lxc"
"io"
"os"
"os/exec"
)
type dockerStdTerm struct {
lxc.StdConsole
execdriver.StdConsole
pipes *execdriver.Pipes
}
@@ -26,7 +25,7 @@ func (d *dockerStdTerm) SetMaster(master *os.File) {
}
type dockerTtyTerm struct {
lxc.TtyConsole
execdriver.TtyConsole
pipes *execdriver.Pipes
}
@@ -1,7 +1,6 @@
package lxc
package execdriver
import (
"github.com/dotcloud/docker/execdriver"
"github.com/dotcloud/docker/pkg/term"
"github.com/kr/pty"
"io"
@@ -9,9 +8,9 @@ import (
"os/exec"
)
func SetTerminal(command *execdriver.Command, pipes *execdriver.Pipes) error {
func SetTerminal(command *Command, pipes *Pipes) error {
var (
term execdriver.Terminal
term Terminal
err error
)
if command.Tty {
@@ -31,7 +30,7 @@ type TtyConsole struct {
SlavePty *os.File
}
func NewTtyConsole(command *execdriver.Command, pipes *execdriver.Pipes) (*TtyConsole, error) {
func NewTtyConsole(command *Command, pipes *Pipes) (*TtyConsole, error) {
ptyMaster, ptySlave, err := pty.Open()
if err != nil {
return nil, err
@@ -56,7 +55,7 @@ func (t *TtyConsole) Resize(h, w int) error {
return term.SetWinsize(t.MasterPty.Fd(), &term.Winsize{Height: uint16(h), Width: uint16(w)})
}
func (t *TtyConsole) AttachPipes(command *exec.Cmd, pipes *execdriver.Pipes) error {
func (t *TtyConsole) AttachPipes(command *exec.Cmd, pipes *Pipes) error {
command.Stdout = t.SlavePty
command.Stderr = t.SlavePty
@@ -89,7 +88,7 @@ func (t *TtyConsole) Close() error {
type StdConsole struct {
}
func NewStdConsole(command *execdriver.Command, pipes *execdriver.Pipes) (*StdConsole, error) {
func NewStdConsole(command *Command, pipes *Pipes) (*StdConsole, error) {
std := &StdConsole{}
if err := std.AttachPipes(&command.Cmd, pipes); err != nil {
@@ -98,7 +97,7 @@ func NewStdConsole(command *execdriver.Command, pipes *execdriver.Pipes) (*StdCo
return std, nil
}
func (s *StdConsole) AttachPipes(command *exec.Cmd, pipes *execdriver.Pipes) error {
func (s *StdConsole) AttachPipes(command *exec.Cmd, pipes *Pipes) error {
command.Stdout = pipes.Stdout
command.Stderr = pipes.Stderr