Replace aliased imports of logrus, fixes #11762

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
Antonio Murdaca 2015-03-26 23:22:04 +01:00
parent 42f9594fd3
commit 6f4d847046
82 changed files with 597 additions and 597 deletions

View File

@ -5,7 +5,7 @@ import (
"io" "io"
"net/url" "net/url"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/signal" "github.com/docker/docker/pkg/signal"
@ -51,7 +51,7 @@ func (cli *DockerCli) CmdAttach(args ...string) error {
if tty && cli.isTerminalOut { if tty && cli.isTerminalOut {
if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil { if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {
log.Debugf("Error monitoring TTY size: %s", err) logrus.Debugf("Error monitoring TTY size: %s", err)
} }
} }

View File

@ -17,7 +17,7 @@ import (
"strconv" "strconv"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/graph" "github.com/docker/docker/graph"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
@ -198,7 +198,7 @@ func (cli *DockerCli) CmdBuild(args ...string) error {
// windows: show error message about modified file permissions // windows: show error message about modified file permissions
// FIXME: this is not a valid warning when the daemon is running windows. should be removed once docker engine for windows can build. // FIXME: this is not a valid warning when the daemon is running windows. should be removed once docker engine for windows can build.
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
log.Warn(`SECURITY WARNING: You are building a Docker image from Windows against a Linux Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`) logrus.Warn(`SECURITY WARNING: You are building a Docker image from Windows against a Linux Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.`)
} }
var body io.Reader var body io.Reader

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"io" "io"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
@ -67,9 +67,9 @@ func (cli *DockerCli) CmdExec(args ...string) error {
// Block the return until the chan gets closed // Block the return until the chan gets closed
defer func() { defer func() {
log.Debugf("End of CmdExec(), Waiting for hijack to finish.") logrus.Debugf("End of CmdExec(), Waiting for hijack to finish.")
if _, ok := <-hijacked; ok { if _, ok := <-hijacked; ok {
log.Errorf("Hijack did not finish (chan still open)") logrus.Errorf("Hijack did not finish (chan still open)")
} }
}() }()
@ -100,19 +100,19 @@ func (cli *DockerCli) CmdExec(args ...string) error {
} }
case err := <-errCh: case err := <-errCh:
if err != nil { if err != nil {
log.Debugf("Error hijack: %s", err) logrus.Debugf("Error hijack: %s", err)
return err return err
} }
} }
if execConfig.Tty && cli.isTerminalIn { if execConfig.Tty && cli.isTerminalIn {
if err := cli.monitorTtySize(execID, true); err != nil { if err := cli.monitorTtySize(execID, true); err != nil {
log.Errorf("Error monitoring TTY size: %s", err) logrus.Errorf("Error monitoring TTY size: %s", err)
} }
} }
if err := <-errCh; err != nil { if err := <-errCh; err != nil {
log.Debugf("Error hijack: %s", err) logrus.Debugf("Error hijack: %s", err)
return err return err
} }

View File

