Rename nsinit package to namespaces in libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
eec4c0b965
commit
ed7f4a0f6d
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build linux
|
// +build linux
|
||||||
|
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
|
@ -1,4 +1,4 @@
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build !linux
|
// +build !linux
|
||||||
|
|
||||||
package nsinit
|
package namespaces
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/dotcloud/docker/pkg/libcontainer"
|
"github.com/dotcloud/docker/pkg/libcontainer"
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
"github.com/dotcloud/docker/pkg/libcontainer"
|
"github.com/dotcloud/docker/pkg/libcontainer"
|
||||||
"github.com/dotcloud/docker/pkg/libcontainer/cgroups/fs"
|
"github.com/dotcloud/docker/pkg/libcontainer/cgroups/fs"
|
||||||
"github.com/dotcloud/docker/pkg/libcontainer/nsinit"
|
"github.com/dotcloud/docker/pkg/libcontainer/namespaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -40,9 +40,9 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if nspid > 0 {
|
if nspid > 0 {
|
||||||
exitCode, err = nsinit.ExecIn(container, nspid, os.Args[2:])
|
exitCode, err = namespaces.ExecIn(container, nspid, os.Args[2:])
|
||||||
} else {
|
} else {
|
||||||
term := nsinit.NewTerminal(os.Stdin, os.Stdout, os.Stderr, container.Tty)
|
term := namespaces.NewTerminal(os.Stdin, os.Stdout, os.Stderr, container.Tty)
|
||||||
exitCode, err = startContainer(container, term, dataPath, os.Args[2:])
|
exitCode, err = startContainer(container, term, dataPath, os.Args[2:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +61,12 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
syncPipe, err := nsinit.NewSyncPipeFromFd(0, uintptr(pipeFd))
|
syncPipe, err := namespaces.NewSyncPipeFromFd(0, uintptr(pipeFd))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("unable to create sync pipe: %s", err)
|
log.Fatalf("unable to create sync pipe: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := nsinit.Init(container, rootfs, console, syncPipe, os.Args[2:]); err != nil {
|
if err := namespaces.Init(container, rootfs, console, syncPipe, os.Args[2:]); err != nil {
|
||||||
log.Fatalf("unable to initialize for container: %s", err)
|
log.Fatalf("unable to initialize for container: %s", err)
|
||||||
}
|
}
|
||||||
case "stats":
|
case "stats":
|
||||||
|
@ -124,7 +124,7 @@ func readPid() (int, error) {
|
||||||
// error.
|
// error.
|
||||||
//
|
//
|
||||||
// Signals sent to the current process will be forwarded to container.
|
// Signals sent to the current process will be forwarded to container.
|
||||||
func startContainer(container *libcontainer.Container, term nsinit.Terminal, dataPath string, args []string) (int, error) {
|
func startContainer(container *libcontainer.Container, term namespaces.Terminal, dataPath string, args []string) (int, error) {
|
||||||
var (
|
var (
|
||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
sigc = make(chan os.Signal, 10)
|
sigc = make(chan os.Signal, 10)
|
||||||
|
@ -133,7 +133,7 @@ func startContainer(container *libcontainer.Container, term nsinit.Terminal, dat
|
||||||
signal.Notify(sigc)
|
signal.Notify(sigc)
|
||||||
|
|
||||||
createCommand := func(container *libcontainer.Container, console, rootfs, dataPath, init string, pipe *os.File, args []string) *exec.Cmd {
|
createCommand := func(container *libcontainer.Container, console, rootfs, dataPath, init string, pipe *os.File, args []string) *exec.Cmd {
|
||||||
cmd = nsinit.DefaultCreateCommand(container, console, rootfs, dataPath, init, pipe, args)
|
cmd = namespaces.DefaultCreateCommand(container, console, rootfs, dataPath, init, pipe, args)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ func startContainer(container *libcontainer.Container, term nsinit.Terminal, dat
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nsinit.Exec(container, term, "", dataPath, args, createCommand, startCallback)
|
return namespaces.Exec(container, term, "", dataPath, args, createCommand, startCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the container stats in json format.
|
// returns the container stats in json format.
|
Loading…
Reference in New Issue