@ -13,7 +13,7 @@ import (
"strings" "strings"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
@ -211,7 +211,7 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
} else { } else {
_, err = stdcopy.StdCopy(stdout, stderr, br) _, err = stdcopy.StdCopy(stdout, stderr, br)
} }
log.Debugf("[hijack] End of stdout") logrus.Debugf("[hijack] End of stdout")
return err return err
}) })
} }
@ -219,14 +219,14 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
sendStdin := promise.Go(func() error { sendStdin := promise.Go(func() error {
if in != nil { if in != nil {
io.Copy(rwc, in) io.Copy(rwc, in)
log.Debugf("[hijack] End of stdin") logrus.Debugf("[hijack] End of stdin")
} }
if conn, ok := rwc.(interface { if conn, ok := rwc.(interface {
CloseWrite() error CloseWrite() error
}); ok { }); ok {
if err := conn.CloseWrite(); err != nil { if err := conn.CloseWrite(); err != nil {
log.Debugf("Couldn't send EOF: %s", err) logrus.Debugf("Couldn't send EOF: %s", err)
} }
} }
// Discard errors due to pipe interruption // Discard errors due to pipe interruption
@ -235,14 +235,14 @@ func (cli *DockerCli) hijack(method, path string, setRawTerminal bool, in io.Rea
if stdout != nil || stderr != nil { if stdout != nil || stderr != nil {
if err := <-receiveStdout; err != nil { if err := <-receiveStdout; err != nil {
log.Debugf("Error receiveStdout: %s", err) logrus.Debugf("Error receiveStdout: %s", err)
return err return err
} }
} }
if !cli.isTerminalIn { if !cli.isTerminalIn {
if err := <-sendStdin; err != nil { if err := <-sendStdin; err != nil {
log.Debugf("Error sendStdin: %s", err) logrus.Debugf("Error sendStdin: %s", err)
return err return err
} }
} }

View File

@ -5,7 +5,7 @@ import (
"os" "os"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/units" "github.com/docker/docker/pkg/units"
@ -32,7 +32,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
} }
if _, err := out.Write(body); err != nil { if _, err := out.Write(body); err != nil {
log.Errorf("Error reading remote info: %s", err) logrus.Errorf("Error reading remote info: %s", err)
return err return err
} }
out.Close() out.Close()
@ -91,7 +91,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
if remoteInfo.Exists("SystemTime") { if remoteInfo.Exists("SystemTime") {
t, err := remoteInfo.GetTime("SystemTime") t, err := remoteInfo.GetTime("SystemTime")
if err != nil { if err != nil {
log.Errorf("Error reading system time: %v", err) logrus.Errorf("Error reading system time: %v", err)
} else { } else {
fmt.Fprintf(cli.out, "System Time: %s\n", t.Format(time.UnixDate)) fmt.Fprintf(cli.out, "System Time: %s\n", t.Format(time.UnixDate))
} }

View File

@ -6,7 +6,7 @@ import (
"net/url" "net/url"
"os" "os"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
"github.com/docker/docker/pkg/resolvconf" "github.com/docker/docker/pkg/resolvconf"
@ -132,9 +132,9 @@ func (cli *DockerCli) CmdRun(args ...string) error {
hijacked := make(chan io.Closer) hijacked := make(chan io.Closer)
// Block the return until the chan gets closed // Block the return until the chan gets closed
defer func() { defer func() {
log.Debugf("End of CmdRun(), Waiting for hijack to finish.") logrus.Debugf("End of CmdRun(), Waiting for hijack to finish.")
if _, ok := <-hijacked; ok { if _, ok := <-hijacked; ok {
log.Errorf("Hijack did not finish (chan still open)") logrus.Errorf("Hijack did not finish (chan still open)")
} }
}() }()
if config.AttachStdin || config.AttachStdout || config.AttachStderr { if config.AttachStdin || config.AttachStdout || config.AttachStderr {
@ -176,7 +176,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
} }
case err := <-errCh: case err := <-errCh:
if err != nil { if err != nil {
log.Debugf("Error hijack: %s", err) logrus.Debugf("Error hijack: %s", err)
return err return err
} }
} }
@ -184,7 +184,7 @@ func (cli *DockerCli) CmdRun(args ...string) error {
defer func() { defer func() {
if *flAutoRemove { if *flAutoRemove {
if _, _, err = readBody(cli.call("DELETE", "/containers/"+createResponse.ID+"?v=1", nil, nil)); err != nil { if _, _, err = readBody(cli.call("DELETE", "/containers/"+createResponse.ID+"?v=1", nil, nil)); err != nil {
log.Errorf("Error deleting container: %s", err) logrus.Errorf("Error deleting container: %s", err)
} }
} }
}() }()
@ -196,13 +196,13 @@ func (cli *DockerCli) CmdRun(args ...string) error {
if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminalOut { if (config.AttachStdin || config.AttachStdout || config.AttachStderr) && config.Tty && cli.isTerminalOut {
if err := cli.monitorTtySize(createResponse.ID, false); err != nil { if err := cli.monitorTtySize(createResponse.ID, false); err != nil {
log.Errorf("Error monitoring TTY size: %s", err) logrus.Errorf("Error monitoring TTY size: %s", err)
} }
} }
if errCh != nil { if errCh != nil {
if err := <-errCh; err != nil { if err := <-errCh; err != nil {
log.Debugf("Error hijack: %s", err) logrus.Debugf("Error hijack: %s", err)
return err return err
} }
} }

View File

@ -6,7 +6,7 @@ import (
"net/url" "net/url"
"os" "os"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
@ -30,10 +30,10 @@ func (cli *DockerCli) forwardAllSignals(cid string) chan os.Signal {
} }
} }
if sig == "" { if sig == "" {
log.Errorf("Unsupported signal: %v. Discarding.", s) logrus.Errorf("Unsupported signal: %v. Discarding.", s)
} }
if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/kill?signal=%s", cid, sig), nil, nil)); err != nil { if _, _, err := readBody(cli.call("POST", fmt.Sprintf("/containers/%s/kill?signal=%s", cid, sig), nil, nil)); err != nil {
log.Debugf("Error sending signal: %s", err) logrus.Debugf("Error sending signal: %s", err)
} }
} }
}() }()
@ -94,9 +94,9 @@ func (cli *DockerCli) CmdStart(args ...string) error {
hijacked := make(chan io.Closer) hijacked := make(chan io.Closer)
// Block the return until the chan gets closed // Block the return until the chan gets closed
defer func() { defer func() {
log.Debugf("CmdStart() returned, defer waiting for hijack to finish.") logrus.Debugf("CmdStart() returned, defer waiting for hijack to finish.")
if _, ok := <-hijacked; ok { if _, ok := <-hijacked; ok {
log.Errorf("Hijack did not finish (chan still open)") logrus.Errorf("Hijack did not finish (chan still open)")
} }
cli.in.Close() cli.in.Close()
}() }()
@ -145,7 +145,7 @@ func (cli *DockerCli) CmdStart(args ...string) error {
if *openStdin || *attach { if *openStdin || *attach {
if tty && cli.isTerminalOut { if tty && cli.isTerminalOut {
if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil { if err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {
log.Errorf("Error monitoring TTY size: %s", err) logrus.Errorf("Error monitoring TTY size: %s", err)
} }
} }
if attchErr := <-cErr; attchErr != nil { if attchErr := <-cErr; attchErr != nil {

View File

@ -15,7 +15,7 @@ import (
"strconv" "strconv"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
@ -195,7 +195,7 @@ func (cli *DockerCli) streamBody(body io.ReadCloser, contentType string, setRawT
} else { } else {
_, err = stdcopy.StdCopy(stdout, stderr, body) _, err = stdcopy.StdCopy(stdout, stderr, body)
} }
log.Debugf("[stream] End of stdout") logrus.Debugf("[stream] End of stdout")
return err return err
} }
return nil return nil
@ -218,7 +218,7 @@ func (cli *DockerCli) resizeTty(id string, isExec bool) {
} }
if _, _, err := readBody(cli.call("POST", path+v.Encode(), nil, nil)); err != nil { if _, _, err := readBody(cli.call("POST", path+v.Encode(), nil, nil)); err != nil {
log.Debugf("Error resize: %s", err) logrus.Debugf("Error resize: %s", err)
} }
} }
@ -295,7 +295,7 @@ func (cli *DockerCli) getTtySize() (int, int) {
} }
ws, err := term.GetWinsize(cli.outFd) ws, err := term.GetWinsize(cli.outFd)
if err != nil { if err != nil {
log.Debugf("Error getting size: %s", err) logrus.Debugf("Error getting size: %s", err)
if ws == nil { if ws == nil {
return 0, 0 return 0, 0
} }

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"runtime" "runtime"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
@ -41,11 +41,11 @@ func (cli *DockerCli) CmdVersion(args ...string) error {
out := engine.NewOutput() out := engine.NewOutput()
remoteVersion, err := out.AddEnv() remoteVersion, err := out.AddEnv()
if err != nil { if err != nil {
log.Errorf("Error reading remote version: %s", err) logrus.Errorf("Error reading remote version: %s", err)
return err return err
} }
if _, err := out.Write(body); err != nil { if _, err := out.Write(body); err != nil {
log.Errorf("Error reading remote version: %s", err) logrus.Errorf("Error reading remote version: %s", err)
return err return err
} }
out.Close() out.Close()

View File

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/version" "github.com/docker/docker/pkg/version"
@ -105,7 +105,7 @@ func FormGroup(key string, start, last int) string {
func MatchesContentType(contentType, expectedType string) bool { func MatchesContentType(contentType, expectedType string) bool {
mimetype, _, err := mime.ParseMediaType(contentType) mimetype, _, err := mime.ParseMediaType(contentType)
if err != nil { if err != nil {
log.Errorf("Error parsing media type: %s error: %v", contentType, err) logrus.Errorf("Error parsing media type: %s error: %v", contentType, err)
} }
return err == nil && mimetype == expectedType return err == nil && mimetype == expectedType
} }

View File

@ -24,7 +24,7 @@ import (
"github.com/docker/libcontainer/user" "github.com/docker/libcontainer/user"
"github.com/gorilla/mux" "github.com/gorilla/mux"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/daemon/networkdriver/portallocator" "github.com/docker/docker/daemon/networkdriver/portallocator"
@ -135,7 +135,7 @@ func httpError(w http.ResponseWriter, err error) {
} }
if err != nil { if err != nil {
log.Errorf("HTTP Error: statusCode=%d %v", statusCode, err) logrus.Errorf("HTTP Error: statusCode=%d %v", statusCode, err)
http.Error(w, err.Error(), statusCode) http.Error(w, err.Error(), statusCode)
} }
} }
@ -517,7 +517,7 @@ func postCommit(eng *engine.Engine, version version.Version, w http.ResponseWrit
} }
if err := config.Decode(r.Body); err != nil { if err := config.Decode(r.Body); err != nil {
log.Errorf("%s", err) logrus.Errorf("%s", err)
} }
if r.FormValue("pause") == "" && version.GreaterThanOrEqualTo("1.13") { if r.FormValue("pause") == "" && version.GreaterThanOrEqualTo("1.13") {
@ -987,7 +987,7 @@ func wsContainersAttach(eng *engine.Engine, version version.Version, w http.Resp
job.Stdout.Add(ws) job.Stdout.Add(ws)
job.Stderr.Set(ws) job.Stderr.Set(ws)
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Errorf("Error attaching websocket: %s", err) logrus.Errorf("Error attaching websocket: %s", err)
} }
}) })
h.ServeHTTP(w, r) h.ServeHTTP(w, r)
@ -1101,7 +1101,7 @@ func postBuild(eng *engine.Engine, version version.Version, w http.ResponseWrite
select { select {
case <-finished: case <-finished:
case <-closeNotifier.CloseNotify(): case <-closeNotifier.CloseNotify():
log.Infof("Client disconnected, cancelling job: %s", job.Name) logrus.Infof("Client disconnected, cancelling job: %s", job.Name)
job.Cancel() job.Cancel()
} }
}() }()
@ -1146,7 +1146,7 @@ func postContainersCopy(eng *engine.Engine, version version.Version, w http.Resp
job.Stdout.Add(w) job.Stdout.Add(w)
w.Header().Set("Content-Type", "application/x-tar") w.Header().Set("Content-Type", "application/x-tar")
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Errorf("%v", err) logrus.Errorf("%v", err)
if strings.Contains(strings.ToLower(err.Error()), "no such id") { if strings.Contains(strings.ToLower(err.Error()), "no such id") {
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
} else if strings.Contains(err.Error(), "no such file or directory") { } else if strings.Contains(err.Error(), "no such file or directory") {
@ -1262,7 +1262,7 @@ func optionsHandler(eng *engine.Engine, version version.Version, w http.Response
return nil return nil
} }
func writeCorsHeaders(w http.ResponseWriter, r *http.Request, corsHeaders string) { func writeCorsHeaders(w http.ResponseWriter, r *http.Request, corsHeaders string) {
log.Debugf("CORS header is enabled and set to: %s", corsHeaders) logrus.Debugf("CORS header is enabled and set to: %s", corsHeaders)
w.Header().Add("Access-Control-Allow-Origin", corsHeaders) w.Header().Add("Access-Control-Allow-Origin", corsHeaders)
w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth") w.Header().Add("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, X-Registry-Auth")
w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS") w.Header().Add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT, OPTIONS")
@ -1276,16 +1276,16 @@ func ping(eng *engine.Engine, version version.Version, w http.ResponseWriter, r
func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, corsHeaders string, dockerVersion version.Version) http.HandlerFunc { func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, localRoute string, handlerFunc HttpApiFunc, corsHeaders string, dockerVersion version.Version) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
// log the request // log the request
log.Debugf("Calling %s %s", localMethod, localRoute) logrus.Debugf("Calling %s %s", localMethod, localRoute)
if logging { if logging {
log.Infof("%s %s", r.Method, r.RequestURI) logrus.Infof("%s %s", r.Method, r.RequestURI)
} }
if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") { if strings.Contains(r.Header.Get("User-Agent"), "Docker-Client/") {
userAgent := strings.Split(r.Header.Get("User-Agent"), "/") userAgent := strings.Split(r.Header.Get("User-Agent"), "/")
if len(userAgent) == 2 && !dockerVersion.Equal(version.Version(userAgent[1])) { if len(userAgent) == 2 && !dockerVersion.Equal(version.Version(userAgent[1])) {
log.Debugf("Warning: client and server don't have the same version (client: %s, server: %s)", userAgent[1], dockerVersion) logrus.Debugf("Warning: client and server don't have the same version (client: %s, server: %s)", userAgent[1], dockerVersion)
} }
} }
version := version.Version(mux.Vars(r)["version"]) version := version.Version(mux.Vars(r)["version"])
@ -1302,7 +1302,7 @@ func makeHttpHandler(eng *engine.Engine, logging bool, localMethod string, local
} }
if err := handlerFunc(eng, version, w, r, mux.Vars(r)); err != nil { if err := handlerFunc(eng, version, w, r, mux.Vars(r)); err != nil {
log.Errorf("Handler for %s %s returned error: %s", localMethod, localRoute, err) logrus.Errorf("Handler for %s %s returned error: %s", localMethod, localRoute, err)
httpError(w, err) httpError(w, err)
} }
} }
@ -1406,7 +1406,7 @@ func createRouter(eng *engine.Engine, logging, enableCors bool, corsHeaders stri
for method, routes := range m { for method, routes := range m {
for route, fct := range routes { for route, fct := range routes {
log.Debugf("Registering %s, %s", method, route) logrus.Debugf("Registering %s, %s", method, route)
// NOTE: scope issue, make sure the variables are local and won't be changed // NOTE: scope issue, make sure the variables are local and won't be changed
localRoute := route localRoute := route
localFct := fct localFct := fct
@ -1454,7 +1454,7 @@ func lookupGidByName(nameOrGid string) (int, error) {
} }
gid, err := strconv.Atoi(nameOrGid) gid, err := strconv.Atoi(nameOrGid)
if err == nil { if err == nil {
log.Warnf("Could not find GID %d", gid) logrus.Warnf("Could not find GID %d", gid)
return gid, nil return gid, nil
} }
return -1, fmt.Errorf("Group %s not found", nameOrGid) return -1, fmt.Errorf("Group %s not found", nameOrGid)
@ -1504,7 +1504,7 @@ func changeGroup(addr string, nameOrGid string) error {
return err return err
} }
log.Debugf("%s group found. gid: %d", nameOrGid, gid) logrus.Debugf("%s group found. gid: %d", nameOrGid, gid)
return os.Chown(addr, 0, gid) return os.Chown(addr, 0, gid)
} }
@ -1517,7 +1517,7 @@ func setSocketGroup(addr, group string) error {
if group != "docker" { if group != "docker" {
return err return err
} }
log.Debugf("Warning: could not chgrp %s to docker: %v", addr, err) logrus.Debugf("Warning: could not chgrp %s to docker: %v", addr, err)
} }
return nil return nil
@ -1551,7 +1551,7 @@ func allocateDaemonPort(addr string) error {
func setupTcpHttp(addr string, job *engine.Job) (*HttpServer, error) { func setupTcpHttp(addr string, job *engine.Job) (*HttpServer, error) {
if !job.GetenvBool("TlsVerify") { if !job.GetenvBool("TlsVerify") {
log.Infof("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\") logrus.Infof("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
} }
r := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("CorsHeaders"), job.Getenv("Version")) r := createRouter(job.Eng, job.GetenvBool("Logging"), job.GetenvBool("EnableCors"), job.Getenv("CorsHeaders"), job.Getenv("Version"))
@ -1601,7 +1601,7 @@ func ServeApi(job *engine.Job) error {
return fmt.Errorf("usage: %s PROTO://ADDR [PROTO://ADDR ...]", job.Name) return fmt.Errorf("usage: %s PROTO://ADDR [PROTO://ADDR ...]", job.Name)
} }
go func() { go func() {
log.Infof("Listening for HTTP on %s (%s)", protoAddrParts[0], protoAddrParts[1]) logrus.Infof("Listening for HTTP on %s (%s)", protoAddrParts[0], protoAddrParts[1])
srv, err := NewServer(protoAddrParts[0], protoAddrParts[1], job) srv, err := NewServer(protoAddrParts[0], protoAddrParts[1], job)
if err != nil { if err != nil {
chErrors <- err chErrors <- err
@ -1609,7 +1609,7 @@ func ServeApi(job *engine.Job) error {
} }
job.Eng.OnShutdown(func() { job.Eng.OnShutdown(func() {
if err := srv.Close(); err != nil { if err := srv.Close(); err != nil {
log.Error(err) logrus.Error(err)
} }
}) })
if err = srv.Serve(); err != nil && strings.Contains(err.Error(), "use of closed network connection") { if err = srv.Serve(); err != nil && strings.Contains(err.Error(), "use of closed network connection") {

View File

@ -15,7 +15,7 @@ import (
"sort" "sort"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
flag "github.com/docker/docker/pkg/mflag" flag "github.com/docker/docker/pkg/mflag"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
@ -264,7 +264,7 @@ func run(b *Builder, args []string, attributes map[string]bool, original string)
defer func(cmd []string) { b.Config.Cmd = cmd }(cmd) defer func(cmd []string) { b.Config.Cmd = cmd }(cmd)
log.Debugf("[BUILDER] Command to be executed: %v", b.Config.Cmd) logrus.Debugf("[BUILDER] Command to be executed: %v", b.Config.Cmd)
hit, err := b.probeCache() hit, err := b.probeCache()
if err != nil { if err != nil {

View File

@ -26,7 +26,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/builder/command" "github.com/docker/docker/builder/command"
"github.com/docker/docker/builder/parser" "github.com/docker/docker/builder/parser"
@ -150,7 +150,7 @@ func (b *Builder) Run(context io.Reader) (string, error) {
defer func() { defer func() {
if err := os.RemoveAll(b.contextPath); err != nil { if err := os.RemoveAll(b.contextPath); err != nil {
log.Debugf("[BUILDER] failed to remove temporary context: %s", err) logrus.Debugf("[BUILDER] failed to remove temporary context: %s", err)
} }
}() }()
@ -166,7 +166,7 @@ func (b *Builder) Run(context io.Reader) (string, error) {
for i, n := range b.dockerfile.Children { for i, n := range b.dockerfile.Children {
select { select {
case <-b.cancelled: case <-b.cancelled:
log.Debug("Builder: build cancelled!") logrus.Debug("Builder: build cancelled!")
fmt.Fprintf(b.OutStream, "Build cancelled") fmt.Fprintf(b.OutStream, "Build cancelled")
return "", fmt.Errorf("Build cancelled") return "", fmt.Errorf("Build cancelled")
default: default:

View File

@ -19,7 +19,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/builder/parser" "github.com/docker/docker/builder/parser"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
imagepkg "github.com/docker/docker/image" imagepkg "github.com/docker/docker/image"
@ -522,13 +522,13 @@ func (b *Builder) probeCache() (bool, error) {
return false, err return false, err
} }
if cache == nil { if cache == nil {
log.Debugf("[BUILDER] Cache miss") logrus.Debugf("[BUILDER] Cache miss")
b.cacheBusted = true b.cacheBusted = true
return false, nil return false, nil
} }
fmt.Fprintf(b.OutStream, " ---> Using cache\n") fmt.Fprintf(b.OutStream, " ---> Using cache\n")
log.Debugf("[BUILDER] Use cached version") logrus.Debugf("[BUILDER] Use cached version")
b.image = cache.ID b.image = cache.ID
return true, nil return true, nil
} }
@ -587,7 +587,7 @@ func (b *Builder) run(c *daemon.Container) error {
go func() { go func() {
select { select {
case <-b.cancelled: case <-b.cancelled:
log.Debugln("Build cancelled, killing container:", c.ID) logrus.Debugln("Build cancelled, killing container:", c.ID)
c.Kill() c.Kill()
case <-finished: case <-finished:
} }
@ -688,7 +688,7 @@ func (b *Builder) addContext(container *daemon.Container, orig, dest string, dec
if err := chrootarchive.UntarPath(origPath, tarDest); err == nil { if err := chrootarchive.UntarPath(origPath, tarDest); err == nil {
return nil return nil
} else if err != io.EOF { } else if err != io.EOF {
log.Debugf("Couldn't untar %s to %s: %s", origPath, tarDest, err) logrus.Debugf("Couldn't untar %s to %s: %s", origPath, tarDest, err)
} }
} }

View File

@ -9,7 +9,7 @@ import (
"strconv" "strconv"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver/devmapper" "github.com/docker/docker/daemon/graphdriver/devmapper"
"github.com/docker/docker/pkg/devicemapper" "github.com/docker/docker/pkg/devicemapper"
) )
@ -63,7 +63,7 @@ func main() {
if *flDebug { if *flDebug {
os.Setenv("DEBUG", "1") os.Setenv("DEBUG", "1")
log.SetLevel(log.DebugLevel) logrus.SetLevel(logrus.DebugLevel)
} }
if flag.NArg() < 1 { if flag.NArg() < 1 {

View File

@ -8,7 +8,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
@ -39,25 +39,25 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
cLog, err := container.ReadLog("json") cLog, err := container.ReadLog("json")
if err != nil && os.IsNotExist(err) { if err != nil && os.IsNotExist(err) {
// Legacy logs // Legacy logs
log.Debugf("Old logs format") logrus.Debugf("Old logs format")
if stdout { if stdout {
cLog, err := container.ReadLog("stdout") cLog, err := container.ReadLog("stdout")
if err != nil { if err != nil {
log.Errorf("Error reading logs (stdout): %s", err) logrus.Errorf("Error reading logs (stdout): %s", err)
} else if _, err := io.Copy(job.Stdout, cLog); err != nil { } else if _, err := io.Copy(job.Stdout, cLog); err != nil {
log.Errorf("Error streaming logs (stdout): %s", err) logrus.Errorf("Error streaming logs (stdout): %s", err)
} }
} }
if stderr { if stderr {
cLog, err := container.ReadLog("stderr") cLog, err := container.ReadLog("stderr")
if err != nil { if err != nil {
log.Errorf("Error reading logs (stderr): %s", err) logrus.Errorf("Error reading logs (stderr): %s", err)
} else if _, err := io.Copy(job.Stderr, cLog); err != nil { } else if _, err := io.Copy(job.Stderr, cLog); err != nil {
log.Errorf("Error streaming logs (stderr): %s", err) logrus.Errorf("Error streaming logs (stderr): %s", err)
} }
} }
} else if err != nil { } else if err != nil {
log.Errorf("Error reading logs (json): %s", err) logrus.Errorf("Error reading logs (json): %s", err)
} else { } else {
dec := json.NewDecoder(cLog) dec := json.NewDecoder(cLog)
for { for {
@ -66,7 +66,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
if err := dec.Decode(l); err == io.EOF { if err := dec.Decode(l); err == io.EOF {
break break
} else if err != nil { } else if err != nil {
log.Errorf("Error streaming logs: %s", err) logrus.Errorf("Error streaming logs: %s", err)
break break
} }
if l.Stream == "stdout" && stdout { if l.Stream == "stdout" && stdout {
@ -90,7 +90,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
r, w := io.Pipe() r, w := io.Pipe()
go func() { go func() {
defer w.Close() defer w.Close()
defer log.Debugf("Closing buffered stdin pipe") defer logrus.Debugf("Closing buffered stdin pipe")
io.Copy(w, job.Stdin) io.Copy(w, job.Stdin)
}() }()
cStdin = r cStdin = r
@ -140,7 +140,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
if stdin == nil || !openStdin { if stdin == nil || !openStdin {
return return
} }
log.Debugf("attach: stdin: begin") logrus.Debugf("attach: stdin: begin")
defer func() { defer func() {
if stdinOnce && !tty { if stdinOnce && !tty {
cStdin.Close() cStdin.Close()
@ -154,7 +154,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
} }
} }
wg.Done() wg.Done()
log.Debugf("attach: stdin: end") logrus.Debugf("attach: stdin: end")
}() }()
var err error var err error
@ -168,7 +168,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
err = nil err = nil
} }
if err != nil { if err != nil {
log.Errorf("attach: stdin: %s", err) logrus.Errorf("attach: stdin: %s", err)
errors <- err errors <- err
return return
} }
@ -185,16 +185,16 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
} }
streamPipe.Close() streamPipe.Close()
wg.Done() wg.Done()
log.Debugf("attach: %s: end", name) logrus.Debugf("attach: %s: end", name)
}() }()
log.Debugf("attach: %s: begin", name) logrus.Debugf("attach: %s: begin", name)
_, err := io.Copy(stream, streamPipe) _, err := io.Copy(stream, streamPipe)
if err == io.ErrClosedPipe { if err == io.ErrClosedPipe {
err = nil err = nil
} }
if err != nil { if err != nil {
log.Errorf("attach: %s: %v", name, err) logrus.Errorf("attach: %s: %v", name, err)
errors <- err errors <- err
} }
} }

View File

@ -19,7 +19,7 @@ import (
"github.com/docker/libcontainer/devices" "github.com/docker/libcontainer/devices"
"github.com/docker/libcontainer/label" "github.com/docker/libcontainer/label"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/logger" "github.com/docker/docker/daemon/logger"
"github.com/docker/docker/daemon/logger/jsonfilelog" "github.com/docker/docker/daemon/logger/jsonfilelog"
@ -201,7 +201,7 @@ func (container *Container) WriteHostConfig() error {
func (container *Container) LogEvent(action string) { func (container *Container) LogEvent(action string) {
d := container.daemon d := container.daemon
if err := d.eng.Job("log", action, container.ID, d.Repositories().ImageName(container.ImageID)).Run(); err != nil { if err := d.eng.Job("log", action, container.ID, d.Repositories().ImageName(container.ImageID)).Run(); err != nil {
log.Errorf("Error logging event %s for %s: %s", action, container.ID, err) logrus.Errorf("Error logging event %s for %s: %s", action, container.ID, err)
} }
} }
@ -659,7 +659,7 @@ func (container *Container) cleanup() {
} }
if err := container.Unmount(); err != nil { if err := container.Unmount(); err != nil {
log.Errorf("%v: Failed to umount filesystem: %v", container.ID, err) logrus.Errorf("%v: Failed to umount filesystem: %v", container.ID, err)
} }
for _, eConfig := range container.execCommands.s { for _, eConfig := range container.execCommands.s {
@ -668,7 +668,7 @@ func (container *Container) cleanup() {
} }
func (container *Container) KillSig(sig int) error { func (container *Container) KillSig(sig int) error {
log.Debugf("Sending %d to %s", sig, container.ID) logrus.Debugf("Sending %d to %s", sig, container.ID)
container.Lock() container.Lock()
defer container.Unlock() defer container.Unlock()
@ -699,7 +699,7 @@ func (container *Container) KillSig(sig int) error {
func (container *Container) killPossiblyDeadProcess(sig int) error { func (container *Container) killPossiblyDeadProcess(sig int) error {
err := container.KillSig(sig) err := container.KillSig(sig)
if err == syscall.ESRCH { if err == syscall.ESRCH {
log.Debugf("Cannot kill process (pid=%d) with signal %d: no such process.", container.GetPid(), sig) logrus.Debugf("Cannot kill process (pid=%d) with signal %d: no such process.", container.GetPid(), sig)
return nil return nil
} }
return err return err
@ -739,12 +739,12 @@ func (container *Container) Kill() error {
if _, err := container.WaitStop(10 * time.Second); err != nil { if _, err := container.WaitStop(10 * time.Second); err != nil {
// Ensure that we don't kill ourselves // Ensure that we don't kill ourselves
if pid := container.GetPid(); pid != 0 { if pid := container.GetPid(); pid != 0 {
log.Infof("Container %s failed to exit within 10 seconds of kill - trying direct SIGKILL", stringid.TruncateID(container.ID)) logrus.Infof("Container %s failed to exit within 10 seconds of kill - trying direct SIGKILL", stringid.TruncateID(container.ID))
if err := syscall.Kill(pid, 9); err != nil { if err := syscall.Kill(pid, 9); err != nil {
if err != syscall.ESRCH { if err != syscall.ESRCH {
return err return err
} }
log.Debugf("Cannot kill process (pid=%d) with signal 9: no such process.", pid) logrus.Debugf("Cannot kill process (pid=%d) with signal 9: no such process.", pid)
} }
} }
} }
@ -760,7 +760,7 @@ func (container *Container) Stop(seconds int) error {
// 1. Send a SIGTERM // 1. Send a SIGTERM
if err := container.killPossiblyDeadProcess(15); err != nil { if err := container.killPossiblyDeadProcess(15); err != nil {
log.Infof("Failed to send SIGTERM to the process, force killing") logrus.Infof("Failed to send SIGTERM to the process, force killing")
if err := container.killPossiblyDeadProcess(9); err != nil { if err := container.killPossiblyDeadProcess(9); err != nil {
return err return err
} }
@ -768,7 +768,7 @@ func (container *Container) Stop(seconds int) error {
// 2. Wait for the process to exit on its own // 2. Wait for the process to exit on its own
if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil { if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil {
log.Infof("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds) logrus.Infof("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds)
// 3. If it doesn't, then send SIGKILL // 3. If it doesn't, then send SIGKILL
if err := container.Kill(); err != nil { if err := container.Kill(); err != nil {
container.WaitStop(-1 * time.Second) container.WaitStop(-1 * time.Second)
@ -904,7 +904,7 @@ func (container *Container) GetSize() (int64, int64) {
) )
if err := container.Mount(); err != nil { if err := container.Mount(); err != nil {
log.Errorf("Failed to compute size of container rootfs %s: %s", container.ID, err) logrus.Errorf("Failed to compute size of container rootfs %s: %s", container.ID, err)
return sizeRw, sizeRootfs return sizeRw, sizeRootfs
} }
defer container.Unmount() defer container.Unmount()
@ -912,7 +912,7 @@ func (container *Container) GetSize() (int64, int64) {
initID := fmt.Sprintf("%s-init", container.ID) initID := fmt.Sprintf("%s-init", container.ID)
sizeRw, err = driver.DiffSize(container.ID, initID) sizeRw, err = driver.DiffSize(container.ID, initID)
if err != nil { if err != nil {
log.Errorf("Driver %s couldn't return diff size of container %s: %s", driver, container.ID, err) logrus.Errorf("Driver %s couldn't return diff size of container %s: %s", driver, container.ID, err)
// FIXME: GetSize should return an error. Not changing it now in case // FIXME: GetSize should return an error. Not changing it now in case
// there is a side-effect. // there is a side-effect.
sizeRw = -1 sizeRw = -1
@ -1007,7 +1007,7 @@ func (container *Container) DisableLink(name string) {
if link, exists := container.activeLinks[name]; exists { if link, exists := container.activeLinks[name]; exists {
link.Disable() link.Disable()
} else { } else {
log.Debugf("Could not find active link for %s", name) logrus.Debugf("Could not find active link for %s", name)
} }
} }
} }
@ -1017,7 +1017,7 @@ func (container *Container) setupContainerDns() error {
// check if this is an existing container that needs DNS update: // check if this is an existing container that needs DNS update:
if container.UpdateDns { if container.UpdateDns {
// read the host's resolv.conf, get the hash and call updateResolvConf // read the host's resolv.conf, get the hash and call updateResolvConf
log.Debugf("Check container (%s) for update to resolv.conf - UpdateDns flag was set", container.ID) logrus.Debugf("Check container (%s) for update to resolv.conf - UpdateDns flag was set", container.ID)
latestResolvConf, latestHash := resolvconf.GetLastModified() latestResolvConf, latestHash := resolvconf.GetLastModified()
// clean container resolv.conf re: localhost nameservers and IPv6 NS (if IPv6 disabled) // clean container resolv.conf re: localhost nameservers and IPv6 NS (if IPv6 disabled)
@ -1133,7 +1133,7 @@ func (container *Container) updateResolvConf(updatedResolvConf []byte, newResolv
//if the user has not modified the resolv.conf of the container since we wrote it last //if the user has not modified the resolv.conf of the container since we wrote it last
//we will replace it with the updated resolv.conf from the host //we will replace it with the updated resolv.conf from the host
if string(hashBytes) == curHash { if string(hashBytes) == curHash {
log.Debugf("replacing %q with updated host resolv.conf", container.ResolvConfPath) logrus.Debugf("replacing %q with updated host resolv.conf", container.ResolvConfPath)
// for atomic updates to these files, use temporary files with os.Rename: // for atomic updates to these files, use temporary files with os.Rename:
dir := path.Dir(container.ResolvConfPath) dir := path.Dir(container.ResolvConfPath)
@ -1172,13 +1172,13 @@ func (container *Container) updateParentsHosts() error {
c, err := container.daemon.Get(ref.ParentID) c, err := container.daemon.Get(ref.ParentID)
if err != nil { if err != nil {
log.Error(err) logrus.Error(err)
} }
if c != nil && !container.daemon.config.DisableNetwork && container.hostConfig.NetworkMode.IsPrivate() { if c != nil && !container.daemon.config.DisableNetwork && container.hostConfig.NetworkMode.IsPrivate() {
log.Debugf("Update /etc/hosts of %s for alias %s with ip %s", c.ID, ref.Name, container.NetworkSettings.IPAddress) logrus.Debugf("Update /etc/hosts of %s for alias %s with ip %s", c.ID, ref.Name, container.NetworkSettings.IPAddress)
if err := etchosts.Update(c.HostsPath, container.NetworkSettings.IPAddress, ref.Name); err != nil { if err := etchosts.Update(c.HostsPath, container.NetworkSettings.IPAddress, ref.Name); err != nil {
log.Errorf("Failed to update /etc/hosts in parent container %s for alias %s: %v", c.ID, ref.Name, err) logrus.Errorf("Failed to update /etc/hosts in parent container %s for alias %s: %v", c.ID, ref.Name, err)
} }
} }
} }
@ -1244,15 +1244,15 @@ func (container *Container) initializeNetworking() error {
// Make sure the config is compatible with the current kernel // Make sure the config is compatible with the current kernel
func (container *Container) verifyDaemonSettings() { func (container *Container) verifyDaemonSettings() {
if container.Config.Memory > 0 && !container.daemon.sysInfo.MemoryLimit { if container.Config.Memory > 0 && !container.daemon.sysInfo.MemoryLimit {
log.Warnf("Your kernel does not support memory limit capabilities. Limitation discarded.") logrus.Warnf("Your kernel does not support memory limit capabilities. Limitation discarded.")
container.Config.Memory = 0 container.Config.Memory = 0
} }
if container.Config.Memory > 0 && !container.daemon.sysInfo.SwapLimit { if container.Config.Memory > 0 && !container.daemon.sysInfo.SwapLimit {
log.Warnf("Your kernel does not support swap limit capabilities. Limitation discarded.") logrus.Warnf("Your kernel does not support swap limit capabilities. Limitation discarded.")
container.Config.MemorySwap = -1 container.Config.MemorySwap = -1
} }
if container.daemon.sysInfo.IPv4ForwardingDisabled { if container.daemon.sysInfo.IPv4ForwardingDisabled {
log.Warnf("IPv4 forwarding is disabled. Networking will not work") logrus.Warnf("IPv4 forwarding is disabled. Networking will not work")
} }
} }

View File

@ -16,7 +16,7 @@ import (
"github.com/docker/libcontainer/label" "github.com/docker/libcontainer/label"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
@ -261,7 +261,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err
// if so, then we need to restart monitor and init a new lock // if so, then we need to restart monitor and init a new lock
// If the container is supposed to be running, make sure of it // If the container is supposed to be running, make sure of it
if container.IsRunning() { if container.IsRunning() {
log.Debugf("killing old running container %s", container.ID) logrus.Debugf("killing old running container %s", container.ID)
existingPid := container.Pid existingPid := container.Pid
container.SetStopped(&execdriver.ExitStatus{ExitCode: 0}) container.SetStopped(&execdriver.ExitStatus{ExitCode: 0})
@ -278,23 +278,23 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err
var err error var err error
cmd.ProcessConfig.Process, err = os.FindProcess(existingPid) cmd.ProcessConfig.Process, err = os.FindProcess(existingPid)
if err != nil { if err != nil {
log.Debugf("cannot find existing process for %d", existingPid) logrus.Debugf("cannot find existing process for %d", existingPid)
} }
daemon.execDriver.Terminate(cmd) daemon.execDriver.Terminate(cmd)
} }
if err := container.Unmount(); err != nil { if err := container.Unmount(); err != nil {
log.Debugf("unmount error %s", err) logrus.Debugf("unmount error %s", err)
} }
if err := container.ToDisk(); err != nil { if err := container.ToDisk(); err != nil {
log.Debugf("saving stopped state to disk %s", err) logrus.Debugf("saving stopped state to disk %s", err)
} }
info := daemon.execDriver.Info(container.ID) info := daemon.execDriver.Info(container.ID)
if !info.IsRunning() { if !info.IsRunning() {
log.Debugf("Container %s was supposed to be running but is not.", container.ID) logrus.Debugf("Container %s was supposed to be running but is not.", container.ID)
log.Debug("Marking as stopped") logrus.Debug("Marking as stopped")
container.SetStopped(&execdriver.ExitStatus{ExitCode: -127}) container.SetStopped(&execdriver.ExitStatus{ExitCode: -127})
if err := container.ToDisk(); err != nil { if err := container.ToDisk(); err != nil {
@ -314,7 +314,7 @@ func (daemon *Daemon) ensureName(container *Container) error {
container.Name = name container.Name = name
if err := container.ToDisk(); err != nil { if err := container.ToDisk(); err != nil {
log.Debugf("Error saving container name %s", err) logrus.Debugf("Error saving container name %s", err)
} }
} }
return nil return nil
@ -337,7 +337,7 @@ func (daemon *Daemon) restore() error {
) )
if !debug { if !debug {
log.Info("Loading containers: start.") logrus.Info("Loading containers: start.")
} }
dir, err := ioutil.ReadDir(daemon.repository) dir, err := ioutil.ReadDir(daemon.repository)
if err != nil { if err != nil {
@ -347,21 +347,21 @@ func (daemon *Daemon) restore() error {
for _, v := range dir { for _, v := range dir {
id := v.Name() id := v.Name()
container, err := daemon.load(id) container, err := daemon.load(id)
if !debug && log.GetLevel() == log.InfoLevel { if !debug && logrus.GetLevel() == logrus.InfoLevel {
fmt.Print(".") fmt.Print(".")
} }
if err != nil { if err != nil {
log.Errorf("Failed to load container %v: %v", id, err) logrus.Errorf("Failed to load container %v: %v", id, err)
continue continue
} }
// Ignore the container if it does not support the current driver being used by the graph // Ignore the container if it does not support the current driver being used by the graph
if (container.Driver == "" && currentDriver == "aufs") || container.Driver == currentDriver { if (container.Driver == "" && currentDriver == "aufs") || container.Driver == currentDriver {
log.Debugf("Loaded container %v", container.ID) logrus.Debugf("Loaded container %v", container.ID)
containers[container.ID] = container containers[container.ID] = container
} else { } else {
log.Debugf("Cannot load container %s because it was created with another graph driver.", container.ID) logrus.Debugf("Cannot load container %s because it was created with another graph driver.", container.ID)
} }
} }
@ -369,7 +369,7 @@ func (daemon *Daemon) restore() error {
if entities := daemon.containerGraph.List("/", -1); entities != nil { if entities := daemon.containerGraph.List("/", -1); entities != nil {
for _, p := range entities.Paths() { for _, p := range entities.Paths() {
if !debug && log.GetLevel() == log.InfoLevel { if !debug && logrus.GetLevel() == logrus.InfoLevel {
fmt.Print(".") fmt.Print(".")
} }
@ -377,7 +377,7 @@ func (daemon *Daemon) restore() error {
if container, ok := containers[e.ID()]; ok { if container, ok := containers[e.ID()]; ok {
if err := daemon.register(container, false); err != nil { if err := daemon.register(container, false); err != nil {
log.Debugf("Failed to register container %s: %s", container.ID, err) logrus.Debugf("Failed to register container %s: %s", container.ID, err)
} }
registeredContainers = append(registeredContainers, container) registeredContainers = append(registeredContainers, container)
@ -393,11 +393,11 @@ func (daemon *Daemon) restore() error {
// Try to set the default name for a container if it exists prior to links // Try to set the default name for a container if it exists prior to links
container.Name, err = daemon.generateNewName(container.ID) container.Name, err = daemon.generateNewName(container.ID)
if err != nil { if err != nil {
log.Debugf("Setting default id - %s", err) logrus.Debugf("Setting default id - %s", err)
} }
if err := daemon.register(container, false); err != nil { if err := daemon.register(container, false); err != nil {
log.Debugf("Failed to register container %s: %s", container.ID, err) logrus.Debugf("Failed to register container %s: %s", container.ID, err)
} }
registeredContainers = append(registeredContainers, container) registeredContainers = append(registeredContainers, container)
@ -406,25 +406,25 @@ func (daemon *Daemon) restore() error {
// check the restart policy on the containers and restart any container with // check the restart policy on the containers and restart any container with
// the restart policy of "always" // the restart policy of "always"
if daemon.config.AutoRestart { if daemon.config.AutoRestart {
log.Debug("Restarting containers...") logrus.Debug("Restarting containers...")
for _, container := range registeredContainers { for _, container := range registeredContainers {
if container.hostConfig.RestartPolicy.Name == "always" || if container.hostConfig.RestartPolicy.Name == "always" ||
(container.hostConfig.RestartPolicy.Name == "on-failure" && container.ExitCode != 0) { (container.hostConfig.RestartPolicy.Name == "on-failure" && container.ExitCode != 0) {
log.Debugf("Starting container %s", container.ID) logrus.Debugf("Starting container %s", container.ID)
if err := container.Start(); err != nil { if err := container.Start(); err != nil {
log.Debugf("Failed to start container %s: %s", container.ID, err) logrus.Debugf("Failed to start container %s: %s", container.ID, err)
} }
} }
} }
} }
if !debug { if !debug {
if log.GetLevel() == log.InfoLevel { if logrus.GetLevel() == logrus.InfoLevel {
fmt.Println() fmt.Println()
} }
log.Info("Loading containers: done.") logrus.Info("Loading containers: done.")
} }
return nil return nil
@ -451,7 +451,7 @@ func (daemon *Daemon) setupResolvconfWatcher() error {
// without an actual change to the file // without an actual change to the file
updatedResolvConf, newResolvConfHash, err := resolvconf.GetIfChanged() updatedResolvConf, newResolvConfHash, err := resolvconf.GetIfChanged()
if err != nil { if err != nil {
log.Debugf("Error retrieving updated host resolv.conf: %v", err) logrus.Debugf("Error retrieving updated host resolv.conf: %v", err)
} else if updatedResolvConf != nil { } else if updatedResolvConf != nil {
// because the new host resolv.conf might have localhost nameservers.. // because the new host resolv.conf might have localhost nameservers..
updatedResolvConf, modified := resolvconf.FilterResolvDns(updatedResolvConf, daemon.config.EnableIPv6) updatedResolvConf, modified := resolvconf.FilterResolvDns(updatedResolvConf, daemon.config.EnableIPv6)
@ -459,22 +459,22 @@ func (daemon *Daemon) setupResolvconfWatcher() error {
// changes have occurred during localhost cleanup: generate an updated hash // changes have occurred during localhost cleanup: generate an updated hash
newHash, err := utils.HashData(bytes.NewReader(updatedResolvConf)) newHash, err := utils.HashData(bytes.NewReader(updatedResolvConf))
if err != nil { if err != nil {
log.Debugf("Error generating hash of new resolv.conf: %v", err) logrus.Debugf("Error generating hash of new resolv.conf: %v", err)
} else { } else {
newResolvConfHash = newHash newResolvConfHash = newHash
} }
} }
log.Debug("host network resolv.conf changed--walking container list for updates") logrus.Debug("host network resolv.conf changed--walking container list for updates")
contList := daemon.containers.List() contList := daemon.containers.List()
for _, container := range contList { for _, container := range contList {
if err := container.updateResolvConf(updatedResolvConf, newResolvConfHash); err != nil { if err := container.updateResolvConf(updatedResolvConf, newResolvConfHash); err != nil {
log.Debugf("Error on resolv.conf update check for container ID: %s: %v", container.ID, err) logrus.Debugf("Error on resolv.conf update check for container ID: %s: %v", container.ID, err)
} }
} }
} }
} }
case err := <-watcher.Errors: case err := <-watcher.Errors:
log.Debugf("host resolv.conf notify error: %v", err) logrus.Debugf("host resolv.conf notify error: %v", err)
} }
} }
}() }()
@ -830,7 +830,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
// register portallocator release on shutdown // register portallocator release on shutdown
eng.OnShutdown(func() { eng.OnShutdown(func() {
if err := portallocator.ReleaseAll(); err != nil { if err := portallocator.ReleaseAll(); err != nil {
log.Errorf("portallocator.ReleaseAll(): %s", err) logrus.Errorf("portallocator.ReleaseAll(): %s", err)
} }
}) })
// Claim the pidfile first, to avoid any and all unexpected race conditions. // Claim the pidfile first, to avoid any and all unexpected race conditions.
@ -892,11 +892,11 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
if err != nil { if err != nil {
return nil, fmt.Errorf("error intializing graphdriver: %v", err) return nil, fmt.Errorf("error intializing graphdriver: %v", err)
} }
log.Debugf("Using graph driver %s", driver) logrus.Debugf("Using graph driver %s", driver)
// register cleanup for graph driver // register cleanup for graph driver
eng.OnShutdown(func() { eng.OnShutdown(func() {
if err := driver.Cleanup(); err != nil { if err := driver.Cleanup(); err != nil {
log.Errorf("Error during graph storage driver.Cleanup(): %v", err) logrus.Errorf("Error during graph storage driver.Cleanup(): %v", err)
} }
}) })
@ -906,9 +906,9 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
if driver.String() == "btrfs" { if driver.String() == "btrfs" {
return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver") return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver")
} }
log.Debug("SELinux enabled successfully") logrus.Debug("SELinux enabled successfully")
} else { } else {
log.Warn("Docker could not enable SELinux on the host system") logrus.Warn("Docker could not enable SELinux on the host system")
} }
} else { } else {
selinuxSetDisabled() selinuxSetDisabled()
@ -925,7 +925,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
return nil, err return nil, err
} }
log.Debug("Creating images graph") logrus.Debug("Creating images graph")
g, err := graph.NewGraph(path.Join(config.Root, "graph"), driver) g, err := graph.NewGraph(path.Join(config.Root, "graph"), driver)
if err != nil { if err != nil {
return nil, err return nil, err
@ -946,7 +946,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
return nil, err return nil, err
} }
log.Debug("Creating repository list") logrus.Debug("Creating repository list")
repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, trustKey) repositories, err := graph.NewTagStore(path.Join(config.Root, "repositories-"+driver.String()), g, trustKey)
if err != nil { if err != nil {
return nil, fmt.Errorf("Couldn't create Tag store: %s", err) return nil, fmt.Errorf("Couldn't create Tag store: %s", err)
@ -988,7 +988,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
// register graph close on shutdown // register graph close on shutdown
eng.OnShutdown(func() { eng.OnShutdown(func() {
if err := graph.Close(); err != nil { if err := graph.Close(); err != nil {
log.Errorf("Error during container graph.Close(): %v", err) logrus.Errorf("Error during container graph.Close(): %v", err)
} }
}) })
@ -1042,7 +1042,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
eng.OnShutdown(func() { eng.OnShutdown(func() {
if err := daemon.shutdown(); err != nil { if err := daemon.shutdown(); err != nil {
log.Errorf("Error during daemon.shutdown(): %v", err) logrus.Errorf("Error during daemon.shutdown(): %v", err)
} }
}) })
@ -1060,20 +1060,20 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
func (daemon *Daemon) shutdown() error { func (daemon *Daemon) shutdown() error {
group := sync.WaitGroup{} group := sync.WaitGroup{}
log.Debug("starting clean shutdown of all containers...") logrus.Debug("starting clean shutdown of all containers...")
for _, container := range daemon.List() { for _, container := range daemon.List() {
c := container c := container
if c.IsRunning() { if c.IsRunning() {
log.Debugf("stopping %s", c.ID) logrus.Debugf("stopping %s", c.ID)
group.Add(1) group.Add(1)
go func() { go func() {
defer group.Done() defer group.Done()
if err := c.KillSig(15); err != nil { if err := c.KillSig(15); err != nil {
log.Debugf("kill 15 error for %s - %s", c.ID, err) logrus.Debugf("kill 15 error for %s - %s", c.ID, err)
} }
c.WaitStop(-1 * time.Second) c.WaitStop(-1 * time.Second)
log.Debugf("container stopped %s", c.ID) logrus.Debugf("container stopped %s", c.ID)
}() }()
} }
} }
@ -1255,11 +1255,11 @@ func checkKernel() error {
// the circumstances of pre-3.8 crashes are clearer. // the circumstances of pre-3.8 crashes are clearer.
// For details see http://github.com/docker/docker/issues/407 // For details see http://github.com/docker/docker/issues/407
if k, err := kernel.GetKernelVersion(); err != nil { if k, err := kernel.GetKernelVersion(); err != nil {
log.Warnf("%s", err) logrus.Warnf("%s", err)
} else { } else {
if kernel.CompareKernelVersion(k, &kernel.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 { if kernel.CompareKernelVersion(k, &kernel.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 {
if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" { if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" {
log.Warnf("You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String()) logrus.Warnf("You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String())
} }
} }
} }

View File

@ -3,7 +3,7 @@
package daemon package daemon
import ( import (
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/daemon/graphdriver/aufs" "github.com/docker/docker/daemon/graphdriver/aufs"
"github.com/docker/docker/graph" "github.com/docker/docker/graph"
@ -13,7 +13,7 @@ import (
// If aufs driver is not built, this func is a noop. // If aufs driver is not built, this func is a noop.
func migrateIfAufs(driver graphdriver.Driver, root string) error { func migrateIfAufs(driver graphdriver.Driver, root string) error {
if ad, ok := driver.(*aufs.Driver); ok { if ad, ok := driver.(*aufs.Driver); ok {
log.Debugf("Migrating existing containers") logrus.Debugf("Migrating existing containers")
if err := ad.Migrate(root, graph.SetupInitLayer); err != nil { if err := ad.Migrate(root, graph.SetupInitLayer); err != nil {
return err return err
} }

View File

@ -5,7 +5,7 @@ import (
"os" "os"
"path" "path"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
) )
@ -77,7 +77,7 @@ func (daemon *Daemon) ContainerRm(job *engine.Job) error {
func (daemon *Daemon) DeleteVolumes(volumeIDs map[string]struct{}) { func (daemon *Daemon) DeleteVolumes(volumeIDs map[string]struct{}) {
for id := range volumeIDs { for id := range volumeIDs {
if err := daemon.volumes.Delete(id); err != nil { if err := daemon.volumes.Delete(id); err != nil {
log.Infof("%s", err) logrus.Infof("%s", err)
continue continue
} }
} }
@ -103,7 +103,7 @@ func (daemon *Daemon) Rm(container *Container) error {
daemon.containers.Delete(container.ID) daemon.containers.Delete(container.ID)
container.derefVolumes() container.derefVolumes()
if _, err := daemon.containerGraph.Purge(container.ID); err != nil { if _, err := daemon.containerGraph.Purge(container.ID); err != nil {
log.Debugf("Unable to remove container from link graph: %s", err) logrus.Debugf("Unable to remove container from link graph: %s", err)
} }
if err := daemon.driver.Remove(container.ID); err != nil { if err := daemon.driver.Remove(container.ID); err != nil {

View File

@ -7,7 +7,7 @@ import (
"strings" "strings"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/daemon/execdriver/lxc" "github.com/docker/docker/daemon/execdriver/lxc"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
@ -188,7 +188,7 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) error {
return err return err
} }
log.Debugf("starting exec command %s in container %s", execConfig.ID, execConfig.Container.ID) logrus.Debugf("starting exec command %s in container %s", execConfig.ID, execConfig.Container.ID)
container := execConfig.Container container := execConfig.Container
container.LogEvent("exec_start: " + execConfig.ProcessConfig.Entrypoint + " " + strings.Join(execConfig.ProcessConfig.Arguments, " ")) container.LogEvent("exec_start: " + execConfig.ProcessConfig.Entrypoint + " " + strings.Join(execConfig.ProcessConfig.Arguments, " "))
@ -197,7 +197,7 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) error {
r, w := io.Pipe() r, w := io.Pipe()
go func() { go func() {
defer w.Close() defer w.Close()
defer log.Debugf("Closing buffered stdin pipe") defer logrus.Debugf("Closing buffered stdin pipe")
io.Copy(w, job.Stdin) io.Copy(w, job.Stdin)
}() }()
cStdin = r cStdin = r
@ -305,24 +305,24 @@ func (container *Container) monitorExec(execConfig *execConfig, callback execdri
pipes := execdriver.NewPipes(execConfig.StreamConfig.stdin, execConfig.StreamConfig.stdout, execConfig.StreamConfig.stderr, execConfig.OpenStdin) pipes := execdriver.NewPipes(execConfig.StreamConfig.stdin, execConfig.StreamConfig.stdout, execConfig.StreamConfig.stderr, execConfig.OpenStdin)
exitCode, err = container.daemon.Exec(container, execConfig, pipes, callback) exitCode, err = container.daemon.Exec(container, execConfig, pipes, callback)
if err != nil { if err != nil {
log.Errorf("Error running command in existing container %s: %s", container.ID, err) logrus.Errorf("Error running command in existing container %s: %s", container.ID, err)
} }
log.Debugf("Exec task in container %s exited with code %d", container.ID, exitCode) logrus.Debugf("Exec task in container %s exited with code %d", container.ID, exitCode)
if execConfig.OpenStdin { if execConfig.OpenStdin {
if err := execConfig.StreamConfig.stdin.Close(); err != nil { if err := execConfig.StreamConfig.stdin.Close(); err != nil {
log.Errorf("Error closing stdin while running in %s: %s", container.ID, err) logrus.Errorf("Error closing stdin while running in %s: %s", container.ID, err)
} }
} }
if err := execConfig.StreamConfig.stdout.Clean(); err != nil { if err := execConfig.StreamConfig.stdout.Clean(); err != nil {
log.Errorf("Error closing stdout while running in %s: %s", container.ID, err) logrus.Errorf("Error closing stdout while running in %s: %s", container.ID, err)
} }
if err := execConfig.StreamConfig.stderr.Clean(); err != nil { if err := execConfig.StreamConfig.stderr.Clean(); err != nil {
log.Errorf("Error closing stderr while running in %s: %s", container.ID, err) logrus.Errorf("Error closing stderr while running in %s: %s", container.ID, err)
} }
if execConfig.ProcessConfig.Terminal != nil { if execConfig.ProcessConfig.Terminal != nil {
if err := execConfig.ProcessConfig.Terminal.Close(); err != nil { if err := execConfig.ProcessConfig.Terminal.Close(); err != nil {
log.Errorf("Error closing terminal while running in container %s: %s", container.ID, err) logrus.Errorf("Error closing terminal while running in container %s: %s", container.ID, err)
} }
} }

View File

@ -16,7 +16,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
sysinfo "github.com/docker/docker/pkg/system" sysinfo "github.com/docker/docker/pkg/system"
"github.com/docker/docker/pkg/term" "github.com/docker/docker/pkg/term"
@ -193,7 +193,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
"unshare", "-m", "--", "/bin/sh", "-c", shellString, "unshare", "-m", "--", "/bin/sh", "-c", shellString,
} }
} }
log.Debugf("lxc params %s", params) logrus.Debugf("lxc params %s", params)
var ( var (
name = params[0] name = params[0]
arg = params[1:] arg = params[1:]
@ -263,7 +263,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
c.ContainerPid = pid c.ContainerPid = pid
if startCallback != nil { if startCallback != nil {
log.Debugf("Invoking startCallback") logrus.Debugf("Invoking startCallback")
startCallback(&c.ProcessConfig, pid) startCallback(&c.ProcessConfig, pid)
} }
@ -274,9 +274,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
if err == nil { if err == nil {
_, oomKill = <-oomKillNotification _, oomKill = <-oomKillNotification
log.Debugf("oomKill error %s waitErr %s", oomKill, waitErr) logrus.Debugf("oomKill error %s waitErr %s", oomKill, waitErr)
} else { } else {
log.Warnf("Your kernel does not support OOM notifications: %s", err) logrus.Warnf("Your kernel does not support OOM notifications: %s", err)
} }
// check oom error // check oom error
@ -351,11 +351,11 @@ func cgroupPaths(containerId string) (map[string]string, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Debugf("subsystems: %s", subsystems) logrus.Debugf("subsystems: %s", subsystems)
paths := make(map[string]string) paths := make(map[string]string)
for _, subsystem := range subsystems { for _, subsystem := range subsystems {
cgroupRoot, cgroupDir, err := findCgroupRootAndDir(subsystem) cgroupRoot, cgroupDir, err := findCgroupRootAndDir(subsystem)
log.Debugf("cgroup path %s %s", cgroupRoot, cgroupDir) logrus.Debugf("cgroup path %s %s", cgroupRoot, cgroupDir)
if err != nil { if err != nil {
//unsupported subystem //unsupported subystem
continue continue
@ -576,7 +576,7 @@ func (i *info) IsRunning() bool {
output, err := i.driver.getInfo(i.ID) output, err := i.driver.getInfo(i.ID)
if err != nil { if err != nil {
log.Errorf("Error getting info for lxc container %s: %s (%s)", i.ID, err, output) logrus.Errorf("Error getting info for lxc container %s: %s (%s)", i.ID, err, output)
return false return false
} }
if strings.Contains(string(output), "RUNNING") { if strings.Contains(string(output), "RUNNING") {

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"text/template" "text/template"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
nativeTemplate "github.com/docker/docker/daemon/execdriver/native/template" nativeTemplate "github.com/docker/docker/daemon/execdriver/native/template"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
@ -160,14 +160,14 @@ func escapeFstabSpaces(field string) string {
func keepCapabilities(adds []string, drops []string) ([]string, error) { func keepCapabilities(adds []string, drops []string) ([]string, error) {
container := nativeTemplate.New() container := nativeTemplate.New()
log.Debugf("adds %s drops %s\n", adds, drops) logrus.Debugf("adds %s drops %s\n", adds, drops)
caps, err := execdriver.TweakCapabilities(container.Capabilities, adds, drops) caps, err := execdriver.TweakCapabilities(container.Capabilities, adds, drops)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var newCaps []string var newCaps []string
for _, cap := range caps { for _, cap := range caps {
log.Debugf("cap %s\n", cap) logrus.Debugf("cap %s\n", cap)
realCap := execdriver.GetCapability(cap) realCap := execdriver.GetCapability(cap)
numCap := fmt.Sprintf("%d", realCap.Value) numCap := fmt.Sprintf("%d", realCap.Value)
newCaps = append(newCaps, numCap) newCaps = append(newCaps, numCap)
@ -181,7 +181,7 @@ func dropList(drops []string) ([]string, error) {
var newCaps []string var newCaps []string
for _, capName := range execdriver.GetAllCapabilities() { for _, capName := range execdriver.GetAllCapabilities() {
cap := execdriver.GetCapability(capName) cap := execdriver.GetCapability(capName)
log.Debugf("drop cap %s\n", cap.Key) logrus.Debugf("drop cap %s\n", cap.Key)
numCap := fmt.Sprintf("%d", cap.Value) numCap := fmt.Sprintf("%d", cap.Value)
newCaps = append(newCaps, numCap) newCaps = append(newCaps, numCap)
} }
@ -192,7 +192,7 @@ func dropList(drops []string) ([]string, error) {
func isDirectory(source string) string { func isDirectory(source string) string {
f, err := os.Stat(source) f, err := os.Stat(source)
log.Debugf("dir: %s\n", source) logrus.Debugf("dir: %s\n", source)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
return "dir" return "dir"

View File

@ -15,7 +15,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/reexec" "github.com/docker/docker/pkg/reexec"
sysinfo "github.com/docker/docker/pkg/system" sysinfo "github.com/docker/docker/pkg/system"
@ -159,7 +159,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
oomKillNotification, err := cont.NotifyOOM() oomKillNotification, err := cont.NotifyOOM()
if err != nil { if err != nil {
oomKillNotification = nil oomKillNotification = nil
log.Warnf("Your kernel does not support OOM notifications: %s", err) logrus.Warnf("Your kernel does not support OOM notifications: %s", err)
} }
waitF := p.Wait waitF := p.Wait
if nss := cont.Config().Namespaces; nss.Contains(configs.NEWPID) { if nss := cont.Config().Namespaces; nss.Contains(configs.NEWPID) {
@ -206,7 +206,7 @@ func waitInPIDHost(p *libcontainer.Process, c libcontainer.Container) func() (*o
for _, pid := range processes { for _, pid := range processes {
process, err := os.FindProcess(pid) process, err := os.FindProcess(pid)
if err != nil { if err != nil {
log.Errorf("Failed to kill process: %d", pid) logrus.Errorf("Failed to kill process: %d", pid)
continue continue
} }
process.Kill() process.Kill()

View File

@ -30,7 +30,7 @@ import (
"sync" "sync"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
@ -216,7 +216,7 @@ func (a *Driver) Remove(id string) error {
defer a.Unlock() defer a.Unlock()
if a.active[id] != 0 { if a.active[id] != 0 {
log.Errorf("Removing active id %s", id) logrus.Errorf("Removing active id %s", id)
} }
// Make sure the dir is umounted first // Make sure the dir is umounted first
@ -405,7 +405,7 @@ func (a *Driver) Cleanup() error {
for _, id := range ids { for _, id := range ids {
if err := a.unmount(id); err != nil { if err := a.unmount(id); err != nil {
log.Errorf("Unmounting %s: %s", stringid.TruncateID(id), err) logrus.Errorf("Unmounting %s: %s", stringid.TruncateID(id), err)
} }
} }

View File

@ -4,12 +4,12 @@ import (
"os/exec" "os/exec"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
func Unmount(target string) error { func Unmount(target string) error {
if err := exec.Command("auplink", target, "flush").Run(); err != nil { if err := exec.Command("auplink", target, "flush").Run(); err != nil {
log.Errorf("Couldn't run auplink before unmount: %s", err) logrus.Errorf("Couldn't run auplink before unmount: %s", err)
} }
if err := syscall.Unmount(target, 0); err != nil { if err := syscall.Unmount(target, 0); err != nil {
return err return err

View File

@ -18,7 +18,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/devicemapper" "github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
@ -205,7 +205,7 @@ func (devices *DeviceSet) ensureImage(name string, size int64) (string, error) {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
return "", err return "", err
} }
log.Debugf("Creating loopback file %s for device-manage use", filename) logrus.Debugf("Creating loopback file %s for device-manage use", filename)
file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, 0600) file, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE, 0600)
if err != nil { if err != nil {
return "", err return "", err
@ -320,21 +320,21 @@ func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo)
// Skip some of the meta files which are not device files. // Skip some of the meta files which are not device files.
if strings.HasSuffix(finfo.Name(), ".migrated") { if strings.HasSuffix(finfo.Name(), ".migrated") {
log.Debugf("Skipping file %s", path) logrus.Debugf("Skipping file %s", path)
return nil return nil
} }
if strings.HasPrefix(finfo.Name(), ".") { if strings.HasPrefix(finfo.Name(), ".") {
log.Debugf("Skipping file %s", path) logrus.Debugf("Skipping file %s", path)
return nil return nil
} }
if finfo.Name() == deviceSetMetaFile { if finfo.Name() == deviceSetMetaFile {
log.Debugf("Skipping file %s", path) logrus.Debugf("Skipping file %s", path)
return nil return nil
} }
log.Debugf("Loading data for file %s", path) logrus.Debugf("Loading data for file %s", path)
hash := finfo.Name() hash := finfo.Name()
if hash == "base" { if hash == "base" {
@ -347,7 +347,7 @@ func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo)
} }
if dinfo.DeviceId > MaxDeviceId { if dinfo.DeviceId > MaxDeviceId {
log.Errorf("Ignoring Invalid DeviceId=%d", dinfo.DeviceId) logrus.Errorf("Ignoring Invalid DeviceId=%d", dinfo.DeviceId)
return nil return nil
} }
@ -355,17 +355,17 @@ func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo)
devices.markDeviceIdUsed(dinfo.DeviceId) devices.markDeviceIdUsed(dinfo.DeviceId)
devices.Unlock() devices.Unlock()
log.Debugf("Added deviceId=%d to DeviceIdMap", dinfo.DeviceId) logrus.Debugf("Added deviceId=%d to DeviceIdMap", dinfo.DeviceId)
return nil return nil
} }
func (devices *DeviceSet) constructDeviceIdMap() error { func (devices *DeviceSet) constructDeviceIdMap() error {
log.Debugf("[deviceset] constructDeviceIdMap()") logrus.Debugf("[deviceset] constructDeviceIdMap()")
defer log.Debugf("[deviceset] constructDeviceIdMap() END") defer logrus.Debugf("[deviceset] constructDeviceIdMap() END")
var scan = func(path string, info os.FileInfo, err error) error { var scan = func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
log.Debugf("Can't walk the file %s", path) logrus.Debugf("Can't walk the file %s", path)
return nil return nil
} }
@ -381,7 +381,7 @@ func (devices *DeviceSet) constructDeviceIdMap() error {
} }
func (devices *DeviceSet) unregisterDevice(id int, hash string) error { func (devices *DeviceSet) unregisterDevice(id int, hash string) error {
log.Debugf("unregisterDevice(%v, %v)", id, hash) logrus.Debugf("unregisterDevice(%v, %v)", id, hash)
info := &DevInfo{ info := &DevInfo{
Hash: hash, Hash: hash,
DeviceId: id, DeviceId: id,
@ -392,7 +392,7 @@ func (devices *DeviceSet) unregisterDevice(id int, hash string) error {
devices.devicesLock.Unlock() devices.devicesLock.Unlock()
if err := devices.removeMetadata(info); err != nil { if err := devices.removeMetadata(info); err != nil {
log.Debugf("Error removing metadata: %s", err) logrus.Debugf("Error removing metadata: %s", err)
return err return err
} }
@ -400,7 +400,7 @@ func (devices *DeviceSet) unregisterDevice(id int, hash string) error {
} }
func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, transactionId uint64) (*DevInfo, error) { func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, transactionId uint64) (*DevInfo, error) {
log.Debugf("registerDevice(%v, %v)", id, hash) logrus.Debugf("registerDevice(%v, %v)", id, hash)
info := &DevInfo{ info := &DevInfo{
Hash: hash, Hash: hash,
DeviceId: id, DeviceId: id,
@ -426,7 +426,7 @@ func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, trans
} }
func (devices *DeviceSet) activateDeviceIfNeeded(info *DevInfo) error { func (devices *DeviceSet) activateDeviceIfNeeded(info *DevInfo) error {
log.Debugf("activateDeviceIfNeeded(%v)", info.Hash) logrus.Debugf("activateDeviceIfNeeded(%v)", info.Hash)
if devinfo, _ := devicemapper.GetInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 { if devinfo, _ := devicemapper.GetInfo(info.Name()); devinfo != nil && devinfo.Exists != 0 {
return nil return nil
@ -542,7 +542,7 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
} }
if err := devices.openTransaction(hash, deviceId); err != nil { if err := devices.openTransaction(hash, deviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId) logrus.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId)
devices.markDeviceIdFree(deviceId) devices.markDeviceIdFree(deviceId)
return nil, err return nil, err
} }
@ -554,7 +554,7 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
// happen. Now we have a mechianism to find // happen. Now we have a mechianism to find
// a free device Id. So something is not right. // a free device Id. So something is not right.
// Give a warning and continue. // Give a warning and continue.
log.Errorf("Device Id %d exists in pool but it is supposed to be unused", deviceId) logrus.Errorf("Device Id %d exists in pool but it is supposed to be unused", deviceId)
deviceId, err = devices.getNextFreeDeviceId() deviceId, err = devices.getNextFreeDeviceId()
if err != nil { if err != nil {
return nil, err return nil, err
@ -563,14 +563,14 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
devices.refreshTransaction(deviceId) devices.refreshTransaction(deviceId)
continue continue
} }
log.Debugf("Error creating device: %s", err) logrus.Debugf("Error creating device: %s", err)
devices.markDeviceIdFree(deviceId) devices.markDeviceIdFree(deviceId)
return nil, err return nil, err
} }
break break
} }
log.Debugf("Registering device (id %v) with FS size %v", deviceId, devices.baseFsSize) logrus.Debugf("Registering device (id %v) with FS size %v", deviceId, devices.baseFsSize)
info, err := devices.registerDevice(deviceId, hash, devices.baseFsSize, devices.OpenTransactionId) info, err := devices.registerDevice(deviceId, hash, devices.baseFsSize, devices.OpenTransactionId)
if err != nil { if err != nil {
_ = devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId) _ = devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
@ -594,7 +594,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
} }
if err := devices.openTransaction(hash, deviceId); err != nil { if err := devices.openTransaction(hash, deviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId) logrus.Debugf("Error opening transaction hash = %s deviceId = %d", hash, deviceId)
devices.markDeviceIdFree(deviceId) devices.markDeviceIdFree(deviceId)
return err return err
} }
@ -606,7 +606,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
// happen. Now we have a mechianism to find // happen. Now we have a mechianism to find
// a free device Id. So something is not right. // a free device Id. So something is not right.
// Give a warning and continue. // Give a warning and continue.
log.Errorf("Device Id %d exists in pool but it is supposed to be unused", deviceId) logrus.Errorf("Device Id %d exists in pool but it is supposed to be unused", deviceId)
deviceId, err = devices.getNextFreeDeviceId() deviceId, err = devices.getNextFreeDeviceId()
if err != nil { if err != nil {
return err return err
@ -615,7 +615,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
devices.refreshTransaction(deviceId) devices.refreshTransaction(deviceId)
continue continue
} }
log.Debugf("Error creating snap device: %s", err) logrus.Debugf("Error creating snap device: %s", err)
devices.markDeviceIdFree(deviceId) devices.markDeviceIdFree(deviceId)
return err return err
} }
@ -625,7 +625,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size, devices.OpenTransactionId); err != nil { if _, err := devices.registerDevice(deviceId, hash, baseInfo.Size, devices.OpenTransactionId); err != nil {
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId) devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
devices.markDeviceIdFree(deviceId) devices.markDeviceIdFree(deviceId)
log.Debugf("Error registering device: %s", err) logrus.Debugf("Error registering device: %s", err)
return err return err
} }
@ -660,7 +660,7 @@ func (devices *DeviceSet) setupBaseImage() error {
} }
if oldInfo != nil && !oldInfo.Initialized { if oldInfo != nil && !oldInfo.Initialized {
log.Debugf("Removing uninitialized base image") logrus.Debugf("Removing uninitialized base image")
if err := devices.DeleteDevice(""); err != nil { if err := devices.DeleteDevice(""); err != nil {
return err return err
} }
@ -681,7 +681,7 @@ func (devices *DeviceSet) setupBaseImage() error {
} }
} }
log.Debugf("Initializing base device-mapper thin volume") logrus.Debugf("Initializing base device-mapper thin volume")
// Create initial device // Create initial device
info, err := devices.createRegisterDevice("") info, err := devices.createRegisterDevice("")
@ -689,7 +689,7 @@ func (devices *DeviceSet) setupBaseImage() error {
return err return err
} }
log.Debugf("Creating filesystem on base device-mapper thin volume") logrus.Debugf("Creating filesystem on base device-mapper thin volume")
if err = devices.activateDeviceIfNeeded(info); err != nil { if err = devices.activateDeviceIfNeeded(info); err != nil {
return err return err
@ -730,7 +730,7 @@ func (devices *DeviceSet) DMLog(level int, file string, line int, dmError int, m
} }
// FIXME(vbatts) push this back into ./pkg/devicemapper/ // FIXME(vbatts) push this back into ./pkg/devicemapper/
log.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message) logrus.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
} }
func major(device uint64) uint64 { func major(device uint64) uint64 {
@ -846,24 +846,24 @@ func (devices *DeviceSet) removeTransactionMetaData() error {
} }
func (devices *DeviceSet) rollbackTransaction() error { func (devices *DeviceSet) rollbackTransaction() error {
log.Debugf("Rolling back open transaction: TransactionId=%d hash=%s device_id=%d", devices.OpenTransactionId, devices.DeviceIdHash, devices.DeviceId) logrus.Debugf("Rolling back open transaction: TransactionId=%d hash=%s device_id=%d", devices.OpenTransactionId, devices.DeviceIdHash, devices.DeviceId)
// A device id might have already been deleted before transaction // A device id might have already been deleted before transaction
// closed. In that case this call will fail. Just leave a message // closed. In that case this call will fail. Just leave a message
// in case of failure. // in case of failure.
if err := devicemapper.DeleteDevice(devices.getPoolDevName(), devices.DeviceId); err != nil { if err := devicemapper.DeleteDevice(devices.getPoolDevName(), devices.DeviceId); err != nil {
log.Errorf("Unable to delete device: %s", err) logrus.Errorf("Unable to delete device: %s", err)
} }
dinfo := &DevInfo{Hash: devices.DeviceIdHash} dinfo := &DevInfo{Hash: devices.DeviceIdHash}
if err := devices.removeMetadata(dinfo); err != nil { if err := devices.removeMetadata(dinfo); err != nil {
log.Errorf("Unable to remove metadata: %s", err) logrus.Errorf("Unable to remove metadata: %s", err)
} else { } else {
devices.markDeviceIdFree(devices.DeviceId) devices.markDeviceIdFree(devices.DeviceId)
} }
if err := devices.removeTransactionMetaData(); err != nil { if err := devices.removeTransactionMetaData(); err != nil {
log.Errorf("Unable to remove transaction meta file %s: %s", devices.transactionMetaFile(), err) logrus.Errorf("Unable to remove transaction meta file %s: %s", devices.transactionMetaFile(), err)
} }
return nil return nil
@ -883,7 +883,7 @@ func (devices *DeviceSet) processPendingTransaction() error {
// If open transaction Id is less than pool transaction Id, something // If open transaction Id is less than pool transaction Id, something
// is wrong. Bail out. // is wrong. Bail out.
if devices.OpenTransactionId < devices.TransactionId { if devices.OpenTransactionId < devices.TransactionId {
log.Errorf("Open Transaction id %d is less than pool transaction id %d", devices.OpenTransactionId, devices.TransactionId) logrus.Errorf("Open Transaction id %d is less than pool transaction id %d", devices.OpenTransactionId, devices.TransactionId)
return nil return nil
} }
@ -940,7 +940,7 @@ func (devices *DeviceSet) refreshTransaction(DeviceId int) error {
func (devices *DeviceSet) closeTransaction() error { func (devices *DeviceSet) closeTransaction() error {
if err := devices.updatePoolTransactionId(); err != nil { if err := devices.updatePoolTransactionId(); err != nil {
log.Debugf("Failed to close Transaction") logrus.Debugf("Failed to close Transaction")
return err return err
} }
return nil return nil
@ -963,9 +963,9 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
// https://github.com/docker/docker/issues/4036 // https://github.com/docker/docker/issues/4036
if supported := devicemapper.UdevSetSyncSupport(true); !supported { if supported := devicemapper.UdevSetSyncSupport(true); !supported {
log.Warnf("Udev sync is not supported. This will lead to unexpected behavior, data loss and errors") logrus.Warnf("Udev sync is not supported. This will lead to unexpected behavior, data loss and errors")
} }
log.Debugf("devicemapper: udev sync support: %v", devicemapper.UdevSyncSupported()) logrus.Debugf("devicemapper: udev sync support: %v", devicemapper.UdevSyncSupported())
if err := os.MkdirAll(devices.metadataDir(), 0700); err != nil && !os.IsExist(err) { if err := os.MkdirAll(devices.metadataDir(), 0700); err != nil && !os.IsExist(err) {
return err return err
@ -985,13 +985,13 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
// - The target of this device is at major <maj> and minor <min> // - The target of this device is at major <maj> and minor <min>
// - If <inode> is defined, use that file inside the device as a loopback image. Otherwise use the device itself. // - If <inode> is defined, use that file inside the device as a loopback image. Otherwise use the device itself.
devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(sysSt.Dev), minor(sysSt.Dev), sysSt.Ino) devices.devicePrefix = fmt.Sprintf("docker-%d:%d-%d", major(sysSt.Dev), minor(sysSt.Dev), sysSt.Ino)
log.Debugf("Generated prefix: %s", devices.devicePrefix) logrus.Debugf("Generated prefix: %s", devices.devicePrefix)
// Check for the existence of the thin-pool device // Check for the existence of the thin-pool device
log.Debugf("Checking for existence of the pool '%s'", devices.getPoolName()) logrus.Debugf("Checking for existence of the pool '%s'", devices.getPoolName())
info, err := devicemapper.GetInfo(devices.getPoolName()) info, err := devicemapper.GetInfo(devices.getPoolName())
if info == nil { if info == nil {
log.Debugf("Error device devicemapper.GetInfo: %s", err) logrus.Debugf("Error device devicemapper.GetInfo: %s", err)
return err return err
} }
@ -1007,7 +1007,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
// If the pool doesn't exist, create it // If the pool doesn't exist, create it
if info.Exists == 0 && devices.thinPoolDevice == "" { if info.Exists == 0 && devices.thinPoolDevice == "" {
log.Debugf("Pool doesn't exist. Creating it.") logrus.Debugf("Pool doesn't exist. Creating it.")
var ( var (
dataFile *os.File dataFile *os.File
@ -1029,7 +1029,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
data, err := devices.ensureImage("data", devices.dataLoopbackSize) data, err := devices.ensureImage("data", devices.dataLoopbackSize)
if err != nil { if err != nil {
log.Debugf("Error device ensureImage (data): %s", err) logrus.Debugf("Error device ensureImage (data): %s", err)
return err return err
} }
@ -1062,7 +1062,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize) metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize)
if err != nil { if err != nil {
log.Debugf("Error device ensureImage (metadata): %s", err) logrus.Debugf("Error device ensureImage (metadata): %s", err)
return err return err
} }
@ -1102,7 +1102,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
// Setup the base image // Setup the base image
if doInit { if doInit {
if err := devices.setupBaseImage(); err != nil { if err := devices.setupBaseImage(); err != nil {
log.Debugf("Error device setupBaseImage: %s", err) logrus.Debugf("Error device setupBaseImage: %s", err)
return err return err
} }
} }
@ -1111,8 +1111,8 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
} }
func (devices *DeviceSet) AddDevice(hash, baseHash string) error { func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
log.Debugf("[deviceset] AddDevice(hash=%s basehash=%s)", hash, baseHash) logrus.Debugf("[deviceset] AddDevice(hash=%s basehash=%s)", hash, baseHash)
defer log.Debugf("[deviceset] AddDevice(hash=%s basehash=%s) END", hash, baseHash) defer logrus.Debugf("[deviceset] AddDevice(hash=%s basehash=%s) END", hash, baseHash)
baseInfo, err := devices.lookupDevice(baseHash) baseInfo, err := devices.lookupDevice(baseHash)
if err != nil { if err != nil {
@ -1143,7 +1143,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
// manually // manually
if err := devices.activateDeviceIfNeeded(info); err == nil { if err := devices.activateDeviceIfNeeded(info); err == nil {
if err := devicemapper.BlockDeviceDiscard(info.DevName()); err != nil { if err := devicemapper.BlockDeviceDiscard(info.DevName()); err != nil {
log.Debugf("Error discarding block on device: %s (ignoring)", err) logrus.Debugf("Error discarding block on device: %s (ignoring)", err)
} }
} }
} }
@ -1151,18 +1151,18 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
devinfo, _ := devicemapper.GetInfo(info.Name()) devinfo, _ := devicemapper.GetInfo(info.Name())
if devinfo != nil && devinfo.Exists != 0 { if devinfo != nil && devinfo.Exists != 0 {
if err := devices.removeDeviceAndWait(info.Name()); err != nil { if err := devices.removeDeviceAndWait(info.Name()); err != nil {
log.Debugf("Error removing device: %s", err) logrus.Debugf("Error removing device: %s", err)
return err return err
} }
} }
if err := devices.openTransaction(info.Hash, info.DeviceId); err != nil { if err := devices.openTransaction(info.Hash, info.DeviceId); err != nil {
log.Debugf("Error opening transaction hash = %s deviceId = %d", "", info.DeviceId) logrus.Debugf("Error opening transaction hash = %s deviceId = %d", "", info.DeviceId)
return err return err
} }
if err := devicemapper.DeleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil { if err := devicemapper.DeleteDevice(devices.getPoolDevName(), info.DeviceId); err != nil {
log.Debugf("Error deleting device: %s", err) logrus.Debugf("Error deleting device: %s", err)
return err return err
} }
@ -1195,8 +1195,8 @@ func (devices *DeviceSet) DeleteDevice(hash string) error {
} }
func (devices *DeviceSet) deactivatePool() error { func (devices *DeviceSet) deactivatePool() error {
log.Debugf("[devmapper] deactivatePool()") logrus.Debugf("[devmapper] deactivatePool()")
defer log.Debugf("[devmapper] deactivatePool END") defer logrus.Debugf("[devmapper] deactivatePool END")
devname := devices.getPoolDevName() devname := devices.getPoolDevName()
devinfo, err := devicemapper.GetInfo(devname) devinfo, err := devicemapper.GetInfo(devname)
@ -1205,7 +1205,7 @@ func (devices *DeviceSet) deactivatePool() error {
} }
if d, err := devicemapper.GetDeps(devname); err == nil { if d, err := devicemapper.GetDeps(devname); err == nil {
// Access to more Debug output // Access to more Debug output
log.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d) logrus.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d)
} }
if devinfo.Exists != 0 { if devinfo.Exists != 0 {
return devicemapper.RemoveDevice(devname) return devicemapper.RemoveDevice(devname)
@ -1215,13 +1215,13 @@ func (devices *DeviceSet) deactivatePool() error {
} }
func (devices *DeviceSet) deactivateDevice(info *DevInfo) error { func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
log.Debugf("[devmapper] deactivateDevice(%s)", info.Hash) logrus.Debugf("[devmapper] deactivateDevice(%s)", info.Hash)
defer log.Debugf("[devmapper] deactivateDevice END(%s)", info.Hash) defer logrus.Debugf("[devmapper] deactivateDevice END(%s)", info.Hash)
// Wait for the unmount to be effective, // Wait for the unmount to be effective,
// by watching the value of Info.OpenCount for the device // by watching the value of Info.OpenCount for the device
if err := devices.waitClose(info); err != nil { if err := devices.waitClose(info); err != nil {
log.Errorf("Error waiting for device %s to close: %s", info.Hash, err) logrus.Errorf("Error waiting for device %s to close: %s", info.Hash, err)
} }
devinfo, err := devicemapper.GetInfo(info.Name()) devinfo, err := devicemapper.GetInfo(info.Name())
@ -1271,8 +1271,8 @@ func (devices *DeviceSet) removeDeviceAndWait(devname string) error {
// a) the device registered at <device_set_prefix>-<hash> is removed, // a) the device registered at <device_set_prefix>-<hash> is removed,
// or b) the 10 second timeout expires. // or b) the 10 second timeout expires.
func (devices *DeviceSet) waitRemove(devname string) error { func (devices *DeviceSet) waitRemove(devname string) error {
log.Debugf("[deviceset %s] waitRemove(%s)", devices.devicePrefix, devname) logrus.Debugf("[deviceset %s] waitRemove(%s)", devices.devicePrefix, devname)
defer log.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname) defer logrus.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
i := 0 i := 0
for ; i < 1000; i++ { for ; i < 1000; i++ {
devinfo, err := devicemapper.GetInfo(devname) devinfo, err := devicemapper.GetInfo(devname)
@ -1282,7 +1282,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
return nil return nil
} }
if i%100 == 0 { if i%100 == 0 {
log.Debugf("Waiting for removal of %s: exists=%d", devname, devinfo.Exists) logrus.Debugf("Waiting for removal of %s: exists=%d", devname, devinfo.Exists)
} }
if devinfo.Exists == 0 { if devinfo.Exists == 0 {
break break
@ -1309,7 +1309,7 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
return err return err
} }
if i%100 == 0 { if i%100 == 0 {
log.Debugf("Waiting for unmount of %s: opencount=%d", info.Hash, devinfo.OpenCount) logrus.Debugf("Waiting for unmount of %s: opencount=%d", info.Hash, devinfo.OpenCount)
} }
if devinfo.OpenCount == 0 { if devinfo.OpenCount == 0 {
break break
@ -1325,9 +1325,9 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
} }
func (devices *DeviceSet) Shutdown() error { func (devices *DeviceSet) Shutdown() error {
log.Debugf("[deviceset %s] Shutdown()", devices.devicePrefix) logrus.Debugf("[deviceset %s] Shutdown()", devices.devicePrefix)
log.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root) logrus.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
defer log.Debugf("[deviceset %s] Shutdown() END", devices.devicePrefix) defer logrus.Debugf("[deviceset %s] Shutdown() END", devices.devicePrefix)
var devs []*DevInfo var devs []*DevInfo
@ -1344,12 +1344,12 @@ func (devices *DeviceSet) Shutdown() error {
// container. This means it'll go away from the global scope directly, // container. This means it'll go away from the global scope directly,
// and the device will be released when that container dies. // and the device will be released when that container dies.
if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil { if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil {
log.Debugf("Shutdown unmounting %s, error: %s", info.mountPath, err) logrus.Debugf("Shutdown unmounting %s, error: %s", info.mountPath, err)
} }
devices.Lock() devices.Lock()
if err := devices.deactivateDevice(info); err != nil { if err := devices.deactivateDevice(info); err != nil {
log.Debugf("Shutdown deactivate %s , error: %s", info.Hash, err) logrus.Debugf("Shutdown deactivate %s , error: %s", info.Hash, err)
} }
devices.Unlock() devices.Unlock()
} }
@ -1361,7 +1361,7 @@ func (devices *DeviceSet) Shutdown() error {
info.lock.Lock() info.lock.Lock()
devices.Lock() devices.Lock()
if err := devices.deactivateDevice(info); err != nil { if err := devices.deactivateDevice(info); err != nil {
log.Debugf("Shutdown deactivate base , error: %s", err) logrus.Debugf("Shutdown deactivate base , error: %s", err)
} }
devices.Unlock() devices.Unlock()
info.lock.Unlock() info.lock.Unlock()
@ -1370,7 +1370,7 @@ func (devices *DeviceSet) Shutdown() error {
devices.Lock() devices.Lock()
if devices.thinPoolDevice == "" { if devices.thinPoolDevice == "" {
if err := devices.deactivatePool(); err != nil { if err := devices.deactivatePool(); err != nil {
log.Debugf("Shutdown deactivate pool , error: %s", err) logrus.Debugf("Shutdown deactivate pool , error: %s", err)
} }
} }
@ -1437,8 +1437,8 @@ func (devices *DeviceSet) MountDevice(hash, path, mountLabel string) error {
} }
func (devices *DeviceSet) UnmountDevice(hash string) error { func (devices *DeviceSet) UnmountDevice(hash string) error {
log.Debugf("[devmapper] UnmountDevice(hash=%s)", hash) logrus.Debugf("[devmapper] UnmountDevice(hash=%s)", hash)
defer log.Debugf("[devmapper] UnmountDevice(hash=%s) END", hash) defer logrus.Debugf("[devmapper] UnmountDevice(hash=%s) END", hash)
info, err := devices.lookupDevice(hash) info, err := devices.lookupDevice(hash)
if err != nil { if err != nil {
@ -1460,11 +1460,11 @@ func (devices *DeviceSet) UnmountDevice(hash string) error {
return nil return nil
} }
log.Debugf("[devmapper] Unmount(%s)", info.mountPath) logrus.Debugf("[devmapper] Unmount(%s)", info.mountPath)
if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil { if err := syscall.Unmount(info.mountPath, syscall.MNT_DETACH); err != nil {
return err return err
} }
log.Debugf("[devmapper] Unmount done") logrus.Debugf("[devmapper] Unmount done")
if err := devices.deactivateDevice(info); err != nil { if err := devices.deactivateDevice(info); err != nil {
return err return err
@ -1586,7 +1586,7 @@ func (devices *DeviceSet) getUnderlyingAvailableSpace(loopFile string) (uint64,
buf := new(syscall.Statfs_t) buf := new(syscall.Statfs_t)
err := syscall.Statfs(loopFile, buf) err := syscall.Statfs(loopFile, buf)
if err != nil { if err != nil {
log.Warnf("Couldn't stat loopfile filesystem %v: %v", loopFile, err) logrus.Warnf("Couldn't stat loopfile filesystem %v: %v", loopFile, err)
return 0, err return 0, err
} }
return buf.Bfree * uint64(buf.Bsize), nil return buf.Bfree * uint64(buf.Bsize), nil
@ -1596,7 +1596,7 @@ func (devices *DeviceSet) isRealFile(loopFile string) (bool, error) {
if loopFile != "" { if loopFile != "" {
fi, err := os.Stat(loopFile) fi, err := os.Stat(loopFile)
if err != nil { if err != nil {
log.Warnf("Couldn't stat loopfile %v: %v", loopFile, err) logrus.Warnf("Couldn't stat loopfile %v: %v", loopFile, err)
return false, err return false, err
} }
return fi.Mode().IsRegular(), nil return fi.Mode().IsRegular(), nil

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"path" "path"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/devicemapper" "github.com/docker/docker/pkg/devicemapper"
"github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/mount"
@ -164,7 +164,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
func (d *Driver) Put(id string) error { func (d *Driver) Put(id string) error {
err := d.DeviceSet.UnmountDevice(id) err := d.DeviceSet.UnmountDevice(id)
if err != nil { if err != nil {
log.Errorf("Error unmounting device %s: %s", id, err) logrus.Errorf("Error unmounting device %s: %s", id, err)
} }
return err return err
} }

View File

@ -7,7 +7,7 @@ import (
"path" "path"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
) )
@ -184,6 +184,6 @@ func checkPriorDriver(name, root string) {
} }
} }
if len(priorDrivers) > 0 { if len(priorDrivers) > 0 {
log.Warnf("Graphdriver %s selected. Your graphdriver directory %s already contains data managed by other graphdrivers: %s", name, root, strings.Join(priorDrivers, ",")) logrus.Warnf("Graphdriver %s selected. Your graphdriver directory %s already contains data managed by other graphdrivers: %s", name, root, strings.Join(priorDrivers, ","))
} }
} }

View File

@ -5,7 +5,7 @@ package graphdriver
import ( import (
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/ioutils" "github.com/docker/docker/pkg/ioutils"
@ -120,11 +120,11 @@ func (gdw *naiveDiffDriver) ApplyDiff(id, parent string, diff archive.ArchiveRea
defer driver.Put(id) defer driver.Put(id)
start := time.Now().UTC() start := time.Now().UTC()
log.Debugf("Start untar layer") logrus.Debugf("Start untar layer")
if size, err = chrootarchive.ApplyLayer(layerFs, diff); err != nil { if size, err = chrootarchive.ApplyLayer(layerFs, diff); err != nil {
return return
} }
log.Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds()) logrus.Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
return return
} }

View File

@ -12,7 +12,7 @@ import (
"sync" "sync"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
@ -113,13 +113,13 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
// check if they are running over btrfs or aufs // check if they are running over btrfs or aufs
switch fsMagic { switch fsMagic {
case graphdriver.FsMagicBtrfs: case graphdriver.FsMagicBtrfs:
log.Error("'overlay' is not supported over btrfs.") logrus.Error("'overlay' is not supported over btrfs.")
return nil, graphdriver.ErrIncompatibleFS return nil, graphdriver.ErrIncompatibleFS
case graphdriver.FsMagicAufs: case graphdriver.FsMagicAufs:
log.Error("'overlay' is not supported over aufs.") logrus.Error("'overlay' is not supported over aufs.")
return nil, graphdriver.ErrIncompatibleFS return nil, graphdriver.ErrIncompatibleFS
case graphdriver.FsMagicZfs: case graphdriver.FsMagicZfs:
log.Error("'overlay' is not supported over zfs.") logrus.Error("'overlay' is not supported over zfs.")
return nil, graphdriver.ErrIncompatibleFS return nil, graphdriver.ErrIncompatibleFS
} }
@ -153,7 +153,7 @@ func supportsOverlay() error {
return nil return nil
} }
} }
log.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.") logrus.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.")
return graphdriver.ErrNotSupported return graphdriver.ErrNotSupported
} }
@ -317,7 +317,7 @@ func (d *Driver) Put(id string) error {
mount := d.active[id] mount := d.active[id]
if mount == nil { if mount == nil {
log.Debugf("Put on a non-mounted device %s", id) logrus.Debugf("Put on a non-mounted device %s", id)
return nil return nil
} }
@ -330,7 +330,7 @@ func (d *Driver) Put(id string) error {
if mount.mounted { if mount.mounted {
err := syscall.Unmount(mount.path, 0) err := syscall.Unmount(mount.path, 0)
if err != nil { if err != nil {
log.Debugf("Failed to unmount %s overlay: %v", id, err) logrus.Debugf("Failed to unmount %s overlay: %v", id, err)
} }
return err return err
} }

View File

@ -5,7 +5,7 @@ import (
"runtime" "runtime"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/parsers/kernel" "github.com/docker/docker/pkg/parsers/kernel"
@ -33,7 +33,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) error {
operatingSystem = s operatingSystem = s
} }
if inContainer, err := operatingsystem.IsContainerized(); err != nil { if inContainer, err := operatingsystem.IsContainerized(); err != nil {
log.Errorf("Could not determine if daemon is containerized: %v", err) logrus.Errorf("Could not determine if daemon is containerized: %v", err)
operatingSystem += " (error determining if containerized)" operatingSystem += " (error determining if containerized)"
} else if inContainer { } else if inContainer {
operatingSystem += " (containerized)" operatingSystem += " (containerized)"
@ -41,7 +41,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) error {
meminfo, err := system.ReadMemInfo() meminfo, err := system.ReadMemInfo()
if err != nil { if err != nil {
log.Errorf("Could not read system memory info: %v", err) logrus.Errorf("Could not read system memory info: %v", err)
} }
// if we still have the original dockerinit binary from before we copied it locally, let's return the path to that, since that's more intuitive (the copied path is trivial to derive by hand given VERSION) // if we still have the original dockerinit binary from before we copied it locally, let's return the path to that, since that's more intuitive (the copied path is trivial to derive by hand given VERSION)

View File

@ -9,7 +9,7 @@ import (
"strconv" "strconv"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
"github.com/docker/docker/pkg/tailfile" "github.com/docker/docker/pkg/tailfile"
@ -50,31 +50,31 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
cLog, err := container.ReadLog("json") cLog, err := container.ReadLog("json")
if err != nil && os.IsNotExist(err) { if err != nil && os.IsNotExist(err) {
// Legacy logs // Legacy logs
log.Debugf("Old logs format") logrus.Debugf("Old logs format")
if stdout { if stdout {
cLog, err := container.ReadLog("stdout") cLog, err := container.ReadLog("stdout")
if err != nil { if err != nil {
log.Errorf("Error reading logs (stdout): %s", err) logrus.Errorf("Error reading logs (stdout): %s", err)
} else if _, err := io.Copy(job.Stdout, cLog); err != nil { } else if _, err := io.Copy(job.Stdout, cLog); err != nil {
log.Errorf("Error streaming logs (stdout): %s", err) logrus.Errorf("Error streaming logs (stdout): %s", err)
} }
} }
if stderr { if stderr {
cLog, err := container.ReadLog("stderr") cLog, err := container.ReadLog("stderr")
if err != nil { if err != nil {
log.Errorf("Error reading logs (stderr): %s", err) logrus.Errorf("Error reading logs (stderr): %s", err)
} else if _, err := io.Copy(job.Stderr, cLog); err != nil { } else if _, err := io.Copy(job.Stderr, cLog); err != nil {
log.Errorf("Error streaming logs (stderr): %s", err) logrus.Errorf("Error streaming logs (stderr): %s", err)
} }
} }
} else if err != nil { } else if err != nil {
log.Errorf("Error reading logs (json): %s", err) logrus.Errorf("Error reading logs (json): %s", err)
} else { } else {
if tail != "all" { if tail != "all" {
var err error var err error
lines, err = strconv.Atoi(tail) lines, err = strconv.Atoi(tail)
if err != nil { if err != nil {
log.Errorf("Failed to parse tail %s, error: %v, show all logs", tail, err) logrus.Errorf("Failed to parse tail %s, error: %v, show all logs", tail, err)
lines = -1 lines = -1
} }
} }
@ -97,7 +97,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
if err := dec.Decode(l); err == io.EOF { if err := dec.Decode(l); err == io.EOF {
break break
} else if err != nil { } else if err != nil {
log.Errorf("Error streaming logs: %s", err) logrus.Errorf("Error streaming logs: %s", err)
break break
} }
logLine := l.Log logLine := l.Log
@ -143,7 +143,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
for err := range errors { for err := range errors {
if err != nil { if err != nil {
log.Errorf("%s", err) logrus.Errorf("%s", err)
} }
} }

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/runconfig" "github.com/docker/docker/runconfig"
@ -89,7 +89,7 @@ func (m *containerMonitor) Close() error {
// because they share same runconfig and change image. Must be fixed // because they share same runconfig and change image. Must be fixed
// in builder/builder.go // in builder/builder.go
if err := m.container.toDisk(); err != nil { if err := m.container.toDisk(); err != nil {
log.Errorf("Error dumping container %s state to disk: %s", m.container.ID, err) logrus.Errorf("Error dumping container %s state to disk: %s", m.container.ID, err)
return err return err
} }
@ -145,7 +145,7 @@ func (m *containerMonitor) Start() error {
return err return err
} }
log.Errorf("Error running container: %s", err) logrus.Errorf("Error running container: %s", err)
} }
// here container.Lock is already lost // here container.Lock is already lost
@ -229,7 +229,7 @@ func (m *containerMonitor) shouldRestart(exitCode int) bool {
case "on-failure": case "on-failure":
// the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count // the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count
if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount > max { if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount > max {
log.Debugf("stopping restart of container %s because maximum failure could of %d has been reached", logrus.Debugf("stopping restart of container %s because maximum failure could of %d has been reached",
stringid.TruncateID(m.container.ID), max) stringid.TruncateID(m.container.ID), max)
return false return false
} }
@ -263,7 +263,7 @@ func (m *containerMonitor) callback(processConfig *execdriver.ProcessConfig, pid
} }
if err := m.container.ToDisk(); err != nil { if err := m.container.ToDisk(); err != nil {
log.Debugf("%s", err) logrus.Debugf("%s", err)
} }
} }
@ -279,21 +279,21 @@ func (m *containerMonitor) resetContainer(lock bool) {
if container.Config.OpenStdin { if container.Config.OpenStdin {
if err := container.stdin.Close(); err != nil { if err := container.stdin.Close(); err != nil {
log.Errorf("%s: Error close stdin: %s", container.ID, err) logrus.Errorf("%s: Error close stdin: %s", container.ID, err)
} }
} }
if err := container.stdout.Clean(); err != nil { if err := container.stdout.Clean(); err != nil {
log.Errorf("%s: Error close stdout: %s", container.ID, err) logrus.Errorf("%s: Error close stdout: %s", container.ID, err)
} }
if err := container.stderr.Clean(); err != nil { if err := container.stderr.Clean(); err != nil {
log.Errorf("%s: Error close stderr: %s", container.ID, err) logrus.Errorf("%s: Error close stderr: %s", container.ID, err)
} }
if container.command != nil && container.command.ProcessConfig.Terminal != nil { if container.command != nil && container.command.ProcessConfig.Terminal != nil {
if err := container.command.ProcessConfig.Terminal.Close(); err != nil { if err := container.command.ProcessConfig.Terminal.Close(); err != nil {
log.Errorf("%s: Error closing terminal: %s", container.ID, err) logrus.Errorf("%s: Error closing terminal: %s", container.ID, err)
} }
} }
@ -311,7 +311,7 @@ func (m *containerMonitor) resetContainer(lock bool) {
}() }()
select { select {
case <-time.After(1 * time.Second): case <-time.After(1 * time.Second):
log.Warnf("Logger didn't exit in time: logs may be truncated") logrus.Warnf("Logger didn't exit in time: logs may be truncated")
case <-exit: case <-exit:
} }
} }

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver" "github.com/docker/docker/daemon/networkdriver"
"github.com/docker/docker/daemon/networkdriver/ipallocator" "github.com/docker/docker/daemon/networkdriver/ipallocator"
"github.com/docker/docker/daemon/networkdriver/portmapper" "github.com/docker/docker/daemon/networkdriver/portmapper"
@ -132,9 +132,9 @@ func InitDriver(job *engine.Job) error {
if fixedCIDRv6 != "" { if fixedCIDRv6 != "" {
// Setting route to global IPv6 subnet // Setting route to global IPv6 subnet
log.Infof("Adding route to IPv6 network %q via device %q", fixedCIDRv6, bridgeIface) logrus.Infof("Adding route to IPv6 network %q via device %q", fixedCIDRv6, bridgeIface)
if err := netlink.AddRoute(fixedCIDRv6, "", "", bridgeIface); err != nil { if err := netlink.AddRoute(fixedCIDRv6, "", "", bridgeIface); err != nil {
log.Fatalf("Could not add route to IPv6 network %q via device %q", fixedCIDRv6, bridgeIface) logrus.Fatalf("Could not add route to IPv6 network %q via device %q", fixedCIDRv6, bridgeIface)
} }
} }
} else { } else {
@ -207,16 +207,16 @@ func InitDriver(job *engine.Job) error {
if ipForward { if ipForward {
// Enable IPv4 forwarding // Enable IPv4 forwarding
if err := ioutil.WriteFile("/proc/sys/net/ipv4/ip_forward", []byte{'1', '\n'}, 0644); err != nil { if err := ioutil.WriteFile("/proc/sys/net/ipv4/ip_forward", []byte{'1', '\n'}, 0644); err != nil {
log.Warnf("WARNING: unable to enable IPv4 forwarding: %s\n", err) logrus.Warnf("WARNING: unable to enable IPv4 forwarding: %s\n", err)
} }
if fixedCIDRv6 != "" { if fixedCIDRv6 != "" {
// Enable IPv6 forwarding // Enable IPv6 forwarding
if err := ioutil.WriteFile("/proc/sys/net/ipv6/conf/default/forwarding", []byte{'1', '\n'}, 0644); err != nil { if err := ioutil.WriteFile("/proc/sys/net/ipv6/conf/default/forwarding", []byte{'1', '\n'}, 0644); err != nil {
log.Warnf("WARNING: unable to enable IPv6 default forwarding: %s\n", err) logrus.Warnf("WARNING: unable to enable IPv6 default forwarding: %s\n", err)
} }
if err := ioutil.WriteFile("/proc/sys/net/ipv6/conf/all/forwarding", []byte{'1', '\n'}, 0644); err != nil { if err := ioutil.WriteFile("/proc/sys/net/ipv6/conf/all/forwarding", []byte{'1', '\n'}, 0644); err != nil {
log.Warnf("WARNING: unable to enable IPv6 all forwarding: %s\n", err) logrus.Warnf("WARNING: unable to enable IPv6 all forwarding: %s\n", err)
} }
} }
} }
@ -244,7 +244,7 @@ func InitDriver(job *engine.Job) error {
if err != nil { if err != nil {
return err return err
} }
log.Debugf("Subnet: %v", subnet) logrus.Debugf("Subnet: %v", subnet)
if err := ipAllocator.RegisterSubnet(bridgeIPv4Network, subnet); err != nil { if err := ipAllocator.RegisterSubnet(bridgeIPv4Network, subnet); err != nil {
return err return err
} }
@ -255,7 +255,7 @@ func InitDriver(job *engine.Job) error {
if err != nil { if err != nil {
return err return err
} }
log.Debugf("Subnet: %v", subnet) logrus.Debugf("Subnet: %v", subnet)
if err := ipAllocator.RegisterSubnet(subnet, subnet); err != nil { if err := ipAllocator.RegisterSubnet(subnet, subnet); err != nil {
return err return err
} }
@ -307,7 +307,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
iptables.Raw(append([]string{"-D", "FORWARD"}, acceptArgs...)...) iptables.Raw(append([]string{"-D", "FORWARD"}, acceptArgs...)...)
if !iptables.Exists(iptables.Filter, "FORWARD", dropArgs...) { if !iptables.Exists(iptables.Filter, "FORWARD", dropArgs...) {
log.Debugf("Disable inter-container communication") logrus.Debugf("Disable inter-container communication")
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, dropArgs...)...); err != nil { if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, dropArgs...)...); err != nil {
return fmt.Errorf("Unable to prevent intercontainer communication: %s", err) return fmt.Errorf("Unable to prevent intercontainer communication: %s", err)
} else if len(output) != 0 { } else if len(output) != 0 {
@ -318,7 +318,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
iptables.Raw(append([]string{"-D", "FORWARD"}, dropArgs...)...) iptables.Raw(append([]string{"-D", "FORWARD"}, dropArgs...)...)
if !iptables.Exists(iptables.Filter, "FORWARD", acceptArgs...) { if !iptables.Exists(iptables.Filter, "FORWARD", acceptArgs...) {
log.Debugf("Enable inter-container communication") logrus.Debugf("Enable inter-container communication")
if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, acceptArgs...)...); err != nil { if output, err := iptables.Raw(append([]string{"-I", "FORWARD"}, acceptArgs...)...); err != nil {
return fmt.Errorf("Unable to allow intercontainer communication: %s", err) return fmt.Errorf("Unable to allow intercontainer communication: %s", err)
} else if len(output) != 0 { } else if len(output) != 0 {
@ -384,7 +384,7 @@ func configureBridge(bridgeIP string, bridgeIPv6 string, enableIPv6 bool) error
ifaceAddr = addr ifaceAddr = addr
break break
} else { } else {
log.Debugf("%s %s", addr, err) logrus.Debugf("%s %s", addr, err)
} }
} }
} }
@ -393,7 +393,7 @@ func configureBridge(bridgeIP string, bridgeIPv6 string, enableIPv6 bool) error
if ifaceAddr == "" { if ifaceAddr == "" {
return fmt.Errorf("Could not find a free IP address range for interface '%s'. Please configure its address manually and run 'docker -b %s'", bridgeIface, bridgeIface) return fmt.Errorf("Could not find a free IP address range for interface '%s'. Please configure its address manually and run 'docker -b %s'", bridgeIface, bridgeIface)
} }
log.Debugf("Creating bridge %s with network %s", bridgeIface, ifaceAddr) logrus.Debugf("Creating bridge %s with network %s", bridgeIface, ifaceAddr)
if err := createBridgeIface(bridgeIface); err != nil { if err := createBridgeIface(bridgeIface); err != nil {
// The bridge may already exist, therefore we can ignore an "exists" error // The bridge may already exist, therefore we can ignore an "exists" error
@ -457,7 +457,7 @@ func createBridgeIface(name string) error {
// Only set the bridge's mac address if the kernel version is > 3.3 // Only set the bridge's mac address if the kernel version is > 3.3
// before that it was not supported // before that it was not supported
setBridgeMacAddr := err == nil && (kv.Kernel >= 3 && kv.Major >= 3) setBridgeMacAddr := err == nil && (kv.Kernel >= 3 && kv.Major >= 3)
log.Debugf("setting bridge mac address = %v", setBridgeMacAddr) logrus.Debugf("setting bridge mac address = %v", setBridgeMacAddr)
return netlink.CreateBridge(name, setBridgeMacAddr) return netlink.CreateBridge(name, setBridgeMacAddr)
} }
@ -533,10 +533,10 @@ func Allocate(job *engine.Job) error {
globalIPv6, err = ipAllocator.RequestIP(globalIPv6Network, requestedIPv6) globalIPv6, err = ipAllocator.RequestIP(globalIPv6Network, requestedIPv6)
if err != nil { if err != nil {
log.Errorf("Allocator: RequestIP v6: %v", err) logrus.Errorf("Allocator: RequestIP v6: %v", err)
return err return err
} }
log.Infof("Allocated IPv6 %s", globalIPv6) logrus.Infof("Allocated IPv6 %s", globalIPv6)
} }
out := engine.Env{} out := engine.Env{}
@ -588,16 +588,16 @@ func Release(job *engine.Job) error {
for _, nat := range containerInterface.PortMappings { for _, nat := range containerInterface.PortMappings {
if err := portmapper.Unmap(nat); err != nil { if err := portmapper.Unmap(nat); err != nil {
log.Infof("Unable to unmap port %s: %s", nat, err) logrus.Infof("Unable to unmap port %s: %s", nat, err)
} }
} }
if err := ipAllocator.ReleaseIP(bridgeIPv4Network, containerInterface.IP); err != nil { if err := ipAllocator.ReleaseIP(bridgeIPv4Network, containerInterface.IP); err != nil {
log.Infof("Unable to release IPv4 %s", err) logrus.Infof("Unable to release IPv4 %s", err)
} }
if globalIPv6Network != nil { if globalIPv6Network != nil {
if err := ipAllocator.ReleaseIP(globalIPv6Network, containerInterface.IPv6); err != nil { if err := ipAllocator.ReleaseIP(globalIPv6Network, containerInterface.IPv6); err != nil {
log.Infof("Unable to release IPv6 %s", err) logrus.Infof("Unable to release IPv6 %s", err)
} }
} }
return nil return nil
@ -650,10 +650,10 @@ func AllocatePort(job *engine.Job) error {
// There is no point in immediately retrying to map an explicitly // There is no point in immediately retrying to map an explicitly
// chosen port. // chosen port.
if hostPort != 0 { if hostPort != 0 {
log.Warnf("Failed to allocate and map port %d: %s", hostPort, err) logrus.Warnf("Failed to allocate and map port %d: %s", hostPort, err)
break break
} }
log.Warnf("Failed to allocate and map port: %s, retry: %d", err, i+1) logrus.Warnf("Failed to allocate and map port: %s, retry: %d", err, i+1)
} }
if err != nil { if err != nil {

View File

@ -6,7 +6,7 @@ import (
"net" "net"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver" "github.com/docker/docker/daemon/networkdriver"
) )
@ -157,7 +157,7 @@ func ipToBigInt(ip net.IP) *big.Int {
return x.SetBytes(ip6) return x.SetBytes(ip6)
} }
log.Errorf("ipToBigInt: Wrong IP length! %s", ip) logrus.Errorf("ipToBigInt: Wrong IP length! %s", ip)
return nil return nil
} }

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
const ( const (
@ -87,7 +87,7 @@ func init() {
file, err := os.Open(portRangeKernelParam) file, err := os.Open(portRangeKernelParam)
if err != nil { if err != nil {
log.Warnf("port allocator - %s due to error: %v", portRangeFallback, err) logrus.Warnf("port allocator - %s due to error: %v", portRangeFallback, err)
return return
} }
var start, end int var start, end int
@ -96,7 +96,7 @@ func init() {
if err == nil { if err == nil {
err = fmt.Errorf("unexpected count of parsed numbers (%d)", n) err = fmt.Errorf("unexpected count of parsed numbers (%d)", n)
} }
log.Errorf("port allocator - failed to parse system ephemeral port range from %s - %s: %v", portRangeKernelParam, portRangeFallback, err) logrus.Errorf("port allocator - failed to parse system ephemeral port range from %s - %s: %v", portRangeKernelParam, portRangeFallback, err)
return return
} }
beginPortRange = start beginPortRange = start

View File

@ -6,7 +6,7 @@ import (
"net" "net"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/networkdriver/portallocator" "github.com/docker/docker/daemon/networkdriver/portallocator"
"github.com/docker/docker/pkg/iptables" "github.com/docker/docker/pkg/iptables"
) )
@ -156,7 +156,7 @@ func (pm *PortMapper) Unmap(host net.Addr) error {
containerIP, containerPort := getIPAndPort(data.container) containerIP, containerPort := getIPAndPort(data.container)
hostIP, hostPort := getIPAndPort(data.host) hostIP, hostPort := getIPAndPort(data.host)
if err := pm.forward(iptables.Delete, data.proto, hostIP, hostPort, containerIP.String(), containerPort); err != nil { if err := pm.forward(iptables.Delete, data.proto, hostIP, hostPort, containerIP.String(), containerPort); err != nil {
log.Errorf("Error on iptables delete: %s", err) logrus.Errorf("Error on iptables delete: %s", err)
} }
switch a := host.(type) { switch a := host.(type) {

View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/pubsub" "github.com/docker/docker/pkg/pubsub"
"github.com/docker/libcontainer/system" "github.com/docker/libcontainer/system"
@ -80,13 +80,13 @@ func (s *statsCollector) run() {
for container, publisher := range s.publishers { for container, publisher := range s.publishers {
systemUsage, err := s.getSystemCpuUsage() systemUsage, err := s.getSystemCpuUsage()
if err != nil { if err != nil {
log.Errorf("collecting system cpu usage for %s: %v", container.ID, err) logrus.Errorf("collecting system cpu usage for %s: %v", container.ID, err)
continue continue
} }
stats, err := container.Stats() stats, err := container.Stats()
if err != nil { if err != nil {
if err != execdriver.ErrNotRunning { if err != execdriver.ErrNotRunning {
log.Errorf("collecting stats for %s: %v", container.ID, err) logrus.Errorf("collecting stats for %s: %v", container.ID, err)
} }
continue continue
} }

View File

@ -9,7 +9,7 @@ import (
"sort" "sort"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
"github.com/docker/docker/pkg/symlink" "github.com/docker/docker/pkg/symlink"
@ -133,7 +133,7 @@ func (container *Container) registerVolumes() {
} }
v, err := container.daemon.volumes.FindOrCreateVolume(path, writable) v, err := container.daemon.volumes.FindOrCreateVolume(path, writable)
if err != nil { if err != nil {
log.Debugf("error registering volume %s: %v", path, err) logrus.Debugf("error registering volume %s: %v", path, err)
continue continue
} }
v.AddContainer(container.ID) v.AddContainer(container.ID)
@ -144,7 +144,7 @@ func (container *Container) derefVolumes() {
for path := range container.VolumePaths() { for path := range container.VolumePaths() {
vol := container.daemon.volumes.Get(path) vol := container.daemon.volumes.Get(path)
if vol == nil { if vol == nil {
log.Debugf("Volume %s was not found and could not be dereferenced", path) logrus.Debugf("Volume %s was not found and could not be dereferenced", path)
continue continue
} }
vol.RemoveContainer(container.ID) vol.RemoveContainer(container.ID)

View File

@ -9,7 +9,7 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/builder" "github.com/docker/docker/builder"
"github.com/docker/docker/builtins" "github.com/docker/docker/builtins"
@ -46,7 +46,7 @@ func migrateKey() (err error) {
if err == nil { if err == nil {
err = os.Remove(oldPath) err = os.Remove(oldPath)
} else { } else {
log.Warnf("Key migration failed, key file not removed at %s", oldPath) logrus.Warnf("Key migration failed, key file not removed at %s", oldPath)
} }
}() }()
@ -70,7 +70,7 @@ func migrateKey() (err error) {
return fmt.Errorf("error copying key: %s", err) return fmt.Errorf("error copying key: %s", err)
} }
log.Infof("Migrated key from %s to %s", oldPath, newPath) logrus.Infof("Migrated key from %s to %s", oldPath, newPath)
} }
return nil return nil
@ -85,18 +85,18 @@ func mainDaemon() {
signal.Trap(eng.Shutdown) signal.Trap(eng.Shutdown)
if err := migrateKey(); err != nil { if err := migrateKey(); err != nil {
log.Fatal(err) logrus.Fatal(err)
} }
daemonCfg.TrustKeyPath = *flTrustKey daemonCfg.TrustKeyPath = *flTrustKey
// Load builtins // Load builtins
if err := builtins.Register(eng); err != nil { if err := builtins.Register(eng); err != nil {
log.Fatal(err) logrus.Fatal(err)
} }
// load registry service // load registry service
if err := registry.NewService(registryCfg).Install(eng); err != nil { if err := registry.NewService(registryCfg).Install(eng); err != nil {
log.Fatal(err) logrus.Fatal(err)
} }
// load the daemon in the background so we can immediately start // load the daemon in the background so we can immediately start
@ -110,7 +110,7 @@ func mainDaemon() {
return return
} }
log.Infof("docker daemon: %s %s; execdriver: %s; graphdriver: %s", logrus.Infof("docker daemon: %s %s; execdriver: %s; graphdriver: %s",
dockerversion.VERSION, dockerversion.VERSION,
dockerversion.GITCOMMIT, dockerversion.GITCOMMIT,
d.ExecutionDriver().Name(), d.ExecutionDriver().Name(),
@ -155,7 +155,7 @@ func mainDaemon() {
serveAPIWait := make(chan error) serveAPIWait := make(chan error)
go func() { go func() {
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Errorf("ServeAPI error: %v", err) logrus.Errorf("ServeAPI error: %v", err)
serveAPIWait <- err serveAPIWait <- err
return return
} }
@ -164,7 +164,7 @@ func mainDaemon() {
// Wait for the daemon startup goroutine to finish // Wait for the daemon startup goroutine to finish
// This makes sure we can actually cleanly shutdown the daemon // This makes sure we can actually cleanly shutdown the daemon
log.Debug("waiting for daemon to initialize") logrus.Debug("waiting for daemon to initialize")
errDaemon := <-daemonInitWait errDaemon := <-daemonInitWait
if errDaemon != nil { if errDaemon != nil {
eng.Shutdown() eng.Shutdown()
@ -176,9 +176,9 @@ func mainDaemon() {
} }
// we must "fatal" exit here as the API server may be happy to // we must "fatal" exit here as the API server may be happy to
// continue listening forever if the error had no impact to API // continue listening forever if the error had no impact to API
log.Fatal(outStr) logrus.Fatal(outStr)
} else { } else {
log.Info("Daemon has completed initialization") logrus.Info("Daemon has completed initialization")
} }
// Daemon is fully initialized and handling API traffic // Daemon is fully initialized and handling API traffic
@ -188,7 +188,7 @@ func mainDaemon() {
// exited the daemon process above) // exited the daemon process above)
eng.Shutdown() eng.Shutdown()
if errAPI != nil { if errAPI != nil {
log.Fatalf("Shutting down due to ServeAPI error: %v", errAPI) logrus.Fatalf("Shutting down due to ServeAPI error: %v", errAPI)
} }
} }

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api" "github.com/docker/docker/api"
"github.com/docker/docker/api/client" "github.com/docker/docker/api/client"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
@ -44,20 +44,20 @@ func main() {
} }
if *flLogLevel != "" { if *flLogLevel != "" {
lvl, err := log.ParseLevel(*flLogLevel) lvl, err := logrus.ParseLevel(*flLogLevel)
if err != nil { if err != nil {
log.Fatalf("Unable to parse logging level: %s", *flLogLevel) logrus.Fatalf("Unable to parse logging level: %s", *flLogLevel)
} }
setLogLevel(lvl) setLogLevel(lvl)
} else { } else {
setLogLevel(log.InfoLevel) setLogLevel(logrus.InfoLevel)
} }
// -D, --debug, -l/--log-level=debug processing // -D, --debug, -l/--log-level=debug processing
// When/if -D is removed this block can be deleted // When/if -D is removed this block can be deleted
if *flDebug { if *flDebug {
os.Setenv("DEBUG", "1") os.Setenv("DEBUG", "1")
setLogLevel(log.DebugLevel) setLogLevel(logrus.DebugLevel)
} }
if len(flHosts) == 0 { if len(flHosts) == 0 {
@ -68,7 +68,7 @@ func main() {
} }
defaultHost, err := api.ValidateHost(defaultHost) defaultHost, err := api.ValidateHost(defaultHost)
if err != nil { if err != nil {
log.Fatal(err) logrus.Fatal(err)
} }
flHosts = append(flHosts, defaultHost) flHosts = append(flHosts, defaultHost)
} }
@ -85,7 +85,7 @@ func main() {
} }
if len(flHosts) > 1 { if len(flHosts) > 1 {
log.Fatal("Please specify only one -H") logrus.Fatal("Please specify only one -H")
} }
protoAddrParts := strings.SplitN(flHosts[0], "://", 2) protoAddrParts := strings.SplitN(flHosts[0], "://", 2)
@ -106,7 +106,7 @@ func main() {
certPool := x509.NewCertPool() certPool := x509.NewCertPool()
file, err := ioutil.ReadFile(*flCa) file, err := ioutil.ReadFile(*flCa)
if err != nil { if err != nil {
log.Fatalf("Couldn't read ca cert %s: %s", *flCa, err) logrus.Fatalf("Couldn't read ca cert %s: %s", *flCa, err)
} }
certPool.AppendCertsFromPEM(file) certPool.AppendCertsFromPEM(file)
tlsConfig.RootCAs = certPool tlsConfig.RootCAs = certPool
@ -121,7 +121,7 @@ func main() {
*flTls = true *flTls = true
cert, err := tls.LoadX509KeyPair(*flCert, *flKey) cert, err := tls.LoadX509KeyPair(*flCert, *flKey)
if err != nil { if err != nil {
log.Fatalf("Couldn't load X509 key pair: %q. Make sure the key is encrypted", err) logrus.Fatalf("Couldn't load X509 key pair: %q. Make sure the key is encrypted", err)
} }
tlsConfig.Certificates = []tls.Certificate{cert} tlsConfig.Certificates = []tls.Certificate{cert}
} }
@ -138,11 +138,11 @@ func main() {
if err := cli.Cmd(flag.Args()...); err != nil { if err := cli.Cmd(flag.Args()...); err != nil {
if sterr, ok := err.(*utils.StatusError); ok { if sterr, ok := err.(*utils.StatusError); ok {
if sterr.Status != "" { if sterr.Status != "" {
log.Println(sterr.Status) logrus.Println(sterr.Status)
} }
os.Exit(sterr.StatusCode) os.Exit(sterr.StatusCode)
} }
log.Fatal(err) logrus.Fatal(err)
} }
} }

View File

@ -1,14 +1,14 @@
package main package main
import ( import (
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"io" "io"
) )
func setLogLevel(lvl log.Level) { func setLogLevel(lvl logrus.Level) {
log.SetLevel(lvl) logrus.SetLevel(lvl)
} }
func initLogging(stderr io.Writer) { func initLogging(stderr io.Writer) {
log.SetOutput(stderr) logrus.SetOutput(stderr)
} }

View File

@ -8,7 +8,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
// A job is the fundamental unit of work in the docker engine. // A job is the fundamental unit of work in the docker engine.
@ -67,10 +67,10 @@ func (job *Job) Run() error {
} }
// Log beginning and end of the job // Log beginning and end of the job
if job.Eng.Logging { if job.Eng.Logging {
log.Infof("+job %s", job.CallString()) logrus.Infof("+job %s", job.CallString())
defer func() { defer func() {
// what if err is nil? // what if err is nil?
log.Infof("-job %s%s", job.CallString(), job.err) logrus.Infof("-job %s%s", job.CallString(), job.err)
}() }()
} }
var errorMessage = bytes.NewBuffer(nil) var errorMessage = bytes.NewBuffer(nil)

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"path" "path"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/parsers" "github.com/docker/docker/pkg/parsers"
@ -33,7 +33,7 @@ func (s *TagStore) CmdImageExport(job *engine.Job) error {
rootRepoMap := map[string]Repository{} rootRepoMap := map[string]Repository{}
addKey := func(name string, tag string, id string) { addKey := func(name string, tag string, id string) {
log.Debugf("add key [%s:%s]", name, tag) logrus.Debugf("add key [%s:%s]", name, tag)
if repo, ok := rootRepoMap[name]; !ok { if repo, ok := rootRepoMap[name]; !ok {
rootRepoMap[name] = Repository{tag: id} rootRepoMap[name] = Repository{tag: id}
} else { } else {
@ -42,7 +42,7 @@ func (s *TagStore) CmdImageExport(job *engine.Job) error {
} }
for _, name := range job.Args { for _, name := range job.Args {
name = registry.NormalizeLocalName(name) name = registry.NormalizeLocalName(name)
log.Debugf("Serializing %s", name) logrus.Debugf("Serializing %s", name)
rootRepo := s.Repositories[name] rootRepo := s.Repositories[name]
if rootRepo != nil { if rootRepo != nil {
// this is a base repo name, like 'busybox' // this is a base repo name, like 'busybox'
@ -78,7 +78,7 @@ func (s *TagStore) CmdImageExport(job *engine.Job) error {
} }
} }
} }
log.Debugf("End Serializing %s", name) logrus.Debugf("End Serializing %s", name)
} }
// write repositories, if there is something to write // write repositories, if there is something to write
if len(rootRepoMap) > 0 { if len(rootRepoMap) > 0 {
@ -87,7 +87,7 @@ func (s *TagStore) CmdImageExport(job *engine.Job) error {
return err return err
} }
} else { } else {
log.Debugf("There were no repositories to write") logrus.Debugf("There were no repositories to write")
} }
fs, err := archive.Tar(tempdir, archive.Uncompressed) fs, err := archive.Tar(tempdir, archive.Uncompressed)
@ -99,7 +99,7 @@ func (s *TagStore) CmdImageExport(job *engine.Job) error {
if _, err := io.Copy(job.Stdout, fs); err != nil { if _, err := io.Copy(job.Stdout, fs); err != nil {
return err return err
} }
log.Debugf("End export job: %s", job.Name) logrus.Debugf("End export job: %s", job.Name)
return nil return nil
} }

View File

@ -12,7 +12,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/image" "github.com/docker/docker/image"
@ -68,7 +68,7 @@ func (graph *Graph) restore() error {
} }
} }
graph.idIndex = truncindex.NewTruncIndex(ids) graph.idIndex = truncindex.NewTruncIndex(ids)
log.Debugf("Restored %d elements", len(dir)) logrus.Debugf("Restored %d elements", len(dir))
return nil return nil
} }

View File

@ -7,7 +7,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/progressreader" "github.com/docker/docker/pkg/progressreader"
@ -93,7 +93,7 @@ func (s *TagStore) CmdImport(job *engine.Job) error {
logID = utils.ImageReference(logID, tag) logID = utils.ImageReference(logID, tag)
} }
if err = job.Eng.Job("log", "import", logID, "").Run(); err != nil { if err = job.Eng.Job("log", "import", logID, "").Run(); err != nil {
log.Errorf("Error logging event 'import' for %s: %s", logID, err) logrus.Errorf("Error logging event 'import' for %s: %s", logID, err)
} }
return nil return nil
} }

View File

@ -8,7 +8,7 @@ import (
"os" "os"
"path" "path"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
@ -82,33 +82,33 @@ func (s *TagStore) CmdLoad(job *engine.Job) error {
func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string) error { func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string) error {
if err := eng.Job("image_get", address).Run(); err != nil { if err := eng.Job("image_get", address).Run(); err != nil {
log.Debugf("Loading %s", address) logrus.Debugf("Loading %s", address)
imageJson, err := ioutil.ReadFile(path.Join(tmpImageDir, "repo", address, "json")) imageJson, err := ioutil.ReadFile(path.Join(tmpImageDir, "repo", address, "json"))
if err != nil { if err != nil {
log.Debugf("Error reading json", err) logrus.Debugf("Error reading json", err)
return err return err
} }
layer, err := os.Open(path.Join(tmpImageDir, "repo", address, "layer.tar")) layer, err := os.Open(path.Join(tmpImageDir, "repo", address, "layer.tar"))
if err != nil { if err != nil {
log.Debugf("Error reading embedded tar", err) logrus.Debugf("Error reading embedded tar", err)
return err return err
} }
img, err := image.NewImgJSON(imageJson) img, err := image.NewImgJSON(imageJson)
if err != nil { if err != nil {
log.Debugf("Error unmarshalling json", err) logrus.Debugf("Error unmarshalling json", err)
return err return err
} }
if err := utils.ValidateID(img.ID); err != nil { if err := utils.ValidateID(img.ID); err != nil {
log.Debugf("Error validating ID: %s", err) logrus.Debugf("Error validating ID: %s", err)
return err return err
} }
// ensure no two downloads of the same layer happen at the same time // ensure no two downloads of the same layer happen at the same time
if c, err := s.poolAdd("pull", "layer:"+img.ID); err != nil { if c, err := s.poolAdd("pull", "layer:"+img.ID); err != nil {
if c != nil { if c != nil {
log.Debugf("Image (id: %s) load is already running, waiting: %v", img.ID, err) logrus.Debugf("Image (id: %s) load is already running, waiting: %v", img.ID, err)
<-c <-c
return nil return nil
} }
@ -129,7 +129,7 @@ func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string
return err return err
} }
} }
log.Debugf("Completed processing %s", address) logrus.Debugf("Completed processing %s", address)
return nil return nil
} }

View File

@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest" "github.com/docker/distribution/digest"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
@ -89,7 +89,7 @@ func (s *TagStore) loadManifest(eng *engine.Engine, manifestBytes []byte, dgst,
return nil, false, fmt.Errorf("error running key check: %s", err) return nil, false, fmt.Errorf("error running key check: %s", err)
} }
result := engine.Tail(stdoutBuffer, 1) result := engine.Tail(stdoutBuffer, 1)
log.Debugf("Key check result: %q", result) logrus.Debugf("Key check result: %q", result)
if result == "verified" { if result == "verified" {
verified = true verified = true
} }

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest" "github.com/docker/distribution/digest"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
@ -59,7 +59,7 @@ func (s *TagStore) CmdPull(job *engine.Job) error {
} }
defer s.poolRemove("pull", utils.ImageReference(repoInfo.LocalName, tag)) defer s.poolRemove("pull", utils.ImageReference(repoInfo.LocalName, tag))
log.Debugf("pulling image from host %q with remote name %q", repoInfo.Index.Name, repoInfo.RemoteName) logrus.Debugf("pulling image from host %q with remote name %q", repoInfo.Index.Name, repoInfo.RemoteName)
endpoint, err := repoInfo.GetEndpoint() endpoint, err := repoInfo.GetEndpoint()
if err != nil { if err != nil {
return err return err
@ -79,30 +79,30 @@ func (s *TagStore) CmdPull(job *engine.Job) error {
if repoInfo.Official { if repoInfo.Official {
j := job.Eng.Job("trust_update_base") j := job.Eng.Job("trust_update_base")
if err = j.Run(); err != nil { if err = j.Run(); err != nil {
log.Errorf("error updating trust base graph: %s", err) logrus.Errorf("error updating trust base graph: %s", err)
} }
} }
log.Debugf("pulling v2 repository with local name %q", repoInfo.LocalName) logrus.Debugf("pulling v2 repository with local name %q", repoInfo.LocalName)
if err := s.pullV2Repository(job.Eng, r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err == nil { if err := s.pullV2Repository(job.Eng, r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err == nil {
if err = job.Eng.Job("log", "pull", logName, "").Run(); err != nil { if err = job.Eng.Job("log", "pull", logName, "").Run(); err != nil {
log.Errorf("Error logging event 'pull' for %s: %s", logName, err) logrus.Errorf("Error logging event 'pull' for %s: %s", logName, err)
} }
return nil return nil
} else if err != registry.ErrDoesNotExist && err != ErrV2RegistryUnavailable { } else if err != registry.ErrDoesNotExist && err != ErrV2RegistryUnavailable {
log.Errorf("Error from V2 registry: %s", err) logrus.Errorf("Error from V2 registry: %s", err)
} }
log.Debug("image does not exist on v2 registry, falling back to v1") logrus.Debug("image does not exist on v2 registry, falling back to v1")
} }
log.Debugf("pulling v1 repository with local name %q", repoInfo.LocalName) logrus.Debugf("pulling v1 repository with local name %q", repoInfo.LocalName)
if err = s.pullRepository(r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err != nil { if err = s.pullRepository(r, job.Stdout, repoInfo, tag, sf, job.GetenvBool("parallel")); err != nil {
return err return err
} }
if err = job.Eng.Job("log", "pull", logName, "").Run(); err != nil { if err = job.Eng.Job("log", "pull", logName, "").Run(); err != nil {
log.Errorf("Error logging event 'pull' for %s: %s", logName, err) logrus.Errorf("Error logging event 'pull' for %s: %s", logName, err)
} }
return nil return nil
@ -120,10 +120,10 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, repoInfo *
return err return err
} }
log.Debugf("Retrieving the tag list") logrus.Debugf("Retrieving the tag list")
tagsList, err := r.GetRemoteTags(repoData.Endpoints, repoInfo.RemoteName, repoData.Tokens) tagsList, err := r.GetRemoteTags(repoData.Endpoints, repoInfo.RemoteName, repoData.Tokens)
if err != nil { if err != nil {
log.Errorf("unable to get remote tags: %s", err) logrus.Errorf("unable to get remote tags: %s", err)
return err return err
} }
@ -135,7 +135,7 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, repoInfo *
} }
} }
log.Debugf("Registering tags") logrus.Debugf("Registering tags")
// If no tag has been specified, pull them all // If no tag has been specified, pull them all
if askedTag == "" { if askedTag == "" {
for tag, id := range tagsList { for tag, id := range tagsList {
@ -163,7 +163,7 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, repoInfo *
} }
if img.Tag == "" { if img.Tag == "" {
log.Debugf("Image (id: %s) present in this repository but untagged, skipping", img.ID) logrus.Debugf("Image (id: %s) present in this repository but untagged, skipping", img.ID)
if parallel { if parallel {
errors <- nil errors <- nil
} }
@ -177,7 +177,7 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, repoInfo *
<-c <-c
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil))
} else { } else {
log.Debugf("Image (id: %s) pull is already running, skipping: %v", img.ID, err) logrus.Debugf("Image (id: %s) pull is already running, skipping: %v", img.ID, err)
} }
if parallel { if parallel {
errors <- nil errors <- nil
@ -194,7 +194,7 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, repoInfo *
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, mirror: %s", img.Tag, repoInfo.CanonicalName, ep), nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), fmt.Sprintf("Pulling image (%s) from %s, mirror: %s", img.Tag, repoInfo.CanonicalName, ep), nil))
if is_downloaded, err = s.pullImage(r, out, img.ID, ep, repoData.Tokens, sf); err != nil { if is_downloaded, err = s.pullImage(r, out, img.ID, ep, repoData.Tokens, sf); err != nil {
// Don't report errors when pulling from mirrors. // Don't report errors when pulling from mirrors.
log.Debugf("Error pulling image (%s) from %s, mirror: %s, %s", img.Tag, repoInfo.CanonicalName, ep, err) logrus.Debugf("Error pulling image (%s) from %s, mirror: %s, %s", img.Tag, repoInfo.CanonicalName, ep, err)
continue continue
} }
layers_downloaded = layers_downloaded || is_downloaded layers_downloaded = layers_downloaded || is_downloaded
@ -281,7 +281,7 @@ func (s *TagStore) pullImage(r *registry.Session, out io.Writer, imgID, endpoint
// ensure no two downloads of the same layer happen at the same time // ensure no two downloads of the same layer happen at the same time
if c, err := s.poolAdd("pull", "layer:"+id); err != nil { if c, err := s.poolAdd("pull", "layer:"+id); err != nil {
log.Debugf("Image (id: %s) pull is already running, skipping: %v", id, err) logrus.Debugf("Image (id: %s) pull is already running, skipping: %v", id, err)
<-c <-c
} }
defer s.poolRemove("pull", "layer:"+id) defer s.poolRemove("pull", "layer:"+id)
@ -387,7 +387,7 @@ func (s *TagStore) pullV2Repository(eng *engine.Engine, r *registry.Session, out
endpoint, err := r.V2RegistryEndpoint(repoInfo.Index) endpoint, err := r.V2RegistryEndpoint(repoInfo.Index)
if err != nil { if err != nil {
if repoInfo.Index.Official { if repoInfo.Index.Official {
log.Debugf("Unable to pull from V2 registry, falling back to v1: %s", err) logrus.Debugf("Unable to pull from V2 registry, falling back to v1: %s", err)
return ErrV2RegistryUnavailable return ErrV2RegistryUnavailable
} }
return fmt.Errorf("error getting registry endpoint: %s", err) return fmt.Errorf("error getting registry endpoint: %s", err)
@ -398,7 +398,7 @@ func (s *TagStore) pullV2Repository(eng *engine.Engine, r *registry.Session, out
} }
var layersDownloaded bool var layersDownloaded bool
if tag == "" { if tag == "" {
log.Debugf("Pulling tag list from V2 registry for %s", repoInfo.CanonicalName) logrus.Debugf("Pulling tag list from V2 registry for %s", repoInfo.CanonicalName)
tags, err := r.GetV2RemoteTags(endpoint, repoInfo.RemoteName, auth) tags, err := r.GetV2RemoteTags(endpoint, repoInfo.RemoteName, auth)
if err != nil { if err != nil {
return err return err
@ -430,7 +430,7 @@ func (s *TagStore) pullV2Repository(eng *engine.Engine, r *registry.Session, out
} }
func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Writer, endpoint *registry.Endpoint, repoInfo *registry.RepositoryInfo, tag string, sf *streamformatter.StreamFormatter, parallel bool, auth *registry.RequestAuthorization) (bool, error) { func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Writer, endpoint *registry.Endpoint, repoInfo *registry.RepositoryInfo, tag string, sf *streamformatter.StreamFormatter, parallel bool, auth *registry.RequestAuthorization) (bool, error) {
log.Debugf("Pulling tag from V2 registry: %q", tag) logrus.Debugf("Pulling tag from V2 registry: %q", tag)
manifestBytes, manifestDigest, err := r.GetV2ImageManifest(endpoint, repoInfo.RemoteName, tag, auth) manifestBytes, manifestDigest, err := r.GetV2ImageManifest(endpoint, repoInfo.RemoteName, tag, auth)
if err != nil { if err != nil {
@ -449,7 +449,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
} }
if verified { if verified {
log.Printf("Image manifest for %s has been verified", utils.ImageReference(repoInfo.CanonicalName, tag)) logrus.Printf("Image manifest for %s has been verified", utils.ImageReference(repoInfo.CanonicalName, tag))
} }
out.Write(sf.FormatStatus(tag, "Pulling from %s", repoInfo.CanonicalName)) out.Write(sf.FormatStatus(tag, "Pulling from %s", repoInfo.CanonicalName))
@ -469,7 +469,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
// Check if exists // Check if exists
if s.graph.Exists(img.ID) { if s.graph.Exists(img.ID) {
log.Debugf("Image already exists: %s", img.ID) logrus.Debugf("Image already exists: %s", img.ID)
continue continue
} }
@ -482,7 +482,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Pulling fs layer", nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Pulling fs layer", nil))
downloadFunc := func(di *downloadInfo) error { downloadFunc := func(di *downloadInfo) error {
log.Debugf("pulling blob %q to V1 img %s", sumStr, img.ID) logrus.Debugf("pulling blob %q to V1 img %s", sumStr, img.ID)
if c, err := s.poolAdd("pull", "img:"+img.ID); err != nil { if c, err := s.poolAdd("pull", "img:"+img.ID); err != nil {
if c != nil { if c != nil {
@ -490,7 +490,7 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
<-c <-c
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil))
} else { } else {
log.Debugf("Image (id: %s) pull is already running, skipping: %v", img.ID, err) logrus.Debugf("Image (id: %s) pull is already running, skipping: %v", img.ID, err)
} }
} else { } else {
defer s.poolRemove("pull", "img:"+img.ID) defer s.poolRemove("pull", "img:"+img.ID)
@ -525,13 +525,13 @@ func (s *TagStore) pullV2Tag(eng *engine.Engine, r *registry.Session, out io.Wri
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Verifying Checksum", nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Verifying Checksum", nil))
if !verifier.Verified() { if !verifier.Verified() {
log.Infof("Image verification failed: checksum mismatch for %q", di.digest.String()) logrus.Infof("Image verification failed: checksum mismatch for %q", di.digest.String())
verified = false verified = false
} }
out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil)) out.Write(sf.FormatProgress(stringid.TruncateID(img.ID), "Download complete", nil))
log.Debugf("Downloaded %s to tempfile %s", img.ID, tmpFile.Name()) logrus.Debugf("Downloaded %s to tempfile %s", img.ID, tmpFile.Name())
di.tmpFile = tmpFile di.tmpFile = tmpFile
di.length = l di.length = l
di.downloaded = true di.downloaded = true

View File

@ -12,7 +12,7 @@ import (
"strings" "strings"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest" "github.com/docker/distribution/digest"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
@ -75,14 +75,14 @@ func (s *TagStore) getImageList(localRepo map[string]string, requestedTag string
if len(imageList) == 0 { if len(imageList) == 0 {
return nil, nil, fmt.Errorf("No images found for the requested repository / tag") return nil, nil, fmt.Errorf("No images found for the requested repository / tag")
} }
log.Debugf("Image list: %v", imageList) logrus.Debugf("Image list: %v", imageList)
log.Debugf("Tags by image: %v", tagsByImage) logrus.Debugf("Tags by image: %v", tagsByImage)
return imageList, tagsByImage, nil return imageList, tagsByImage, nil
} }
func (s *TagStore) getImageTags(localRepo map[string]string, askedTag string) ([]string, error) { func (s *TagStore) getImageTags(localRepo map[string]string, askedTag string) ([]string, error) {
log.Debugf("Checking %s against %#v", askedTag, localRepo) logrus.Debugf("Checking %s against %#v", askedTag, localRepo)
if len(askedTag) > 0 { if len(askedTag) > 0 {
if _, ok := localRepo[askedTag]; !ok || utils.DigestReference(askedTag) { if _, ok := localRepo[askedTag]; !ok || utils.DigestReference(askedTag) {
return nil, fmt.Errorf("Tag does not exist: %s", askedTag) return nil, fmt.Errorf("Tag does not exist: %s", askedTag)
@ -136,7 +136,7 @@ func lookupImageOnEndpoint(wg *sync.WaitGroup, r *registry.Session, out io.Write
defer wg.Done() defer wg.Done()
for image := range images { for image := range images {
if err := r.LookupRemoteImage(image.id, image.endpoint, image.tokens); err != nil { if err := r.LookupRemoteImage(image.id, image.endpoint, image.tokens); err != nil {
log.Errorf("Error in LookupRemoteImage: %s", err) logrus.Errorf("Error in LookupRemoteImage: %s", err)
imagesToPush <- image.id imagesToPush <- image.id
continue continue
} }
@ -205,7 +205,7 @@ func (s *TagStore) pushImageToEndpoint(endpoint string, out io.Writer, remoteNam
func (s *TagStore) pushRepository(r *registry.Session, out io.Writer, func (s *TagStore) pushRepository(r *registry.Session, out io.Writer,
repoInfo *registry.RepositoryInfo, localRepo map[string]string, repoInfo *registry.RepositoryInfo, localRepo map[string]string,
tag string, sf *streamformatter.StreamFormatter) error { tag string, sf *streamformatter.StreamFormatter) error {
log.Debugf("Local repo: %s", localRepo) logrus.Debugf("Local repo: %s", localRepo)
out = utils.NewWriteFlusher(out) out = utils.NewWriteFlusher(out)
imgList, tags, err := s.getImageList(localRepo, tag) imgList, tags, err := s.getImageList(localRepo, tag)
if err != nil { if err != nil {
@ -214,9 +214,9 @@ func (s *TagStore) pushRepository(r *registry.Session, out io.Writer,
out.Write(sf.FormatStatus("", "Sending image list")) out.Write(sf.FormatStatus("", "Sending image list"))
imageIndex := s.createImageIndex(imgList, tags) imageIndex := s.createImageIndex(imgList, tags)
log.Debugf("Preparing to push %s with the following images and tags", localRepo) logrus.Debugf("Preparing to push %s with the following images and tags", localRepo)
for _, data := range imageIndex { for _, data := range imageIndex {
log.Debugf("Pushing ID: %s with Tag: %s", data.ID, data.Tag) logrus.Debugf("Pushing ID: %s with Tag: %s", data.ID, data.Tag)
} }
// Register all the images in a repository with the registry // Register all the images in a repository with the registry
// If an image is not in this list it will not be associated with the repository // If an image is not in this list it will not be associated with the repository
@ -267,7 +267,7 @@ func (s *TagStore) pushImage(r *registry.Session, out io.Writer, imgID, ep strin
defer os.RemoveAll(layerData.Name()) defer os.RemoveAll(layerData.Name())
// Send the layer // Send the layer
log.Debugf("rendered layer for %s of [%d] size", imgData.ID, layerData.Size) logrus.Debugf("rendered layer for %s of [%d] size", imgData.ID, layerData.Size)
checksum, checksumPayload, err := r.PushImageLayerRegistry(imgData.ID, checksum, checksumPayload, err := r.PushImageLayerRegistry(imgData.ID,
progressreader.New(progressreader.Config{ progressreader.New(progressreader.Config{
@ -297,7 +297,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
endpoint, err := r.V2RegistryEndpoint(repoInfo.Index) endpoint, err := r.V2RegistryEndpoint(repoInfo.Index)
if err != nil { if err != nil {
if repoInfo.Index.Official { if repoInfo.Index.Official {
log.Debugf("Unable to push to V2 registry, falling back to v1: %s", err) logrus.Debugf("Unable to push to V2 registry, falling back to v1: %s", err)
return ErrV2RegistryUnavailable return ErrV2RegistryUnavailable
} }
return fmt.Errorf("error getting registry endpoint: %s", err) return fmt.Errorf("error getting registry endpoint: %s", err)
@ -317,7 +317,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
} }
for _, tag := range tags { for _, tag := range tags {
log.Debugf("Pushing repository: %s:%s", repoInfo.CanonicalName, tag) logrus.Debugf("Pushing repository: %s:%s", repoInfo.CanonicalName, tag)
layerId, exists := localRepo[tag] layerId, exists := localRepo[tag]
if !exists { if !exists {
@ -358,7 +358,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
// Schema version 1 requires layer ordering from top to root // Schema version 1 requires layer ordering from top to root
for i, layer := range layers { for i, layer := range layers {
log.Debugf("Pushing layer: %s", layer.ID) logrus.Debugf("Pushing layer: %s", layer.ID)
if layer.Config != nil && metadata.Image != layer.ID { if layer.Config != nil && metadata.Image != layer.ID {
err = runconfig.Merge(&metadata, layer.Config) err = runconfig.Merge(&metadata, layer.Config)
@ -411,7 +411,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
return fmt.Errorf("invalid manifest: %s", err) return fmt.Errorf("invalid manifest: %s", err)
} }
log.Debugf("Pushing %s:%s to v2 repository", repoInfo.LocalName, tag) logrus.Debugf("Pushing %s:%s to v2 repository", repoInfo.LocalName, tag)
mBytes, err := json.MarshalIndent(m, "", " ") mBytes, err := json.MarshalIndent(m, "", " ")
if err != nil { if err != nil {
return err return err
@ -429,7 +429,7 @@ func (s *TagStore) pushV2Repository(r *registry.Session, localRepo Repository, o
if err != nil { if err != nil {
return err return err
} }
log.Infof("Signed manifest for %s:%s using daemon's key: %s", repoInfo.LocalName, tag, s.trustKey.KeyID()) logrus.Infof("Signed manifest for %s:%s using daemon's key: %s", repoInfo.LocalName, tag, s.trustKey.KeyID())
// push the manifest // push the manifest
digest, err := r.PutV2ImageManifest(endpoint, repoInfo.RemoteName, tag, signedBody, mBytes, auth) digest, err := r.PutV2ImageManifest(endpoint, repoInfo.RemoteName, tag, signedBody, mBytes, auth)
@ -473,7 +473,7 @@ func (s *TagStore) pushV2Image(r *registry.Session, img *image.Image, endpoint *
dgst := digest.NewDigest("sha256", h) dgst := digest.NewDigest("sha256", h)
// Send the layer // Send the layer
log.Debugf("rendered layer for %s of [%d] size", img.ID, size) logrus.Debugf("rendered layer for %s of [%d] size", img.ID, size)
if err := r.PutV2ImageBlob(endpoint, imageName, dgst.Algorithm(), dgst.Hex(), if err := r.PutV2ImageBlob(endpoint, imageName, dgst.Algorithm(), dgst.Hex(),
progressreader.New(progressreader.Config{ progressreader.New(progressreader.Config{

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"io" "io"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/docker/image" "github.com/docker/docker/image"
) )
@ -174,7 +174,7 @@ func (s *TagStore) CmdTarLayer(job *engine.Job) error {
if err != nil { if err != nil {
return err return err
} }
log.Debugf("rendered layer for %s of [%d] size", image.ID, written) logrus.Debugf("rendered layer for %s of [%d] size", image.ID, written)
return nil return nil
} }
return fmt.Errorf("No such image: %s", name) return fmt.Errorf("No such image: %s", name)

View File

@ -9,7 +9,7 @@ import (
"testing" "testing"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/api/client" "github.com/docker/docker/api/client"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
@ -337,7 +337,7 @@ func TestAttachDisconnect(t *testing.T) {
go func() { go func() {
// Start a process in daemon mode // Start a process in daemon mode
if err := cli.CmdRun("-d", "-i", unitTestImageID, "/bin/cat"); err != nil { if err := cli.CmdRun("-d", "-i", unitTestImageID, "/bin/cat"); err != nil {
log.Debugf("Error CmdRun: %s", err) logrus.Debugf("Error CmdRun: %s", err)
} }
}() }()

View File

@ -16,7 +16,7 @@ import (
"testing" "testing"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon" "github.com/docker/docker/daemon"
"github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/daemon/execdriver"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
@ -94,23 +94,23 @@ func init() {
} }
if uid := syscall.Geteuid(); uid != 0 { if uid := syscall.Geteuid(); uid != 0 {
log.Fatalf("docker tests need to be run as root") logrus.Fatalf("docker tests need to be run as root")
} }
// Copy dockerinit into our current testing directory, if provided (so we can test a separate dockerinit binary) // Copy dockerinit into our current testing directory, if provided (so we can test a separate dockerinit binary)
if dockerinit := os.Getenv("TEST_DOCKERINIT_PATH"); dockerinit != "" { if dockerinit := os.Getenv("TEST_DOCKERINIT_PATH"); dockerinit != "" {
src, err := os.Open(dockerinit) src, err := os.Open(dockerinit)
if err != nil { if err != nil {
log.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s", err) logrus.Fatalf("Unable to open TEST_DOCKERINIT_PATH: %s", err)
} }
defer src.Close() defer src.Close()
dst, err := os.OpenFile(filepath.Join(filepath.Dir(utils.SelfPath()), "dockerinit"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0555) dst, err := os.OpenFile(filepath.Join(filepath.Dir(utils.SelfPath()), "dockerinit"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0555)
if err != nil { if err != nil {
log.Fatalf("Unable to create dockerinit in test directory: %s", err) logrus.Fatalf("Unable to create dockerinit in test directory: %s", err)
} }
defer dst.Close() defer dst.Close()
if _, err := io.Copy(dst, src); err != nil { if _, err := io.Copy(dst, src); err != nil {
log.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s", err) logrus.Fatalf("Unable to copy dockerinit to TEST_DOCKERINIT_PATH: %s", err)
} }
dst.Close() dst.Close()
src.Close() src.Close()
@ -137,14 +137,14 @@ func setupBaseImage() {
job = eng.Job("pull", unitTestImageName) job = eng.Job("pull", unitTestImageName)
job.Stdout.Add(ioutils.NopWriteCloser(os.Stdout)) job.Stdout.Add(ioutils.NopWriteCloser(os.Stdout))
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Fatalf("Unable to pull the test image: %s", err) logrus.Fatalf("Unable to pull the test image: %s", err)
} }
} }
} }
func spawnGlobalDaemon() { func spawnGlobalDaemon() {
if globalDaemon != nil { if globalDaemon != nil {
log.Debugf("Global daemon already exists. Skipping.") logrus.Debugf("Global daemon already exists. Skipping.")
return return
} }
t := std_log.New(os.Stderr, "", 0) t := std_log.New(os.Stderr, "", 0)
@ -154,7 +154,7 @@ func spawnGlobalDaemon() {
// Spawn a Daemon // Spawn a Daemon
go func() { go func() {
log.Debugf("Spawning global daemon for integration tests") logrus.Debugf("Spawning global daemon for integration tests")
listenURL := &url.URL{ listenURL := &url.URL{
Scheme: testDaemonProto, Scheme: testDaemonProto,
Host: testDaemonAddr, Host: testDaemonAddr,
@ -162,7 +162,7 @@ func spawnGlobalDaemon() {
job := eng.Job("serveapi", listenURL.String()) job := eng.Job("serveapi", listenURL.String())
job.SetenvBool("Logging", true) job.SetenvBool("Logging", true)
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Fatalf("Unable to spawn the test daemon: %s", err) logrus.Fatalf("Unable to spawn the test daemon: %s", err)
} }
}() }()
@ -171,7 +171,7 @@ func spawnGlobalDaemon() {
time.Sleep(time.Second) time.Sleep(time.Second)
if err := eng.Job("acceptconnections").Run(); err != nil { if err := eng.Job("acceptconnections").Run(); err != nil {
log.Fatalf("Unable to accept connections for test api: %s", err) logrus.Fatalf("Unable to accept connections for test api: %s", err)
} }
} }
@ -204,7 +204,7 @@ func spawnHttpsDaemon(addr, cacert, cert, key string) *engine.Engine {
// Spawn a Daemon // Spawn a Daemon
go func() { go func() {
log.Debugf("Spawning https daemon for integration tests") logrus.Debugf("Spawning https daemon for integration tests")
listenURL := &url.URL{ listenURL := &url.URL{
Scheme: testDaemonHttpsProto, Scheme: testDaemonHttpsProto,
Host: addr, Host: addr,
@ -217,7 +217,7 @@ func spawnHttpsDaemon(addr, cacert, cert, key string) *engine.Engine {
job.Setenv("TlsCert", cert) job.Setenv("TlsCert", cert)
job.Setenv("TlsKey", key) job.Setenv("TlsKey", key)
if err := job.Run(); err != nil { if err := job.Run(); err != nil {
log.Fatalf("Unable to spawn the test daemon: %s", err) logrus.Fatalf("Unable to spawn the test daemon: %s", err)
} }
}() }()
@ -225,7 +225,7 @@ func spawnHttpsDaemon(addr, cacert, cert, key string) *engine.Engine {
time.Sleep(time.Second) time.Sleep(time.Second)
if err := eng.Job("acceptconnections").Run(); err != nil { if err := eng.Job("acceptconnections").Run(); err != nil {
log.Fatalf("Unable to accept connections for test api: %s", err) logrus.Fatalf("Unable to accept connections for test api: %s", err)
} }
return eng return eng
} }
@ -235,14 +235,14 @@ func spawnHttpsDaemon(addr, cacert, cert, key string) *engine.Engine {
func GetTestImage(daemon *daemon.Daemon) *image.Image { func GetTestImage(daemon *daemon.Daemon) *image.Image {
imgs, err := daemon.Graph().Map() imgs, err := daemon.Graph().Map()
if err != nil { if err != nil {
log.Fatalf("Unable to get the test image: %s", err) logrus.Fatalf("Unable to get the test image: %s", err)
} }
for _, image := range imgs { for _, image := range imgs {
if image.ID == unitTestImageID { if image.ID == unitTestImageID {
return image return image
} }
} }
log.Fatalf("Test image %v not found in %s: %s", unitTestImageID, daemon.Graph().Root, imgs) logrus.Fatalf("Test image %v not found in %s: %s", unitTestImageID, daemon.Graph().Root, imgs)
return nil return nil
} }
@ -707,9 +707,9 @@ func TestRandomContainerName(t *testing.T) {
} }
if c, err := daemon.Get(container.Name); err != nil { if c, err := daemon.Get(container.Name); err != nil {
log.Fatalf("Could not lookup container %s by its name", container.Name) logrus.Fatalf("Could not lookup container %s by its name", container.Name)
} else if c.ID != containerID { } else if c.ID != containerID {
log.Fatalf("Looking up container name %s returned id %s instead of %s", container.Name, c.ID, containerID) logrus.Fatalf("Looking up container name %s returned id %s instead of %s", container.Name, c.ID, containerID)
} }
} }

View File

@ -18,7 +18,7 @@ import (
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/fileutils"
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/promise" "github.com/docker/docker/pkg/promise"
@ -78,7 +78,7 @@ func DetectCompression(source []byte) Compression {
Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}, Xz: {0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00},
} { } {
if len(source) < len(m) { if len(source) < len(m) {
log.Debugf("Len too short") logrus.Debugf("Len too short")
continue continue
} }
if bytes.Compare(m, source[:len(m)]) == 0 { if bytes.Compare(m, source[:len(m)]) == 0 {
@ -331,7 +331,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
} }
case tar.TypeXGlobalHeader: case tar.TypeXGlobalHeader:
log.Debugf("PAX Global Extended Headers found and ignored") logrus.Debugf("PAX Global Extended Headers found and ignored")
return nil return nil
default: default:
@ -426,7 +426,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
for _, include := range options.IncludeFiles { for _, include := range options.IncludeFiles {
filepath.Walk(filepath.Join(srcPath, include), func(filePath string, f os.FileInfo, err error) error { filepath.Walk(filepath.Join(srcPath, include), func(filePath string, f os.FileInfo, err error) error {
if err != nil { if err != nil {
log.Debugf("Tar: Can't stat file %s to tar: %s", srcPath, err) logrus.Debugf("Tar: Can't stat file %s to tar: %s", srcPath, err)
return nil return nil
} }
@ -447,7 +447,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
if include != relFilePath { if include != relFilePath {
skip, err = fileutils.Matches(relFilePath, options.ExcludePatterns) skip, err = fileutils.Matches(relFilePath, options.ExcludePatterns)
if err != nil { if err != nil {
log.Debugf("Error matching %s", relFilePath, err) logrus.Debugf("Error matching %s", relFilePath, err)
return err return err
} }
} }
@ -474,7 +474,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
} }
if err := ta.addTarFile(filePath, relFilePath); err != nil { if err := ta.addTarFile(filePath, relFilePath); err != nil {
log.Debugf("Can't add file %s to tar: %s", filePath, err) logrus.Debugf("Can't add file %s to tar: %s", filePath, err)
} }
return nil return nil
}) })
@ -482,13 +482,13 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
// Make sure to check the error on Close. // Make sure to check the error on Close.
if err := ta.TarWriter.Close(); err != nil { if err := ta.TarWriter.Close(); err != nil {
log.Debugf("Can't close tar writer: %s", err) logrus.Debugf("Can't close tar writer: %s", err)
} }
if err := compressWriter.Close(); err != nil { if err := compressWriter.Close(); err != nil {
log.Debugf("Can't close compress writer: %s", err) logrus.Debugf("Can't close compress writer: %s", err)
} }
if err := pipeWriter.Close(); err != nil { if err := pipeWriter.Close(); err != nil {
log.Debugf("Can't close pipe writer: %s", err) logrus.Debugf("Can't close pipe writer: %s", err)
} }
}() }()
@ -606,7 +606,7 @@ func Untar(archive io.Reader, dest string, options *TarOptions) error {
} }
func (archiver *Archiver) TarUntar(src, dst string) error { func (archiver *Archiver) TarUntar(src, dst string) error {
log.Debugf("TarUntar(%s %s)", src, dst) logrus.Debugf("TarUntar(%s %s)", src, dst)
archive, err := TarWithOptions(src, &TarOptions{Compression: Uncompressed}) archive, err := TarWithOptions(src, &TarOptions{Compression: Uncompressed})
if err != nil { if err != nil {
return err return err
@ -648,11 +648,11 @@ func (archiver *Archiver) CopyWithTar(src, dst string) error {
return archiver.CopyFileWithTar(src, dst) return archiver.CopyFileWithTar(src, dst)
} }
// Create dst, copy src's content into it // Create dst, copy src's content into it
log.Debugf("Creating dest directory: %s", dst) logrus.Debugf("Creating dest directory: %s", dst)
if err := os.MkdirAll(dst, 0755); err != nil && !os.IsExist(err) { if err := os.MkdirAll(dst, 0755); err != nil && !os.IsExist(err) {
return err return err
} }
log.Debugf("Calling TarUntar(%s, %s)", src, dst) logrus.Debugf("Calling TarUntar(%s, %s)", src, dst)
return archiver.TarUntar(src, dst) return archiver.TarUntar(src, dst)
} }
@ -665,7 +665,7 @@ func CopyWithTar(src, dst string) error {
} }
func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) { func (archiver *Archiver) CopyFileWithTar(src, dst string) (err error) {
log.Debugf("CopyFileWithTar(%s, %s)", src, dst) logrus.Debugf("CopyFileWithTar(%s, %s)", src, dst)
srcSt, err := os.Stat(src) srcSt, err := os.Stat(src)
if err != nil { if err != nil {
return err return err

View File

@ -13,7 +13,7 @@ import (
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar" "github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/pools" "github.com/docker/docker/pkg/pools"
"github.com/docker/docker/pkg/system" "github.com/docker/docker/pkg/system"
) )
@ -401,22 +401,22 @@ func ExportChanges(dir string, changes []Change) (Archive, error) {
ChangeTime: timestamp, ChangeTime: timestamp,
} }
if err := ta.TarWriter.WriteHeader(hdr); err != nil { if err := ta.TarWriter.WriteHeader(hdr); err != nil {
log.Debugf("Can't write whiteout header: %s", err) logrus.Debugf("Can't write whiteout header: %s", err)
} }
} else { } else {
path := filepath.Join(dir, change.Path) path := filepath.Join(dir, change.Path)
if err := ta.addTarFile(path, change.Path[1:]); err != nil { if err := ta.addTarFile(path, change.Path[1:]); err != nil {
log.Debugf("Can't add file %s to tar: %s", path, err) logrus.Debugf("Can't add file %s to tar: %s", path, err)
} }
} }
} }
// Make sure to check the error on Close. // Make sure to check the error on Close.
if err := ta.TarWriter.Close(); err != nil { if err := ta.TarWriter.Close(); err != nil {
log.Debugf("Can't close layer: %s", err) logrus.Debugf("Can't close layer: %s", err)
} }
if err := writer.Close(); err != nil { if err := writer.Close(); err != nil {
log.Debugf("failed close Changes writer: %s", err) logrus.Debugf("failed close Changes writer: %s", err)
} }
}() }()
return reader, nil return reader, nil

View File

@ -6,7 +6,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/jsonlog" "github.com/docker/docker/pkg/jsonlog"
) )
@ -61,7 +61,7 @@ func (w *BroadcastWriter) Write(p []byte) (n int, err error) {
jsonLog := jsonlog.JSONLog{Log: line, Stream: stream, Created: created} jsonLog := jsonlog.JSONLog{Log: line, Stream: stream, Created: created}
err = jsonLog.MarshalJSONBuf(w.jsLogBuf) err = jsonLog.MarshalJSONBuf(w.jsLogBuf)
if err != nil { if err != nil {
log.Errorf("Error making JSON log line: %s", err) logrus.Errorf("Error making JSON log line: %s", err)
continue continue
} }
w.jsLogBuf.WriteByte('\n') w.jsLogBuf.WriteByte('\n')

View File

@ -7,7 +7,7 @@ import (
"os" "os"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
func stringToLoopName(src string) [LoNameSize]uint8 { func stringToLoopName(src string) [LoNameSize]uint8 {
@ -39,20 +39,20 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
fi, err := os.Stat(target) fi, err := os.Stat(target)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
log.Errorf("There are no more loopback devices available.") logrus.Errorf("There are no more loopback devices available.")
} }
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
if fi.Mode()&os.ModeDevice != os.ModeDevice { if fi.Mode()&os.ModeDevice != os.ModeDevice {
log.Errorf("Loopback device %s is not a block device.", target) logrus.Errorf("Loopback device %s is not a block device.", target)
continue continue
} }
// OpenFile adds O_CLOEXEC // OpenFile adds O_CLOEXEC
loopFile, err = os.OpenFile(target, os.O_RDWR, 0644) loopFile, err = os.OpenFile(target, os.O_RDWR, 0644)
if err != nil { if err != nil {
log.Errorf("Error opening loopback device: %s", err) logrus.Errorf("Error opening loopback device: %s", err)
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
@ -62,7 +62,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
// If the error is EBUSY, then try the next loopback // If the error is EBUSY, then try the next loopback
if err != syscall.EBUSY { if err != syscall.EBUSY {
log.Errorf("Cannot set up loopback device %s: %s", target, err) logrus.Errorf("Cannot set up loopback device %s: %s", target, err)
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
@ -75,7 +75,7 @@ func openNextAvailableLoopback(index int, sparseFile *os.File) (loopFile *os.Fil
// This can't happen, but let's be sure // This can't happen, but let's be sure
if loopFile == nil { if loopFile == nil {
log.Errorf("Unreachable code reached! Error attaching %s to a loopback device.", sparseFile.Name()) logrus.Errorf("Unreachable code reached! Error attaching %s to a loopback device.", sparseFile.Name())
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
@ -91,13 +91,13 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
// loopback from index 0. // loopback from index 0.
startIndex, err := getNextFreeLoopbackIndex() startIndex, err := getNextFreeLoopbackIndex()
if err != nil { if err != nil {
log.Debugf("Error retrieving the next available loopback: %s", err) logrus.Debugf("Error retrieving the next available loopback: %s", err)
} }
// OpenFile adds O_CLOEXEC // OpenFile adds O_CLOEXEC
sparseFile, err := os.OpenFile(sparseName, os.O_RDWR, 0644) sparseFile, err := os.OpenFile(sparseName, os.O_RDWR, 0644)
if err != nil { if err != nil {
log.Errorf("Error opening sparse file %s: %s", sparseName, err) logrus.Errorf("Error opening sparse file %s: %s", sparseName, err)
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice
} }
defer sparseFile.Close() defer sparseFile.Close()
@ -115,11 +115,11 @@ func AttachLoopDevice(sparseName string) (loop *os.File, err error) {
} }
if err := ioctlLoopSetStatus64(loopFile.Fd(), loopInfo); err != nil { if err := ioctlLoopSetStatus64(loopFile.Fd(), loopInfo); err != nil {
log.Errorf("Cannot set up loopback device info: %s", err) logrus.Errorf("Cannot set up loopback device info: %s", err)
// If the call failed, then free the loopback device // If the call failed, then free the loopback device
if err := ioctlLoopClrFd(loopFile.Fd()); err != nil { if err := ioctlLoopClrFd(loopFile.Fd()); err != nil {
log.Errorf("Error while cleaning up the loopback device") logrus.Errorf("Error while cleaning up the loopback device")
} }
loopFile.Close() loopFile.Close()
return nil, ErrAttachLoopbackDevice return nil, ErrAttachLoopbackDevice

View File

@ -9,7 +9,7 @@ import (
"runtime" "runtime"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
type DevmapperLogger interface { type DevmapperLogger interface {
@ -237,7 +237,7 @@ func (t *Task) GetNextTarget(next uintptr) (nextPtr uintptr, start uint64,
func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) { func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
loopInfo, err := ioctlLoopGetStatus64(file.Fd()) loopInfo, err := ioctlLoopGetStatus64(file.Fd())
if err != nil { if err != nil {
log.Errorf("Error get loopback backing file: %s", err) logrus.Errorf("Error get loopback backing file: %s", err)
return 0, 0, ErrGetLoopbackBackingFile return 0, 0, ErrGetLoopbackBackingFile
} }
return loopInfo.loDevice, loopInfo.loInode, nil return loopInfo.loDevice, loopInfo.loInode, nil
@ -245,7 +245,7 @@ func getLoopbackBackingFile(file *os.File) (uint64, uint64, error) {
func LoopbackSetCapacity(file *os.File) error { func LoopbackSetCapacity(file *os.File) error {
if err := ioctlLoopSetCapacity(file.Fd(), 0); err != nil { if err := ioctlLoopSetCapacity(file.Fd(), 0); err != nil {
log.Errorf("Error loopbackSetCapacity: %s", err) logrus.Errorf("Error loopbackSetCapacity: %s", err)
return ErrLoopbackSetCapacity return ErrLoopbackSetCapacity
} }
return nil return nil
@ -285,7 +285,7 @@ func FindLoopDeviceFor(file *os.File) *os.File {
func UdevWait(cookie uint) error { func UdevWait(cookie uint) error {
if res := DmUdevWait(cookie); res != 1 { if res := DmUdevWait(cookie); res != 1 {
log.Debugf("Failed to wait on udev cookie %d", cookie) logrus.Debugf("Failed to wait on udev cookie %d", cookie)
return ErrUdevWait return ErrUdevWait
} }
return nil return nil
@ -305,7 +305,7 @@ func LogInit(logger DevmapperLogger) {
func SetDevDir(dir string) error { func SetDevDir(dir string) error {
if res := DmSetDevDir(dir); res != 1 { if res := DmSetDevDir(dir); res != 1 {
log.Debugf("Error dm_set_dev_dir") logrus.Debugf("Error dm_set_dev_dir")
return ErrSetDevDir return ErrSetDevDir
} }
return nil return nil
@ -348,8 +348,8 @@ func CookieSupported() bool {
// Useful helper for cleanup // Useful helper for cleanup
func RemoveDevice(name string) error { func RemoveDevice(name string) error {
log.Debugf("[devmapper] RemoveDevice START(%s)", name) logrus.Debugf("[devmapper] RemoveDevice START(%s)", name)
defer log.Debugf("[devmapper] RemoveDevice END(%s)", name) defer logrus.Debugf("[devmapper] RemoveDevice END(%s)", name)
task, err := TaskCreateNamed(DeviceRemove, name) task, err := TaskCreateNamed(DeviceRemove, name)
if task == nil { if task == nil {
return err return err
@ -375,7 +375,7 @@ func RemoveDevice(name string) error {
func GetBlockDeviceSize(file *os.File) (uint64, error) { func GetBlockDeviceSize(file *os.File) (uint64, error) {
size, err := ioctlBlkGetSize64(file.Fd()) size, err := ioctlBlkGetSize64(file.Fd())
if err != nil { if err != nil {
log.Errorf("Error getblockdevicesize: %s", err) logrus.Errorf("Error getblockdevicesize: %s", err)
return 0, ErrGetBlockSize return 0, ErrGetBlockSize
} }
return uint64(size), nil return uint64(size), nil
@ -494,21 +494,21 @@ func GetDriverVersion() (string, error) {
func GetStatus(name string) (uint64, uint64, string, string, error) { func GetStatus(name string) (uint64, uint64, string, string, error) {
task, err := TaskCreateNamed(DeviceStatus, name) task, err := TaskCreateNamed(DeviceStatus, name)
if task == nil { if task == nil {
log.Debugf("GetStatus: Error TaskCreateNamed: %s", err) logrus.Debugf("GetStatus: Error TaskCreateNamed: %s", err)
return 0, 0, "", "", err return 0, 0, "", "", err
} }
if err := task.Run(); err != nil { if err := task.Run(); err != nil {
log.Debugf("GetStatus: Error Run: %s", err) logrus.Debugf("GetStatus: Error Run: %s", err)
return 0, 0, "", "", err return 0, 0, "", "", err
} }
devinfo, err := task.GetInfo() devinfo, err := task.GetInfo()
if err != nil { if err != nil {
log.Debugf("GetStatus: Error GetInfo: %s", err) logrus.Debugf("GetStatus: Error GetInfo: %s", err)
return 0, 0, "", "", err return 0, 0, "", "", err
} }
if devinfo.Exists == 0 { if devinfo.Exists == 0 {
log.Debugf("GetStatus: Non existing device %s", name) logrus.Debugf("GetStatus: Non existing device %s", name)
return 0, 0, "", "", fmt.Errorf("Non existing device %s", name) return 0, 0, "", "", fmt.Errorf("Non existing device %s", name)
} }
@ -567,7 +567,7 @@ func ResumeDevice(name string) error {
} }
func CreateDevice(poolName string, deviceId int) error { func CreateDevice(poolName string, deviceId int) error {
log.Debugf("[devmapper] CreateDevice(poolName=%v, deviceId=%v)", poolName, deviceId) logrus.Debugf("[devmapper] CreateDevice(poolName=%v, deviceId=%v)", poolName, deviceId)
task, err := TaskCreateNamed(DeviceTargetMsg, poolName) task, err := TaskCreateNamed(DeviceTargetMsg, poolName)
if task == nil { if task == nil {
return err return err

View File

@ -1,7 +1,7 @@
package fileutils package fileutils
import ( import (
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"path/filepath" "path/filepath"
) )
@ -10,15 +10,15 @@ func Matches(relFilePath string, patterns []string) (bool, error) {
for _, exclude := range patterns { for _, exclude := range patterns {
matched, err := filepath.Match(exclude, relFilePath) matched, err := filepath.Match(exclude, relFilePath)
if err != nil { if err != nil {
log.Errorf("Error matching: %s (pattern: %s)", relFilePath, exclude) logrus.Errorf("Error matching: %s (pattern: %s)", relFilePath, exclude)
return false, err return false, err
} }
if matched { if matched {
if filepath.Clean(relFilePath) == "." { if filepath.Clean(relFilePath) == "." {
log.Errorf("Can't exclude whole path, excluding pattern: %s", exclude) logrus.Errorf("Can't exclude whole path, excluding pattern: %s", exclude)
continue continue
} }
log.Debugf("Skipping excluded path: %s", relFilePath) logrus.Debugf("Skipping excluded path: %s", relFilePath)
return true, nil return true, nil
} }
} }

View File

@ -6,7 +6,7 @@ import (
"net/http" "net/http"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
type resumableRequestReader struct { type resumableRequestReader struct {
@ -72,7 +72,7 @@ func (r *resumableRequestReader) Read(p []byte) (n int, err error) {
r.cleanUpResponse() r.cleanUpResponse()
} }
if err != nil && err != io.EOF { if err != nil && err != io.EOF {
log.Infof("encountered error during pull and clearing it before resume: %s", err) logrus.Infof("encountered error during pull and clearing it before resume: %s", err)
err = nil err = nil
} }
return n, err return n, err

View File

@ -9,7 +9,7 @@ import (
"strconv" "strconv"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
type Action string type Action string
@ -283,7 +283,7 @@ func Raw(args ...string) ([]byte, error) {
args = append([]string{"--wait"}, args...) args = append([]string{"--wait"}, args...)
} }
log.Debugf("%s, %v", iptablesPath, args) logrus.Debugf("%s, %v", iptablesPath, args)
output, err := exec.Command(iptablesPath, args...).CombinedOutput() output, err := exec.Command(iptablesPath, args...).CombinedOutput()
if err != nil { if err != nil {

View File

@ -6,7 +6,7 @@ import (
"io" "io"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
type JSONLog struct { type JSONLog struct {
@ -39,7 +39,7 @@ func WriteLog(src io.Reader, dst io.Writer, format string) error {
if err := dec.Decode(l); err == io.EOF { if err := dec.Decode(l); err == io.EOF {
return nil return nil
} else if err != nil { } else if err != nil {
log.Printf("Error streaming logs: %s", err) logrus.Printf("Error streaming logs: %s", err)
return err return err
} }
line, err := l.Format(format) line, err := l.Format(format)

View File

@ -5,7 +5,7 @@ import (
"net" "net"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
type TCPProxy struct { type TCPProxy struct {
@ -31,7 +31,7 @@ func NewTCPProxy(frontendAddr, backendAddr *net.TCPAddr) (*TCPProxy, error) {
func (proxy *TCPProxy) clientLoop(client *net.TCPConn, quit chan bool) { func (proxy *TCPProxy) clientLoop(client *net.TCPConn, quit chan bool) {
backend, err := net.DialTCP("tcp", nil, proxy.backendAddr) backend, err := net.DialTCP("tcp", nil, proxy.backendAddr)
if err != nil { if err != nil {
log.Printf("Can't forward traffic to backend tcp/%v: %s\n", proxy.backendAddr, err) logrus.Printf("Can't forward traffic to backend tcp/%v: %s\n", proxy.backendAddr, err)
client.Close() client.Close()
return return
} }
@ -78,7 +78,7 @@ func (proxy *TCPProxy) Run() {
for { for {
client, err := proxy.listener.Accept() client, err := proxy.listener.Accept()
if err != nil { if err != nil {
log.Printf("Stopping proxy on tcp/%v for tcp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err) logrus.Printf("Stopping proxy on tcp/%v for tcp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err)
return return
} }
go proxy.clientLoop(client.(*net.TCPConn), quit) go proxy.clientLoop(client.(*net.TCPConn), quit)

View File

@ -8,7 +8,7 @@ import (
"syscall" "syscall"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
const ( const (
@ -105,7 +105,7 @@ func (proxy *UDPProxy) Run() {
// ECONNREFUSED like Read do (see comment in // ECONNREFUSED like Read do (see comment in
// UDPProxy.replyLoop) // UDPProxy.replyLoop)
if !isClosedError(err) { if !isClosedError(err) {
log.Printf("Stopping proxy on udp/%v for udp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err) logrus.Printf("Stopping proxy on udp/%v for udp/%v (%s)", proxy.frontendAddr, proxy.backendAddr, err)
} }
break break
} }
@ -116,7 +116,7 @@ func (proxy *UDPProxy) Run() {
if !hit { if !hit {
proxyConn, err = net.DialUDP("udp", nil, proxy.backendAddr) proxyConn, err = net.DialUDP("udp", nil, proxy.backendAddr)
if err != nil { if err != nil {
log.Printf("Can't proxy a datagram to udp/%s: %s\n", proxy.backendAddr, err) logrus.Printf("Can't proxy a datagram to udp/%s: %s\n", proxy.backendAddr, err)
proxy.connTrackLock.Unlock() proxy.connTrackLock.Unlock()
continue continue
} }
@ -127,7 +127,7 @@ func (proxy *UDPProxy) Run() {
for i := 0; i != read; { for i := 0; i != read; {
written, err := proxyConn.Write(readBuf[i:read]) written, err := proxyConn.Write(readBuf[i:read])
if err != nil { if err != nil {
log.Printf("Can't proxy a datagram to udp/%s: %s\n", proxy.backendAddr, err) logrus.Printf("Can't proxy a datagram to udp/%s: %s\n", proxy.backendAddr, err)
break break
} }
i += written i += written

View File

@ -8,7 +8,7 @@ import (
"strings" "strings"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )
@ -99,10 +99,10 @@ func FilterResolvDns(resolvConf []byte, ipv6Enabled bool) ([]byte, bool) {
// if the resulting resolvConf has no more nameservers defined, add appropriate // if the resulting resolvConf has no more nameservers defined, add appropriate
// default DNS servers for IPv4 and (optionally) IPv6 // default DNS servers for IPv4 and (optionally) IPv6
if len(GetNameservers(cleanedResolvConf)) == 0 { if len(GetNameservers(cleanedResolvConf)) == 0 {
log.Infof("No non-localhost DNS nameservers are left in resolv.conf. Using default external servers : %v", defaultIPv4Dns) logrus.Infof("No non-localhost DNS nameservers are left in resolv.conf. Using default external servers : %v", defaultIPv4Dns)
dns := defaultIPv4Dns dns := defaultIPv4Dns
if ipv6Enabled { if ipv6Enabled {
log.Infof("IPv6 enabled; Adding default IPv6 external servers : %v", defaultIPv6Dns) logrus.Infof("IPv6 enabled; Adding default IPv6 external servers : %v", defaultIPv6Dns)
dns = append(dns, defaultIPv6Dns...) dns = append(dns, defaultIPv6Dns...)
} }
cleanedResolvConf = append(cleanedResolvConf, []byte("\n"+strings.Join(dns, "\n"))...) cleanedResolvConf = append(cleanedResolvConf, []byte("\n"+strings.Join(dns, "\n"))...)

View File

@ -6,7 +6,7 @@ import (
"sync/atomic" "sync/atomic"
"syscall" "syscall"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
// Trap sets up a simplified signal "trap", appropriate for common // Trap sets up a simplified signal "trap", appropriate for common
@ -29,7 +29,7 @@ func Trap(cleanup func()) {
interruptCount := uint32(0) interruptCount := uint32(0)
for sig := range c { for sig := range c {
go func(sig os.Signal) { go func(sig os.Signal) {
log.Infof("Received signal '%v', starting shutdown of docker...", sig) logrus.Infof("Received signal '%v', starting shutdown of docker...", sig)
switch sig { switch sig {
case os.Interrupt, syscall.SIGTERM: case os.Interrupt, syscall.SIGTERM:
// If the user really wants to interrupt, let him do so. // If the user really wants to interrupt, let him do so.
@ -43,7 +43,7 @@ func Trap(cleanup func()) {
return return
} }
} else { } else {
log.Infof("Force shutdown of docker, interrupting cleanup") logrus.Infof("Force shutdown of docker, interrupting cleanup")
} }
case syscall.SIGQUIT: case syscall.SIGQUIT:
} }

View File

@ -5,7 +5,7 @@ import (
"errors" "errors"
"io" "io"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
const ( const (
@ -95,13 +95,13 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
nr += nr2 nr += nr2
if er == io.EOF { if er == io.EOF {
if nr < StdWriterPrefixLen { if nr < StdWriterPrefixLen {
log.Debugf("Corrupted prefix: %v", buf[:nr]) logrus.Debugf("Corrupted prefix: %v", buf[:nr])
return written, nil return written, nil
} }
break break
} }
if er != nil { if er != nil {
log.Debugf("Error reading header: %s", er) logrus.Debugf("Error reading header: %s", er)
return 0, er return 0, er
} }
} }
@ -117,18 +117,18 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
// Write on stderr // Write on stderr
out = dsterr out = dsterr
default: default:
log.Debugf("Error selecting output fd: (%d)", buf[StdWriterFdIndex]) logrus.Debugf("Error selecting output fd: (%d)", buf[StdWriterFdIndex])
return 0, ErrInvalidStdHeader return 0, ErrInvalidStdHeader
} }
// Retrieve the size of the frame // Retrieve the size of the frame
frameSize = int(binary.BigEndian.Uint32(buf[StdWriterSizeIndex : StdWriterSizeIndex+4])) frameSize = int(binary.BigEndian.Uint32(buf[StdWriterSizeIndex : StdWriterSizeIndex+4]))
log.Debugf("framesize: %d", frameSize) logrus.Debugf("framesize: %d", frameSize)
// Check if the buffer is big enough to read the frame. // Check if the buffer is big enough to read the frame.
// Extend it if necessary. // Extend it if necessary.
if frameSize+StdWriterPrefixLen > bufLen { if frameSize+StdWriterPrefixLen > bufLen {
log.Debugf("Extending buffer cap by %d (was %d)", frameSize+StdWriterPrefixLen-bufLen+1, len(buf)) logrus.Debugf("Extending buffer cap by %d (was %d)", frameSize+StdWriterPrefixLen-bufLen+1, len(buf))
buf = append(buf, make([]byte, frameSize+StdWriterPrefixLen-bufLen+1)...) buf = append(buf, make([]byte, frameSize+StdWriterPrefixLen-bufLen+1)...)
bufLen = len(buf) bufLen = len(buf)
} }
@ -140,13 +140,13 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
nr += nr2 nr += nr2
if er == io.EOF { if er == io.EOF {
if nr < frameSize+StdWriterPrefixLen { if nr < frameSize+StdWriterPrefixLen {
log.Debugf("Corrupted frame: %v", buf[StdWriterPrefixLen:nr]) logrus.Debugf("Corrupted frame: %v", buf[StdWriterPrefixLen:nr])
return written, nil return written, nil
} }
break break
} }
if er != nil { if er != nil {
log.Debugf("Error reading frame: %s", er) logrus.Debugf("Error reading frame: %s", er)
return 0, er return 0, er
} }
} }
@ -154,12 +154,12 @@ func StdCopy(dstout, dsterr io.Writer, src io.Reader) (written int64, err error)
// Write the retrieved frame (without header) // Write the retrieved frame (without header)
nw, ew = out.Write(buf[StdWriterPrefixLen : frameSize+StdWriterPrefixLen]) nw, ew = out.Write(buf[StdWriterPrefixLen : frameSize+StdWriterPrefixLen])
if ew != nil { if ew != nil {
log.Debugf("Error writing frame: %s", ew) logrus.Debugf("Error writing frame: %s", ew)
return 0, ew return 0, ew
} }
// If the frame has not been fully written: error // If the frame has not been fully written: error
if nw != frameSize { if nw != frameSize {
log.Debugf("Error Short Write: (%d on %d)", nw, frameSize) logrus.Debugf("Error Short Write: (%d on %d)", nw, frameSize)
return 0, io.ErrShortWrite return 0, io.ErrShortWrite
} }
written += int64(nw) written += int64(nw)

View File

@ -5,7 +5,7 @@ import (
"os" "os"
"path" "path"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/libcontainer/cgroups" "github.com/docker/libcontainer/cgroups"
) )
@ -20,20 +20,20 @@ func New(quiet bool) *SysInfo {
sysInfo := &SysInfo{} sysInfo := &SysInfo{}
if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil { if cgroupMemoryMountpoint, err := cgroups.FindCgroupMountpoint("memory"); err != nil {
if !quiet { if !quiet {
log.Warnf("%s", err) logrus.Warnf("%s", err)
} }
} else { } else {
_, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes")) _, err1 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.limit_in_bytes"))
_, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes")) _, err2 := ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.soft_limit_in_bytes"))
sysInfo.MemoryLimit = err1 == nil && err2 == nil sysInfo.MemoryLimit = err1 == nil && err2 == nil
if !sysInfo.MemoryLimit && !quiet { if !sysInfo.MemoryLimit && !quiet {
log.Warnf("Your kernel does not support cgroup memory limit.") logrus.Warnf("Your kernel does not support cgroup memory limit.")
} }
_, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes")) _, err = ioutil.ReadFile(path.Join(cgroupMemoryMountpoint, "memory.memsw.limit_in_bytes"))
sysInfo.SwapLimit = err == nil sysInfo.SwapLimit = err == nil
if !sysInfo.SwapLimit && !quiet { if !sysInfo.SwapLimit && !quiet {
log.Warnf("Your kernel does not support cgroup swap limit.") logrus.Warnf("Your kernel does not support cgroup swap limit.")
} }
} }

View File

@ -13,7 +13,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )
@ -66,7 +66,7 @@ func (auth *RequestAuthorization) getToken() (string, error) {
defer auth.tokenLock.Unlock() defer auth.tokenLock.Unlock()
now := time.Now() now := time.Now()
if now.Before(auth.tokenExpiration) { if now.Before(auth.tokenExpiration) {
log.Debugf("Using cached token for %s", auth.authConfig.Username) logrus.Debugf("Using cached token for %s", auth.authConfig.Username)
return auth.tokenCache, nil return auth.tokenCache, nil
} }
@ -78,7 +78,7 @@ func (auth *RequestAuthorization) getToken() (string, error) {
case "basic": case "basic":
// no token necessary // no token necessary
case "bearer": case "bearer":
log.Debugf("Getting bearer token with %s for %s", challenge.Parameters, auth.authConfig.Username) logrus.Debugf("Getting bearer token with %s for %s", challenge.Parameters, auth.authConfig.Username)
params := map[string]string{} params := map[string]string{}
for k, v := range challenge.Parameters { for k, v := range challenge.Parameters {
params[k] = v params[k] = v
@ -93,7 +93,7 @@ func (auth *RequestAuthorization) getToken() (string, error) {
return token, nil return token, nil
default: default:
log.Infof("Unsupported auth scheme: %q", challenge.Scheme) logrus.Infof("Unsupported auth scheme: %q", challenge.Scheme)
} }
} }
@ -245,7 +245,7 @@ func loginV1(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.
serverAddress = authConfig.ServerAddress serverAddress = authConfig.ServerAddress
) )
log.Debugf("attempting v1 login to registry endpoint %s", registryEndpoint) logrus.Debugf("attempting v1 login to registry endpoint %s", registryEndpoint)
if serverAddress == "" { if serverAddress == "" {
return "", fmt.Errorf("Server Error: Server Address not set.") return "", fmt.Errorf("Server Error: Server Address not set.")
@ -349,7 +349,7 @@ func loginV1(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.
// served by the v2 registry service provider. Whether this will be supported in the future // served by the v2 registry service provider. Whether this will be supported in the future
// is to be determined. // is to be determined.
func loginV2(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.HTTPRequestFactory) (string, error) { func loginV2(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.HTTPRequestFactory) (string, error) {
log.Debugf("attempting v2 login to registry endpoint %s", registryEndpoint) logrus.Debugf("attempting v2 login to registry endpoint %s", registryEndpoint)
var ( var (
err error err error
allErrors []error allErrors []error
@ -357,7 +357,7 @@ func loginV2(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.
) )
for _, challenge := range registryEndpoint.AuthChallenges { for _, challenge := range registryEndpoint.AuthChallenges {
log.Debugf("trying %q auth challenge with params %s", challenge.Scheme, challenge.Parameters) logrus.Debugf("trying %q auth challenge with params %s", challenge.Scheme, challenge.Parameters)
switch strings.ToLower(challenge.Scheme) { switch strings.ToLower(challenge.Scheme) {
case "basic": case "basic":
@ -373,7 +373,7 @@ func loginV2(authConfig *AuthConfig, registryEndpoint *Endpoint, factory *utils.
return "Login Succeeded", nil return "Login Succeeded", nil
} }
log.Debugf("error trying auth challenge %q: %s", challenge.Scheme, err) logrus.Debugf("error trying auth challenge %q: %s", challenge.Scheme, err)
allErrors = append(allErrors, err) allErrors = append(allErrors, err)
} }

View File

@ -10,7 +10,7 @@ import (
"net/url" "net/url"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/registry/v2" "github.com/docker/docker/registry/v2"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
) )
@ -57,7 +57,7 @@ func NewEndpoint(index *IndexInfo) (*Endpoint, error) {
} }
func validateEndpoint(endpoint *Endpoint) error { func validateEndpoint(endpoint *Endpoint) error {
log.Debugf("pinging registry endpoint %s", endpoint) logrus.Debugf("pinging registry endpoint %s", endpoint)
// Try HTTPS ping to registry // Try HTTPS ping to registry
endpoint.URL.Scheme = "https" endpoint.URL.Scheme = "https"
@ -69,7 +69,7 @@ func validateEndpoint(endpoint *Endpoint) error {
} }
// If registry is insecure and HTTPS failed, fallback to HTTP. // If registry is insecure and HTTPS failed, fallback to HTTP.
log.Debugf("Error from registry %q marked as insecure: %v. Insecurely falling back to HTTP", endpoint, err) logrus.Debugf("Error from registry %q marked as insecure: %v. Insecurely falling back to HTTP", endpoint, err)
endpoint.URL.Scheme = "http" endpoint.URL.Scheme = "http"
var err2 error var err2 error
@ -163,7 +163,7 @@ func (e *Endpoint) Ping() (RegistryInfo, error) {
} }
func (e *Endpoint) pingV1(factory *utils.HTTPRequestFactory) (RegistryInfo, error) { func (e *Endpoint) pingV1(factory *utils.HTTPRequestFactory) (RegistryInfo, error) {
log.Debugf("attempting v1 ping for registry endpoint %s", e) logrus.Debugf("attempting v1 ping for registry endpoint %s", e)
if e.String() == IndexServerAddress() { if e.String() == IndexServerAddress() {
// Skip the check, we know this one is valid // Skip the check, we know this one is valid
@ -194,17 +194,17 @@ func (e *Endpoint) pingV1(factory *utils.HTTPRequestFactory) (RegistryInfo, erro
Standalone: true, Standalone: true,
} }
if err := json.Unmarshal(jsonString, &info); err != nil { if err := json.Unmarshal(jsonString, &info); err != nil {
log.Debugf("Error unmarshalling the _ping RegistryInfo: %s", err) logrus.Debugf("Error unmarshalling the _ping RegistryInfo: %s", err)
// don't stop here. Just assume sane defaults // don't stop here. Just assume sane defaults
} }
if hdr := resp.Header.Get("X-Docker-Registry-Version"); hdr != "" { if hdr := resp.Header.Get("X-Docker-Registry-Version"); hdr != "" {
log.Debugf("Registry version header: '%s'", hdr) logrus.Debugf("Registry version header: '%s'", hdr)
info.Version = hdr info.Version = hdr
} }
log.Debugf("RegistryInfo.Version: %q", info.Version) logrus.Debugf("RegistryInfo.Version: %q", info.Version)
standalone := resp.Header.Get("X-Docker-Registry-Standalone") standalone := resp.Header.Get("X-Docker-Registry-Standalone")
log.Debugf("Registry standalone header: '%s'", standalone) logrus.Debugf("Registry standalone header: '%s'", standalone)
// Accepted values are "true" (case-insensitive) and "1". // Accepted values are "true" (case-insensitive) and "1".
if strings.EqualFold(standalone, "true") || standalone == "1" { if strings.EqualFold(standalone, "true") || standalone == "1" {
info.Standalone = true info.Standalone = true
@ -212,12 +212,12 @@ func (e *Endpoint) pingV1(factory *utils.HTTPRequestFactory) (RegistryInfo, erro
// there is a header set, and it is not "true" or "1", so assume fails // there is a header set, and it is not "true" or "1", so assume fails
info.Standalone = false info.Standalone = false
} }
log.Debugf("RegistryInfo.Standalone: %t", info.Standalone) logrus.Debugf("RegistryInfo.Standalone: %t", info.Standalone)
return info, nil return info, nil
} }
func (e *Endpoint) pingV2(factory *utils.HTTPRequestFactory) (RegistryInfo, error) { func (e *Endpoint) pingV2(factory *utils.HTTPRequestFactory) (RegistryInfo, error) {
log.Debugf("attempting v2 ping for registry endpoint %s", e) logrus.Debugf("attempting v2 ping for registry endpoint %s", e)
req, err := factory.NewRequest("GET", e.Path(""), nil) req, err := factory.NewRequest("GET", e.Path(""), nil)
if err != nil { if err != nil {

View File

@ -13,7 +13,7 @@ import (
"strings" "strings"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/timeoutconn" "github.com/docker/docker/pkg/timeoutconn"
) )
@ -100,7 +100,7 @@ func doRequest(req *http.Request, jar http.CookieJar, timeout TimeoutType, secur
} }
hostDir := path.Join("/etc/docker/certs.d", req.URL.Host) hostDir := path.Join("/etc/docker/certs.d", req.URL.Host)
log.Debugf("hostDir: %s", hostDir) logrus.Debugf("hostDir: %s", hostDir)
fs, err := ioutil.ReadDir(hostDir) fs, err := ioutil.ReadDir(hostDir)
if err != nil && !os.IsNotExist(err) { if err != nil && !os.IsNotExist(err) {
return nil, nil, err return nil, nil, err
@ -111,7 +111,7 @@ func doRequest(req *http.Request, jar http.CookieJar, timeout TimeoutType, secur
if pool == nil { if pool == nil {
pool = x509.NewCertPool() pool = x509.NewCertPool()
} }
log.Debugf("crt: %s", hostDir+"/"+f.Name()) logrus.Debugf("crt: %s", hostDir+"/"+f.Name())
data, err := ioutil.ReadFile(path.Join(hostDir, f.Name())) data, err := ioutil.ReadFile(path.Join(hostDir, f.Name()))
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@ -121,7 +121,7 @@ func doRequest(req *http.Request, jar http.CookieJar, timeout TimeoutType, secur
if strings.HasSuffix(f.Name(), ".cert") { if strings.HasSuffix(f.Name(), ".cert") {
certName := f.Name() certName := f.Name()
keyName := certName[:len(certName)-5] + ".key" keyName := certName[:len(certName)-5] + ".key"
log.Debugf("cert: %s", hostDir+"/"+f.Name()) logrus.Debugf("cert: %s", hostDir+"/"+f.Name())
if !hasFile(fs, keyName) { if !hasFile(fs, keyName) {
return nil, nil, fmt.Errorf("Missing key %s for certificate %s", keyName, certName) return nil, nil, fmt.Errorf("Missing key %s for certificate %s", keyName, certName)
} }
@ -134,7 +134,7 @@ func doRequest(req *http.Request, jar http.CookieJar, timeout TimeoutType, secur
if strings.HasSuffix(f.Name(), ".key") { if strings.HasSuffix(f.Name(), ".key") {
keyName := f.Name() keyName := f.Name()
certName := keyName[:len(keyName)-4] + ".cert" certName := keyName[:len(keyName)-4] + ".cert"
log.Debugf("key: %s", hostDir+"/"+f.Name()) logrus.Debugf("key: %s", hostDir+"/"+f.Name())
if !hasFile(fs, certName) { if !hasFile(fs, certName) {
return nil, nil, fmt.Errorf("Missing certificate %s for key %s", certName, keyName) return nil, nil, fmt.Errorf("Missing certificate %s for key %s", certName, keyName)
} }

View File

@ -18,7 +18,7 @@ import (
"github.com/docker/docker/opts" "github.com/docker/docker/opts"
"github.com/gorilla/mux" "github.com/gorilla/mux"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
var ( var (
@ -134,7 +134,7 @@ func init() {
func handlerAccessLog(handler http.Handler) http.Handler { func handlerAccessLog(handler http.Handler) http.Handler {
logHandler := func(w http.ResponseWriter, r *http.Request) { logHandler := func(w http.ResponseWriter, r *http.Request) {
log.Debugf("%s \"%s %s\"", r.RemoteAddr, r.Method, r.URL) logrus.Debugf("%s \"%s %s\"", r.RemoteAddr, r.Method, r.URL)
handler.ServeHTTP(w, r) handler.ServeHTTP(w, r)
} }
return http.HandlerFunc(logHandler) return http.HandlerFunc(logHandler)
@ -467,7 +467,7 @@ func TestPing(t *testing.T) {
* WARNING: Don't push on the repos uncommented, it'll block the tests * WARNING: Don't push on the repos uncommented, it'll block the tests
* *
func TestWait(t *testing.T) { func TestWait(t *testing.T) {
log.Println("Test HTTP server ready and waiting:", testHttpServer.URL) logrus.Println("Test HTTP server ready and waiting:", testHttpServer.URL)
c := make(chan int) c := make(chan int)
<-c <-c
} }

View File

@ -3,7 +3,7 @@ package registry
import ( import (
"fmt" "fmt"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
) )
@ -62,18 +62,18 @@ func (s *Service) Auth(job *engine.Job) error {
} }
if endpoint, err = NewEndpoint(index); err != nil { if endpoint, err = NewEndpoint(index); err != nil {
log.Errorf("unable to get new registry endpoint: %s", err) logrus.Errorf("unable to get new registry endpoint: %s", err)
return err return err
} }
authConfig.ServerAddress = endpoint.String() authConfig.ServerAddress = endpoint.String()
if status, err = Login(authConfig, endpoint, HTTPRequestFactory(nil)); err != nil { if status, err = Login(authConfig, endpoint, HTTPRequestFactory(nil)); err != nil {
log.Errorf("unable to login against registry endpoint %s: %s", endpoint, err) logrus.Errorf("unable to login against registry endpoint %s: %s", endpoint, err)
return err return err
} }
log.Infof("successful registry login for endpoint %s: %s", endpoint, status) logrus.Infof("successful registry login for endpoint %s: %s", endpoint, status)
job.Printf("%s\n", status) job.Printf("%s\n", status)
return nil return nil

View File

@ -17,7 +17,7 @@ import (
"strings" "strings"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/httputils" "github.com/docker/docker/pkg/httputils"
"github.com/docker/docker/pkg/tarsum" "github.com/docker/docker/pkg/tarsum"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
@ -54,7 +54,7 @@ func NewSession(authConfig *AuthConfig, factory *utils.HTTPRequestFactory, endpo
return nil, err return nil, err
} }
if info.Standalone { if info.Standalone {
log.Debugf("Endpoint %s is eligible for private registry. Enabling decorator.", r.indexEndpoint.String()) logrus.Debugf("Endpoint %s is eligible for private registry. Enabling decorator.", r.indexEndpoint.String())
dec := utils.NewHTTPAuthDecorator(authConfig.Username, authConfig.Password) dec := utils.NewHTTPAuthDecorator(authConfig.Username, authConfig.Password)
factory.AddDecorator(dec) factory.AddDecorator(dec)
} }
@ -93,7 +93,7 @@ func (r *Session) GetRemoteHistory(imgID, registry string, token []string) ([]st
return nil, fmt.Errorf("Error while reading the http response: %s", err) return nil, fmt.Errorf("Error while reading the http response: %s", err)
} }
log.Debugf("Ancestry: %s", jsonString) logrus.Debugf("Ancestry: %s", jsonString)
history := new([]string) history := new([]string)
if err := json.Unmarshal(jsonString, history); err != nil { if err := json.Unmarshal(jsonString, history); err != nil {
return nil, err return nil, err
@ -169,7 +169,7 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, im
statusCode = 0 statusCode = 0
res, client, err = r.doRequest(req) res, client, err = r.doRequest(req)
if err != nil { if err != nil {
log.Debugf("Error contacting registry: %s", err) logrus.Debugf("Error contacting registry: %s", err)
if res != nil { if res != nil {
if res.Body != nil { if res.Body != nil {
res.Body.Close() res.Body.Close()
@ -193,10 +193,10 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, token []string, im
} }
if res.Header.Get("Accept-Ranges") == "bytes" && imgSize > 0 { if res.Header.Get("Accept-Ranges") == "bytes" && imgSize > 0 {
log.Debugf("server supports resume") logrus.Debugf("server supports resume")
return httputils.ResumableRequestReaderWithInitialResponse(client, req, 5, imgSize, res), nil return httputils.ResumableRequestReaderWithInitialResponse(client, req, 5, imgSize, res), nil
} }
log.Debugf("server doesn't support resume") logrus.Debugf("server doesn't support resume")
return res.Body, nil return res.Body, nil
} }
@ -219,7 +219,7 @@ func (r *Session) GetRemoteTags(registries []string, repository string, token []
return nil, err return nil, err
} }
log.Debugf("Got status code %d from %s", res.StatusCode, endpoint) logrus.Debugf("Got status code %d from %s", res.StatusCode, endpoint)
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != 200 && res.StatusCode != 404 { if res.StatusCode != 200 && res.StatusCode != 404 {
@ -259,7 +259,7 @@ func buildEndpointsList(headers []string, indexEp string) ([]string, error) {
func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) { func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) {
repositoryTarget := fmt.Sprintf("%srepositories/%s/images", r.indexEndpoint.VersionString(1), remote) repositoryTarget := fmt.Sprintf("%srepositories/%s/images", r.indexEndpoint.VersionString(1), remote)
log.Debugf("[registry] Calling GET %s", repositoryTarget) logrus.Debugf("[registry] Calling GET %s", repositoryTarget)
req, err := r.reqFactory.NewRequest("GET", repositoryTarget, nil) req, err := r.reqFactory.NewRequest("GET", repositoryTarget, nil)
if err != nil { if err != nil {
@ -285,7 +285,7 @@ func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) {
} else if res.StatusCode != 200 { } else if res.StatusCode != 200 {
errBody, err := ioutil.ReadAll(res.Body) errBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
log.Debugf("Error reading response body: %s", err) logrus.Debugf("Error reading response body: %s", err)
} }
return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to pull repository %s: %q", res.StatusCode, remote, errBody), res) return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to pull repository %s: %q", res.StatusCode, remote, errBody), res)
} }
@ -326,7 +326,7 @@ func (r *Session) GetRepositoryData(remote string) (*RepositoryData, error) {
func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error { func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string, token []string) error {
log.Debugf("[registry] Calling PUT %s", registry+"images/"+imgData.ID+"/checksum") logrus.Debugf("[registry] Calling PUT %s", registry+"images/"+imgData.ID+"/checksum")
req, err := r.reqFactory.NewRequest("PUT", registry+"images/"+imgData.ID+"/checksum", nil) req, err := r.reqFactory.NewRequest("PUT", registry+"images/"+imgData.ID+"/checksum", nil)
if err != nil { if err != nil {
@ -363,7 +363,7 @@ func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string, t
// Push a local image to the registry // Push a local image to the registry
func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error { func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, registry string, token []string) error {
log.Debugf("[registry] Calling PUT %s", registry+"images/"+imgData.ID+"/json") logrus.Debugf("[registry] Calling PUT %s", registry+"images/"+imgData.ID+"/json")
req, err := r.reqFactory.NewRequest("PUT", registry+"images/"+imgData.ID+"/json", bytes.NewReader(jsonRaw)) req, err := r.reqFactory.NewRequest("PUT", registry+"images/"+imgData.ID+"/json", bytes.NewReader(jsonRaw))
if err != nil { if err != nil {
@ -398,7 +398,7 @@ func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, regist
func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error) { func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry string, token []string, jsonRaw []byte) (checksum string, checksumPayload string, err error) {
log.Debugf("[registry] Calling PUT %s", registry+"images/"+imgID+"/layer") logrus.Debugf("[registry] Calling PUT %s", registry+"images/"+imgID+"/layer")
tarsumLayer, err := tarsum.NewTarSum(layer, false, tarsum.Version0) tarsumLayer, err := tarsum.NewTarSum(layer, false, tarsum.Version0)
if err != nil { if err != nil {
@ -486,8 +486,8 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
suffix = "images" suffix = "images"
} }
u := fmt.Sprintf("%srepositories/%s/%s", r.indexEndpoint.VersionString(1), remote, suffix) u := fmt.Sprintf("%srepositories/%s/%s", r.indexEndpoint.VersionString(1), remote, suffix)
log.Debugf("[registry] PUT %s", u) logrus.Debugf("[registry] PUT %s", u)
log.Debugf("Image list pushed to index:\n%s", imgListJSON) logrus.Debugf("Image list pushed to index:\n%s", imgListJSON)
headers := map[string][]string{ headers := map[string][]string{
"Content-type": {"application/json"}, "Content-type": {"application/json"},
"X-Docker-Token": {"true"}, "X-Docker-Token": {"true"},
@ -507,7 +507,7 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
} }
res.Body.Close() res.Body.Close()
u = res.Header.Get("Location") u = res.Header.Get("Location")
log.Debugf("Redirected to %s", u) logrus.Debugf("Redirected to %s", u)
} }
defer res.Body.Close() defer res.Body.Close()
@ -520,13 +520,13 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
if res.StatusCode != 200 && res.StatusCode != 201 { if res.StatusCode != 200 && res.StatusCode != 201 {
errBody, err := ioutil.ReadAll(res.Body) errBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
log.Debugf("Error reading response body: %s", err) logrus.Debugf("Error reading response body: %s", err)
} }
return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to push repository %s: %q", res.StatusCode, remote, errBody), res) return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to push repository %s: %q", res.StatusCode, remote, errBody), res)
} }
if res.Header.Get("X-Docker-Token") != "" { if res.Header.Get("X-Docker-Token") != "" {
tokens = res.Header["X-Docker-Token"] tokens = res.Header["X-Docker-Token"]
log.Debugf("Auth token: %v", tokens) logrus.Debugf("Auth token: %v", tokens)
} else { } else {
return nil, fmt.Errorf("Index response didn't contain an access token") return nil, fmt.Errorf("Index response didn't contain an access token")
} }
@ -544,7 +544,7 @@ func (r *Session) PushImageJSONIndex(remote string, imgList []*ImgData, validate
if res.StatusCode != 204 { if res.StatusCode != 204 {
errBody, err := ioutil.ReadAll(res.Body) errBody, err := ioutil.ReadAll(res.Body)
if err != nil { if err != nil {
log.Debugf("Error reading response body: %s", err) logrus.Debugf("Error reading response body: %s", err)
} }
return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to push checksums %s: %q", res.StatusCode, remote, errBody), res) return nil, utils.NewHTTPRequestError(fmt.Sprintf("Error: Status %d trying to push checksums %s: %q", res.StatusCode, remote, errBody), res)
} }
@ -578,7 +578,7 @@ func shouldRedirect(response *http.Response) bool {
} }
func (r *Session) SearchRepositories(term string) (*SearchResults, error) { func (r *Session) SearchRepositories(term string) (*SearchResults, error) {
log.Debugf("Index server: %s", r.indexEndpoint) logrus.Debugf("Index server: %s", r.indexEndpoint)
u := r.indexEndpoint.VersionString(1) + "search?q=" + url.QueryEscape(term) u := r.indexEndpoint.VersionString(1) + "search?q=" + url.QueryEscape(term)
req, err := r.reqFactory.NewRequest("GET", u, nil) req, err := r.reqFactory.NewRequest("GET", u, nil)
if err != nil { if err != nil {

View File

@ -9,7 +9,7 @@ import (
"net/http" "net/http"
"strconv" "strconv"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest" "github.com/docker/distribution/digest"
"github.com/docker/docker/registry/v2" "github.com/docker/docker/registry/v2"
"github.com/docker/docker/utils" "github.com/docker/docker/utils"
@ -57,7 +57,7 @@ func (r *Session) GetV2Authorization(ep *Endpoint, imageName string, readOnly bo
scopes = append(scopes, "push") scopes = append(scopes, "push")
} }
log.Debugf("Getting authorization for %s %s", imageName, scopes) logrus.Debugf("Getting authorization for %s %s", imageName, scopes)
return NewRequestAuthorization(r.GetAuthConfig(true), ep, "repository", imageName, scopes), nil return NewRequestAuthorization(r.GetAuthConfig(true), ep, "repository", imageName, scopes), nil
} }
@ -75,7 +75,7 @@ func (r *Session) GetV2ImageManifest(ep *Endpoint, imageName, tagName string, au
} }
method := "GET" method := "GET"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, nil) req, err := r.reqFactory.NewRequest(method, routeURL, nil)
if err != nil { if err != nil {
@ -116,7 +116,7 @@ func (r *Session) HeadV2ImageBlob(ep *Endpoint, imageName, sumType, sum string,
} }
method := "HEAD" method := "HEAD"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, nil) req, err := r.reqFactory.NewRequest(method, routeURL, nil)
if err != nil { if err != nil {
@ -151,7 +151,7 @@ func (r *Session) GetV2ImageBlob(ep *Endpoint, imageName, sumType, sum string, b
} }
method := "GET" method := "GET"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, nil) req, err := r.reqFactory.NewRequest(method, routeURL, nil)
if err != nil { if err != nil {
return err return err
@ -182,7 +182,7 @@ func (r *Session) GetV2ImageBlobReader(ep *Endpoint, imageName, sumType, sum str
} }
method := "GET" method := "GET"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, nil) req, err := r.reqFactory.NewRequest(method, routeURL, nil)
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
@ -219,7 +219,7 @@ func (r *Session) PutV2ImageBlob(ep *Endpoint, imageName, sumType, sumStr string
} }
method := "PUT" method := "PUT"
log.Debugf("[registry] Calling %q %s", method, location) logrus.Debugf("[registry] Calling %q %s", method, location)
req, err := r.reqFactory.NewRequest(method, location, ioutil.NopCloser(blobRdr)) req, err := r.reqFactory.NewRequest(method, location, ioutil.NopCloser(blobRdr))
if err != nil { if err != nil {
return err return err
@ -244,7 +244,7 @@ func (r *Session) PutV2ImageBlob(ep *Endpoint, imageName, sumType, sumStr string
if err != nil { if err != nil {
return err return err
} }
log.Debugf("Unexpected response from server: %q %#v", errBody, res.Header) logrus.Debugf("Unexpected response from server: %q %#v", errBody, res.Header)
return utils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to push %s blob - %s:%s", res.StatusCode, imageName, sumType, sumStr), res) return utils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to push %s blob - %s:%s", res.StatusCode, imageName, sumType, sumStr), res)
} }
@ -258,7 +258,7 @@ func (r *Session) initiateBlobUpload(ep *Endpoint, imageName string, auth *Reque
return "", err return "", err
} }
log.Debugf("[registry] Calling %q %s", "POST", routeURL) logrus.Debugf("[registry] Calling %q %s", "POST", routeURL)
req, err := r.reqFactory.NewRequest("POST", routeURL, nil) req, err := r.reqFactory.NewRequest("POST", routeURL, nil)
if err != nil { if err != nil {
return "", err return "", err
@ -285,7 +285,7 @@ func (r *Session) initiateBlobUpload(ep *Endpoint, imageName string, auth *Reque
return "", err return "", err
} }
log.Debugf("Unexpected response from server: %q %#v", errBody, res.Header) logrus.Debugf("Unexpected response from server: %q %#v", errBody, res.Header)
return "", utils.NewHTTPRequestError(fmt.Sprintf("Server error: unexpected %d response status trying to initiate upload of %s", res.StatusCode, imageName), res) return "", utils.NewHTTPRequestError(fmt.Sprintf("Server error: unexpected %d response status trying to initiate upload of %s", res.StatusCode, imageName), res)
} }
@ -304,7 +304,7 @@ func (r *Session) PutV2ImageManifest(ep *Endpoint, imageName, tagName string, si
} }
method := "PUT" method := "PUT"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, bytes.NewReader(signedManifest)) req, err := r.reqFactory.NewRequest(method, routeURL, bytes.NewReader(signedManifest))
if err != nil { if err != nil {
return "", err return "", err
@ -327,7 +327,7 @@ func (r *Session) PutV2ImageManifest(ep *Endpoint, imageName, tagName string, si
if err != nil { if err != nil {
return "", err return "", err
} }
log.Debugf("Unexpected response from server: %q %#v", errBody, res.Header) logrus.Debugf("Unexpected response from server: %q %#v", errBody, res.Header)
return "", utils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to push %s:%s manifest", res.StatusCode, imageName, tagName), res) return "", utils.NewHTTPRequestError(fmt.Sprintf("Server error: %d trying to push %s:%s manifest", res.StatusCode, imageName, tagName), res)
} }
@ -364,7 +364,7 @@ func (r *Session) GetV2RemoteTags(ep *Endpoint, imageName string, auth *RequestA
} }
method := "GET" method := "GET"
log.Debugf("[registry] Calling %q %s", method, routeURL) logrus.Debugf("[registry] Calling %q %s", method, routeURL)
req, err := r.reqFactory.NewRequest(method, routeURL, nil) req, err := r.reqFactory.NewRequest(method, routeURL, nil)
if err != nil { if err != nil {

View File

@ -3,7 +3,7 @@ package runconfig
import ( import (
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/nat" "github.com/docker/docker/nat"
) )
@ -50,7 +50,7 @@ func Merge(userConf, imageConf *Config) error {
} }
if len(imageConf.PortSpecs) > 0 { if len(imageConf.PortSpecs) > 0 {
// FIXME: I think we can safely remove this. Leaving it for now for the sake of reverse-compat paranoia. // FIXME: I think we can safely remove this. Leaving it for now for the sake of reverse-compat paranoia.
log.Debugf("Migrating image port specs to containter: %s", strings.Join(imageConf.PortSpecs, ", ")) logrus.Debugf("Migrating image port specs to containter: %s", strings.Join(imageConf.PortSpecs, ", "))
if userConf.ExposedPorts == nil { if userConf.ExposedPorts == nil {
userConf.ExposedPorts = make(nat.PortSet) userConf.ExposedPorts = make(nat.PortSet)
} }

View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/engine" "github.com/docker/docker/engine"
"github.com/docker/libtrust" "github.com/docker/libtrust"
) )
@ -56,7 +56,7 @@ func (t *TrustStore) CmdCheckKey(job *engine.Job) error {
return fmt.Errorf("Error verifying key to namespace: %s", namespace) return fmt.Errorf("Error verifying key to namespace: %s", namespace)
} }
if !verified { if !verified {
log.Debugf("Verification failed for %s using key %s", namespace, pk.KeyID()) logrus.Debugf("Verification failed for %s using key %s", namespace, pk.KeyID())
job.Stdout.Write([]byte("not verified")) job.Stdout.Write([]byte("not verified"))
} else if t.expiration.Before(time.Now()) { } else if t.expiration.Before(time.Now()) {
job.Stdout.Write([]byte("expired")) job.Stdout.Write([]byte("expired"))

View File

@ -12,7 +12,7 @@ import (
"sync" "sync"
"time" "time"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/libtrust/trustgraph" "github.com/docker/libtrust/trustgraph"
) )
@ -93,7 +93,7 @@ func (t *TrustStore) reload() error {
} }
if len(statements) == 0 { if len(statements) == 0 {
if t.autofetch { if t.autofetch {
log.Debugf("No grants, fetching") logrus.Debugf("No grants, fetching")
t.fetcher = time.AfterFunc(t.fetchTime, t.fetch) t.fetcher = time.AfterFunc(t.fetchTime, t.fetch)
} }
return nil return nil
@ -106,7 +106,7 @@ func (t *TrustStore) reload() error {
t.expiration = expiration t.expiration = expiration
t.graph = trustgraph.NewMemoryGraph(grants) t.graph = trustgraph.NewMemoryGraph(grants)
log.Debugf("Reloaded graph with %d grants expiring at %s", len(grants), expiration) logrus.Debugf("Reloaded graph with %d grants expiring at %s", len(grants), expiration)
if t.autofetch { if t.autofetch {
nextFetch := expiration.Sub(time.Now()) nextFetch := expiration.Sub(time.Now())
@ -161,28 +161,28 @@ func (t *TrustStore) fetch() {
for bg, ep := range t.baseEndpoints { for bg, ep := range t.baseEndpoints {
statement, err := t.fetchBaseGraph(ep) statement, err := t.fetchBaseGraph(ep)
if err != nil { if err != nil {
log.Infof("Trust graph fetch failed: %s", err) logrus.Infof("Trust graph fetch failed: %s", err)
continue continue
} }
b, err := statement.Bytes() b, err := statement.Bytes()
if err != nil { if err != nil {
log.Infof("Bad trust graph statement: %s", err) logrus.Infof("Bad trust graph statement: %s", err)
continue continue
} }
// TODO check if value differs // TODO check if value differs
err = ioutil.WriteFile(path.Join(t.path, bg+".json"), b, 0600) err = ioutil.WriteFile(path.Join(t.path, bg+".json"), b, 0600)
if err != nil { if err != nil {
log.Infof("Error writing trust graph statement: %s", err) logrus.Infof("Error writing trust graph statement: %s", err)
} }
fetchCount++ fetchCount++
} }
log.Debugf("Fetched %d base graphs at %s", fetchCount, time.Now()) logrus.Debugf("Fetched %d base graphs at %s", fetchCount, time.Now())
if fetchCount > 0 { if fetchCount > 0 {
go func() { go func() {
err := t.reload() err := t.reload()
if err != nil { if err != nil {
log.Infof("Reload of trust graph failed: %s", err) logrus.Infof("Reload of trust graph failed: %s", err)
} }
}() }()
t.fetchTime = defaultFetchtime t.fetchTime = defaultFetchtime

View File

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"strings" "strings"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
// VersionInfo is used to model entities which has a version. // VersionInfo is used to model entities which has a version.
@ -163,6 +163,6 @@ func (h *HTTPRequestFactory) NewRequest(method, urlStr string, body io.Reader, d
return nil, err return nil, err
} }
} }
log.Debugf("%v -- HEADERS: %v", req.URL, req.Header) logrus.Debugf("%v -- HEADERS: %v", req.URL, req.Header)
return req, err return req, err
} }

View File

@ -18,7 +18,7 @@ import (
"strings" "strings"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/autogen/dockerversion" "github.com/docker/docker/autogen/dockerversion"
"github.com/docker/docker/pkg/archive" "github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/fileutils" "github.com/docker/docker/pkg/fileutils"
@ -157,7 +157,7 @@ func DockerInitPath(localCopy string) string {
func GetTotalUsedFds() int { func GetTotalUsedFds() int {
if fds, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil { if fds, err := ioutil.ReadDir(fmt.Sprintf("/proc/%d/fd", os.Getpid())); err != nil {
log.Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err) logrus.Errorf("Error opening /proc/%d/fd: %s", os.Getpid(), err)
} else { } else {
return len(fds) return len(fds)
} }

View File

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"sync" "sync"
log "github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/stringid" "github.com/docker/docker/pkg/stringid"
) )
@ -95,16 +95,16 @@ func (r *Repository) restore() error {
} }
if err := vol.FromDisk(); err != nil { if err := vol.FromDisk(); err != nil {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
log.Debugf("Error restoring volume: %v", err) logrus.Debugf("Error restoring volume: %v", err)
continue continue
} }
if err := vol.initialize(); err != nil { if err := vol.initialize(); err != nil {
log.Debugf("%s", err) logrus.Debugf("%s", err)
continue continue
} }
} }
if err := r.add(vol); err != nil { if err := r.add(vol); err != nil {
log.Debugf("Error restoring volume: %v", err) logrus.Debugf("Error restoring volume: %v", err)
} }
} }
return nil return nil