mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 15:28:35 +00:00
Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
+15
-15
@@ -8,7 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
@@ -39,25 +39,25 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
|
||||
cLog, err := container.ReadLog("json")
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
// Legacy logs
|
||||
log.Debugf("Old logs format")
|
||||
logrus.Debugf("Old logs format")
|
||||
if stdout {
|
||||
cLog, err := container.ReadLog("stdout")
|
||||
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 {
|
||||
log.Errorf("Error streaming logs (stdout): %s", err)
|
||||
logrus.Errorf("Error streaming logs (stdout): %s", err)
|
||||
}
|
||||
}
|
||||
if stderr {
|
||||
cLog, err := container.ReadLog("stderr")
|
||||
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 {
|
||||
log.Errorf("Error streaming logs (stderr): %s", err)
|
||||
logrus.Errorf("Error streaming logs (stderr): %s", err)
|
||||
}
|
||||
}
|
||||
} else if err != nil {
|
||||
log.Errorf("Error reading logs (json): %s", err)
|
||||
logrus.Errorf("Error reading logs (json): %s", err)
|
||||
} else {
|
||||
dec := json.NewDecoder(cLog)
|
||||
for {
|
||||
@@ -66,7 +66,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
|
||||
if err := dec.Decode(l); err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
log.Errorf("Error streaming logs: %s", err)
|
||||
logrus.Errorf("Error streaming logs: %s", err)
|
||||
break
|
||||
}
|
||||
if l.Stream == "stdout" && stdout {
|
||||
@@ -90,7 +90,7 @@ func (daemon *Daemon) ContainerAttach(job *engine.Job) error {
|
||||
r, w := io.Pipe()
|
||||
go func() {
|
||||
defer w.Close()
|
||||
defer log.Debugf("Closing buffered stdin pipe")
|
||||
defer logrus.Debugf("Closing buffered stdin pipe")
|
||||
io.Copy(w, job.Stdin)
|
||||
}()
|
||||
cStdin = r
|
||||
@@ -140,7 +140,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
|
||||
if stdin == nil || !openStdin {
|
||||
return
|
||||
}
|
||||
log.Debugf("attach: stdin: begin")
|
||||
logrus.Debugf("attach: stdin: begin")
|
||||
defer func() {
|
||||
if stdinOnce && !tty {
|
||||
cStdin.Close()
|
||||
@@ -154,7 +154,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
|
||||
}
|
||||
}
|
||||
wg.Done()
|
||||
log.Debugf("attach: stdin: end")
|
||||
logrus.Debugf("attach: stdin: end")
|
||||
}()
|
||||
|
||||
var err error
|
||||
@@ -168,7 +168,7 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("attach: stdin: %s", err)
|
||||
logrus.Errorf("attach: stdin: %s", err)
|
||||
errors <- err
|
||||
return
|
||||
}
|
||||
@@ -185,16 +185,16 @@ func (daemon *Daemon) Attach(streamConfig *StreamConfig, openStdin, stdinOnce, t
|
||||
}
|
||||
streamPipe.Close()
|
||||
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)
|
||||
if err == io.ErrClosedPipe {
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("attach: %s: %v", name, err)
|
||||
logrus.Errorf("attach: %s: %v", name, err)
|
||||
errors <- err
|
||||
}
|
||||
}
|
||||
|
||||
+20
-20
@@ -19,7 +19,7 @@ import (
|
||||
"github.com/docker/libcontainer/devices"
|
||||
"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/logger"
|
||||
"github.com/docker/docker/daemon/logger/jsonfilelog"
|
||||
@@ -201,7 +201,7 @@ func (container *Container) WriteHostConfig() error {
|
||||
func (container *Container) LogEvent(action string) {
|
||||
d := container.daemon
|
||||
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 {
|
||||
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 {
|
||||
@@ -668,7 +668,7 @@ func (container *Container) cleanup() {
|
||||
}
|
||||
|
||||
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()
|
||||
defer container.Unlock()
|
||||
|
||||
@@ -699,7 +699,7 @@ func (container *Container) KillSig(sig int) error {
|
||||
func (container *Container) killPossiblyDeadProcess(sig int) error {
|
||||
err := container.KillSig(sig)
|
||||
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 err
|
||||
@@ -739,12 +739,12 @@ func (container *Container) Kill() error {
|
||||
if _, err := container.WaitStop(10 * time.Second); err != nil {
|
||||
// Ensure that we don't kill ourselves
|
||||
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.ESRCH {
|
||||
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
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
@@ -768,7 +768,7 @@ func (container *Container) Stop(seconds int) error {
|
||||
|
||||
// 2. Wait for the process to exit on its own
|
||||
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
|
||||
if err := container.Kill(); err != nil {
|
||||
container.WaitStop(-1 * time.Second)
|
||||
@@ -904,7 +904,7 @@ func (container *Container) GetSize() (int64, int64) {
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
defer container.Unmount()
|
||||
@@ -912,7 +912,7 @@ func (container *Container) GetSize() (int64, int64) {
|
||||
initID := fmt.Sprintf("%s-init", container.ID)
|
||||
sizeRw, err = driver.DiffSize(container.ID, initID)
|
||||
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
|
||||
// there is a side-effect.
|
||||
sizeRw = -1
|
||||
@@ -1007,7 +1007,7 @@ func (container *Container) DisableLink(name string) {
|
||||
if link, exists := container.activeLinks[name]; exists {
|
||||
link.Disable()
|
||||
} 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:
|
||||
if container.UpdateDns {
|
||||
// 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()
|
||||
|
||||
// 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
|
||||
//we will replace it with the updated resolv.conf from the host
|
||||
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:
|
||||
dir := path.Dir(container.ResolvConfPath)
|
||||
@@ -1172,13 +1172,13 @@ func (container *Container) updateParentsHosts() error {
|
||||
|
||||
c, err := container.daemon.Get(ref.ParentID)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
logrus.Error(err)
|
||||
}
|
||||
|
||||
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 {
|
||||
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
|
||||
func (container *Container) verifyDaemonSettings() {
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+42
-42
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
"github.com/docker/libcontainer/label"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/autogen/dockerversion"
|
||||
"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 the container is supposed to be running, make sure of it
|
||||
if container.IsRunning() {
|
||||
log.Debugf("killing old running container %s", container.ID)
|
||||
logrus.Debugf("killing old running container %s", container.ID)
|
||||
|
||||
existingPid := container.Pid
|
||||
container.SetStopped(&execdriver.ExitStatus{ExitCode: 0})
|
||||
@@ -278,23 +278,23 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err
|
||||
var err error
|
||||
cmd.ProcessConfig.Process, err = os.FindProcess(existingPid)
|
||||
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)
|
||||
}
|
||||
|
||||
if err := container.Unmount(); err != nil {
|
||||
log.Debugf("unmount error %s", err)
|
||||
logrus.Debugf("unmount error %s", err)
|
||||
}
|
||||
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)
|
||||
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})
|
||||
if err := container.ToDisk(); err != nil {
|
||||
@@ -314,7 +314,7 @@ func (daemon *Daemon) ensureName(container *Container) error {
|
||||
container.Name = name
|
||||
|
||||
if err := container.ToDisk(); err != nil {
|
||||
log.Debugf("Error saving container name %s", err)
|
||||
logrus.Debugf("Error saving container name %s", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -337,7 +337,7 @@ func (daemon *Daemon) restore() error {
|
||||
)
|
||||
|
||||
if !debug {
|
||||
log.Info("Loading containers: start.")
|
||||
logrus.Info("Loading containers: start.")
|
||||
}
|
||||
dir, err := ioutil.ReadDir(daemon.repository)
|
||||
if err != nil {
|
||||
@@ -347,21 +347,21 @@ func (daemon *Daemon) restore() error {
|
||||
for _, v := range dir {
|
||||
id := v.Name()
|
||||
container, err := daemon.load(id)
|
||||
if !debug && log.GetLevel() == log.InfoLevel {
|
||||
if !debug && logrus.GetLevel() == logrus.InfoLevel {
|
||||
fmt.Print(".")
|
||||
}
|
||||
if err != nil {
|
||||
log.Errorf("Failed to load container %v: %v", id, err)
|
||||
logrus.Errorf("Failed to load container %v: %v", id, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Ignore the container if it does not support the current driver being used by the graph
|
||||
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
|
||||
} 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 {
|
||||
for _, p := range entities.Paths() {
|
||||
if !debug && log.GetLevel() == log.InfoLevel {
|
||||
if !debug && logrus.GetLevel() == logrus.InfoLevel {
|
||||
fmt.Print(".")
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ func (daemon *Daemon) restore() error {
|
||||
|
||||
if container, ok := containers[e.ID()]; ok {
|
||||
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)
|
||||
@@ -393,11 +393,11 @@ func (daemon *Daemon) restore() error {
|
||||
// Try to set the default name for a container if it exists prior to links
|
||||
container.Name, err = daemon.generateNewName(container.ID)
|
||||
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 {
|
||||
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)
|
||||
@@ -406,25 +406,25 @@ func (daemon *Daemon) restore() error {
|
||||
// check the restart policy on the containers and restart any container with
|
||||
// the restart policy of "always"
|
||||
if daemon.config.AutoRestart {
|
||||
log.Debug("Restarting containers...")
|
||||
logrus.Debug("Restarting containers...")
|
||||
|
||||
for _, container := range registeredContainers {
|
||||
if container.hostConfig.RestartPolicy.Name == "always" ||
|
||||
(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 {
|
||||
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 log.GetLevel() == log.InfoLevel {
|
||||
if logrus.GetLevel() == logrus.InfoLevel {
|
||||
fmt.Println()
|
||||
}
|
||||
log.Info("Loading containers: done.")
|
||||
logrus.Info("Loading containers: done.")
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -451,7 +451,7 @@ func (daemon *Daemon) setupResolvconfWatcher() error {
|
||||
// without an actual change to the file
|
||||
updatedResolvConf, newResolvConfHash, err := resolvconf.GetIfChanged()
|
||||
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 {
|
||||
// because the new host resolv.conf might have localhost nameservers..
|
||||
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
|
||||
newHash, err := utils.HashData(bytes.NewReader(updatedResolvConf))
|
||||
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 {
|
||||
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()
|
||||
for _, container := range contList {
|
||||
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:
|
||||
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
|
||||
eng.OnShutdown(func() {
|
||||
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.
|
||||
@@ -892,11 +892,11 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
|
||||
if err != nil {
|
||||
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
|
||||
eng.OnShutdown(func() {
|
||||
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" {
|
||||
return nil, fmt.Errorf("SELinux is not supported with the BTRFS graph driver")
|
||||
}
|
||||
log.Debug("SELinux enabled successfully")
|
||||
logrus.Debug("SELinux enabled successfully")
|
||||
} else {
|
||||
log.Warn("Docker could not enable SELinux on the host system")
|
||||
logrus.Warn("Docker could not enable SELinux on the host system")
|
||||
}
|
||||
} else {
|
||||
selinuxSetDisabled()
|
||||
@@ -925,7 +925,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debug("Creating images graph")
|
||||
logrus.Debug("Creating images graph")
|
||||
g, err := graph.NewGraph(path.Join(config.Root, "graph"), driver)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -946,7 +946,7 @@ func NewDaemonFromDirectory(config *Config, eng *engine.Engine) (*Daemon, error)
|
||||
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)
|
||||
if err != nil {
|
||||
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
|
||||
eng.OnShutdown(func() {
|
||||
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() {
|
||||
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 {
|
||||
group := sync.WaitGroup{}
|
||||
log.Debug("starting clean shutdown of all containers...")
|
||||
logrus.Debug("starting clean shutdown of all containers...")
|
||||
for _, container := range daemon.List() {
|
||||
c := container
|
||||
if c.IsRunning() {
|
||||
log.Debugf("stopping %s", c.ID)
|
||||
logrus.Debugf("stopping %s", c.ID)
|
||||
group.Add(1)
|
||||
|
||||
go func() {
|
||||
defer group.Done()
|
||||
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)
|
||||
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.
|
||||
// For details see http://github.com/docker/docker/issues/407
|
||||
if k, err := kernel.GetKernelVersion(); err != nil {
|
||||
log.Warnf("%s", err)
|
||||
logrus.Warnf("%s", err)
|
||||
} else {
|
||||
if kernel.CompareKernelVersion(k, &kernel.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 {
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/daemon/graphdriver/aufs"
|
||||
"github.com/docker/docker/graph"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
// If aufs driver is not built, this func is a noop.
|
||||
func migrateIfAufs(driver graphdriver.Driver, root string) error {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"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{}) {
|
||||
for id := range volumeIDs {
|
||||
if err := daemon.volumes.Delete(id); err != nil {
|
||||
log.Infof("%s", err)
|
||||
logrus.Infof("%s", err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func (daemon *Daemon) Rm(container *Container) error {
|
||||
daemon.containers.Delete(container.ID)
|
||||
container.derefVolumes()
|
||||
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 {
|
||||
|
||||
+9
-9
@@ -7,7 +7,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/execdriver/lxc"
|
||||
"github.com/docker/docker/engine"
|
||||
@@ -188,7 +188,7 @@ func (d *Daemon) ContainerExecStart(job *engine.Job) error {
|
||||
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.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()
|
||||
go func() {
|
||||
defer w.Close()
|
||||
defer log.Debugf("Closing buffered stdin pipe")
|
||||
defer logrus.Debugf("Closing buffered stdin pipe")
|
||||
io.Copy(w, job.Stdin)
|
||||
}()
|
||||
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)
|
||||
exitCode, err = container.daemon.Exec(container, execConfig, pipes, callback)
|
||||
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 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 {
|
||||
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 {
|
||||
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 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
sysinfo "github.com/docker/docker/pkg/system"
|
||||
"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,
|
||||
}
|
||||
}
|
||||
log.Debugf("lxc params %s", params)
|
||||
logrus.Debugf("lxc params %s", params)
|
||||
var (
|
||||
name = params[0]
|
||||
arg = params[1:]
|
||||
@@ -263,7 +263,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||
c.ContainerPid = pid
|
||||
|
||||
if startCallback != nil {
|
||||
log.Debugf("Invoking startCallback")
|
||||
logrus.Debugf("Invoking startCallback")
|
||||
startCallback(&c.ProcessConfig, pid)
|
||||
}
|
||||
|
||||
@@ -274,9 +274,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
||||
|
||||
if err == nil {
|
||||
_, oomKill = <-oomKillNotification
|
||||
log.Debugf("oomKill error %s waitErr %s", oomKill, waitErr)
|
||||
logrus.Debugf("oomKill error %s waitErr %s", oomKill, waitErr)
|
||||
} 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
|
||||
@@ -351,11 +351,11 @@ func cgroupPaths(containerId string) (map[string]string, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Debugf("subsystems: %s", subsystems)
|
||||
logrus.Debugf("subsystems: %s", subsystems)
|
||||
paths := make(map[string]string)
|
||||
for _, subsystem := range subsystems {
|
||||
cgroupRoot, cgroupDir, err := findCgroupRootAndDir(subsystem)
|
||||
log.Debugf("cgroup path %s %s", cgroupRoot, cgroupDir)
|
||||
logrus.Debugf("cgroup path %s %s", cgroupRoot, cgroupDir)
|
||||
if err != nil {
|
||||
//unsupported subystem
|
||||
continue
|
||||
@@ -576,7 +576,7 @@ func (i *info) IsRunning() bool {
|
||||
|
||||
output, err := i.driver.getInfo(i.ID)
|
||||
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
|
||||
}
|
||||
if strings.Contains(string(output), "RUNNING") {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
nativeTemplate "github.com/docker/docker/daemon/execdriver/native/template"
|
||||
"github.com/docker/docker/utils"
|
||||
@@ -160,14 +160,14 @@ func escapeFstabSpaces(field string) string {
|
||||
|
||||
func keepCapabilities(adds []string, drops []string) ([]string, error) {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var newCaps []string
|
||||
for _, cap := range caps {
|
||||
log.Debugf("cap %s\n", cap)
|
||||
logrus.Debugf("cap %s\n", cap)
|
||||
realCap := execdriver.GetCapability(cap)
|
||||
numCap := fmt.Sprintf("%d", realCap.Value)
|
||||
newCaps = append(newCaps, numCap)
|
||||
@@ -181,7 +181,7 @@ func dropList(drops []string) ([]string, error) {
|
||||
var newCaps []string
|
||||
for _, capName := range execdriver.GetAllCapabilities() {
|
||||
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)
|
||||
newCaps = append(newCaps, numCap)
|
||||
}
|
||||
@@ -192,7 +192,7 @@ func dropList(drops []string) ([]string, error) {
|
||||
|
||||
func isDirectory(source string) string {
|
||||
f, err := os.Stat(source)
|
||||
log.Debugf("dir: %s\n", source)
|
||||
logrus.Debugf("dir: %s\n", source)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return "dir"
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/reexec"
|
||||
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()
|
||||
if err != 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
|
||||
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 {
|
||||
process, err := os.FindProcess(pid)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to kill process: %d", pid)
|
||||
logrus.Errorf("Failed to kill process: %d", pid)
|
||||
continue
|
||||
}
|
||||
process.Kill()
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
@@ -216,7 +216,7 @@ func (a *Driver) Remove(id string) error {
|
||||
defer a.Unlock()
|
||||
|
||||
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
|
||||
@@ -405,7 +405,7 @@ func (a *Driver) Cleanup() error {
|
||||
|
||||
for _, id := range ids {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"os/exec"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func Unmount(target string) error {
|
||||
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 {
|
||||
return err
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/devicemapper"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
@@ -205,7 +205,7 @@ func (devices *DeviceSet) ensureImage(name string, size int64) (string, error) {
|
||||
if !os.IsNotExist(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)
|
||||
if err != nil {
|
||||
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.
|
||||
if strings.HasSuffix(finfo.Name(), ".migrated") {
|
||||
log.Debugf("Skipping file %s", path)
|
||||
logrus.Debugf("Skipping file %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
if strings.HasPrefix(finfo.Name(), ".") {
|
||||
log.Debugf("Skipping file %s", path)
|
||||
logrus.Debugf("Skipping file %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
if finfo.Name() == deviceSetMetaFile {
|
||||
log.Debugf("Skipping file %s", path)
|
||||
logrus.Debugf("Skipping file %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
log.Debugf("Loading data for file %s", path)
|
||||
logrus.Debugf("Loading data for file %s", path)
|
||||
|
||||
hash := finfo.Name()
|
||||
if hash == "base" {
|
||||
@@ -347,7 +347,7 @@ func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo)
|
||||
}
|
||||
|
||||
if dinfo.DeviceId > MaxDeviceId {
|
||||
log.Errorf("Ignoring Invalid DeviceId=%d", dinfo.DeviceId)
|
||||
logrus.Errorf("Ignoring Invalid DeviceId=%d", dinfo.DeviceId)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -355,17 +355,17 @@ func (devices *DeviceSet) deviceFileWalkFunction(path string, finfo os.FileInfo)
|
||||
devices.markDeviceIdUsed(dinfo.DeviceId)
|
||||
devices.Unlock()
|
||||
|
||||
log.Debugf("Added deviceId=%d to DeviceIdMap", dinfo.DeviceId)
|
||||
logrus.Debugf("Added deviceId=%d to DeviceIdMap", dinfo.DeviceId)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) constructDeviceIdMap() error {
|
||||
log.Debugf("[deviceset] constructDeviceIdMap()")
|
||||
defer log.Debugf("[deviceset] constructDeviceIdMap() END")
|
||||
logrus.Debugf("[deviceset] constructDeviceIdMap()")
|
||||
defer logrus.Debugf("[deviceset] constructDeviceIdMap() END")
|
||||
|
||||
var scan = func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
log.Debugf("Can't walk the file %s", path)
|
||||
logrus.Debugf("Can't walk the file %s", path)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ func (devices *DeviceSet) constructDeviceIdMap() 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{
|
||||
Hash: hash,
|
||||
DeviceId: id,
|
||||
@@ -392,7 +392,7 @@ func (devices *DeviceSet) unregisterDevice(id int, hash string) error {
|
||||
devices.devicesLock.Unlock()
|
||||
|
||||
if err := devices.removeMetadata(info); err != nil {
|
||||
log.Debugf("Error removing metadata: %s", err)
|
||||
logrus.Debugf("Error removing metadata: %s", 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) {
|
||||
log.Debugf("registerDevice(%v, %v)", id, hash)
|
||||
logrus.Debugf("registerDevice(%v, %v)", id, hash)
|
||||
info := &DevInfo{
|
||||
Hash: hash,
|
||||
DeviceId: id,
|
||||
@@ -426,7 +426,7 @@ func (devices *DeviceSet) registerDevice(id int, hash string, size uint64, trans
|
||||
}
|
||||
|
||||
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 {
|
||||
return nil
|
||||
@@ -542,7 +542,7 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
|
||||
}
|
||||
|
||||
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)
|
||||
return nil, err
|
||||
}
|
||||
@@ -554,7 +554,7 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
|
||||
// happen. Now we have a mechianism to find
|
||||
// a free device Id. So something is not right.
|
||||
// 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()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -563,14 +563,14 @@ func (devices *DeviceSet) createRegisterDevice(hash string) (*DevInfo, error) {
|
||||
devices.refreshTransaction(deviceId)
|
||||
continue
|
||||
}
|
||||
log.Debugf("Error creating device: %s", err)
|
||||
logrus.Debugf("Error creating device: %s", err)
|
||||
devices.markDeviceIdFree(deviceId)
|
||||
return nil, err
|
||||
}
|
||||
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)
|
||||
if err != nil {
|
||||
_ = 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 {
|
||||
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)
|
||||
return err
|
||||
}
|
||||
@@ -606,7 +606,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
|
||||
// happen. Now we have a mechianism to find
|
||||
// a free device Id. So something is not right.
|
||||
// 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()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -615,7 +615,7 @@ func (devices *DeviceSet) createRegisterSnapDevice(hash string, baseInfo *DevInf
|
||||
devices.refreshTransaction(deviceId)
|
||||
continue
|
||||
}
|
||||
log.Debugf("Error creating snap device: %s", err)
|
||||
logrus.Debugf("Error creating snap device: %s", err)
|
||||
devices.markDeviceIdFree(deviceId)
|
||||
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 {
|
||||
devicemapper.DeleteDevice(devices.getPoolDevName(), deviceId)
|
||||
devices.markDeviceIdFree(deviceId)
|
||||
log.Debugf("Error registering device: %s", err)
|
||||
logrus.Debugf("Error registering device: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ func (devices *DeviceSet) setupBaseImage() error {
|
||||
}
|
||||
|
||||
if oldInfo != nil && !oldInfo.Initialized {
|
||||
log.Debugf("Removing uninitialized base image")
|
||||
logrus.Debugf("Removing uninitialized base image")
|
||||
if err := devices.DeleteDevice(""); err != nil {
|
||||
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
|
||||
info, err := devices.createRegisterDevice("")
|
||||
@@ -689,7 +689,7 @@ func (devices *DeviceSet) setupBaseImage() error {
|
||||
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 {
|
||||
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/
|
||||
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 {
|
||||
@@ -846,24 +846,24 @@ func (devices *DeviceSet) removeTransactionMetaData() 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
|
||||
// closed. In that case this call will fail. Just leave a message
|
||||
// in case of failure.
|
||||
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}
|
||||
if err := devices.removeMetadata(dinfo); err != nil {
|
||||
log.Errorf("Unable to remove metadata: %s", err)
|
||||
logrus.Errorf("Unable to remove metadata: %s", err)
|
||||
} else {
|
||||
devices.markDeviceIdFree(devices.DeviceId)
|
||||
}
|
||||
|
||||
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
|
||||
@@ -883,7 +883,7 @@ func (devices *DeviceSet) processPendingTransaction() error {
|
||||
// If open transaction Id is less than pool transaction Id, something
|
||||
// is wrong. Bail out.
|
||||
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
|
||||
}
|
||||
|
||||
@@ -940,7 +940,7 @@ func (devices *DeviceSet) refreshTransaction(DeviceId int) error {
|
||||
|
||||
func (devices *DeviceSet) closeTransaction() error {
|
||||
if err := devices.updatePoolTransactionId(); err != nil {
|
||||
log.Debugf("Failed to close Transaction")
|
||||
logrus.Debugf("Failed to close Transaction")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -963,9 +963,9 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
|
||||
// https://github.com/docker/docker/issues/4036
|
||||
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) {
|
||||
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>
|
||||
// - 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)
|
||||
log.Debugf("Generated prefix: %s", devices.devicePrefix)
|
||||
logrus.Debugf("Generated prefix: %s", devices.devicePrefix)
|
||||
|
||||
// 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())
|
||||
if info == nil {
|
||||
log.Debugf("Error device devicemapper.GetInfo: %s", err)
|
||||
logrus.Debugf("Error device devicemapper.GetInfo: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1007,7 +1007,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
|
||||
// If the pool doesn't exist, create it
|
||||
if info.Exists == 0 && devices.thinPoolDevice == "" {
|
||||
log.Debugf("Pool doesn't exist. Creating it.")
|
||||
logrus.Debugf("Pool doesn't exist. Creating it.")
|
||||
|
||||
var (
|
||||
dataFile *os.File
|
||||
@@ -1029,7 +1029,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
|
||||
data, err := devices.ensureImage("data", devices.dataLoopbackSize)
|
||||
if err != nil {
|
||||
log.Debugf("Error device ensureImage (data): %s", err)
|
||||
logrus.Debugf("Error device ensureImage (data): %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
|
||||
metadata, err := devices.ensureImage("metadata", devices.metaDataLoopbackSize)
|
||||
if err != nil {
|
||||
log.Debugf("Error device ensureImage (metadata): %s", err)
|
||||
logrus.Debugf("Error device ensureImage (metadata): %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1102,7 +1102,7 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
// Setup the base image
|
||||
if doInit {
|
||||
if err := devices.setupBaseImage(); err != nil {
|
||||
log.Debugf("Error device setupBaseImage: %s", err)
|
||||
logrus.Debugf("Error device setupBaseImage: %s", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -1111,8 +1111,8 @@ func (devices *DeviceSet) initDevmapper(doInit bool) error {
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) AddDevice(hash, baseHash string) error {
|
||||
log.Debugf("[deviceset] AddDevice(hash=%s basehash=%s)", hash, baseHash)
|
||||
defer log.Debugf("[deviceset] AddDevice(hash=%s basehash=%s) END", hash, baseHash)
|
||||
logrus.Debugf("[deviceset] AddDevice(hash=%s basehash=%s)", hash, baseHash)
|
||||
defer logrus.Debugf("[deviceset] AddDevice(hash=%s basehash=%s) END", hash, baseHash)
|
||||
|
||||
baseInfo, err := devices.lookupDevice(baseHash)
|
||||
if err != nil {
|
||||
@@ -1143,7 +1143,7 @@ func (devices *DeviceSet) deleteDevice(info *DevInfo) error {
|
||||
// manually
|
||||
if err := devices.activateDeviceIfNeeded(info); 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())
|
||||
if devinfo != nil && devinfo.Exists != 0 {
|
||||
if err := devices.removeDeviceAndWait(info.Name()); err != nil {
|
||||
log.Debugf("Error removing device: %s", err)
|
||||
logrus.Debugf("Error removing device: %s", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -1195,8 +1195,8 @@ func (devices *DeviceSet) DeleteDevice(hash string) error {
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) deactivatePool() error {
|
||||
log.Debugf("[devmapper] deactivatePool()")
|
||||
defer log.Debugf("[devmapper] deactivatePool END")
|
||||
logrus.Debugf("[devmapper] deactivatePool()")
|
||||
defer logrus.Debugf("[devmapper] deactivatePool END")
|
||||
devname := devices.getPoolDevName()
|
||||
|
||||
devinfo, err := devicemapper.GetInfo(devname)
|
||||
@@ -1205,7 +1205,7 @@ func (devices *DeviceSet) deactivatePool() error {
|
||||
}
|
||||
if d, err := devicemapper.GetDeps(devname); err == nil {
|
||||
// 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 {
|
||||
return devicemapper.RemoveDevice(devname)
|
||||
@@ -1215,13 +1215,13 @@ func (devices *DeviceSet) deactivatePool() error {
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) deactivateDevice(info *DevInfo) error {
|
||||
log.Debugf("[devmapper] deactivateDevice(%s)", info.Hash)
|
||||
defer log.Debugf("[devmapper] deactivateDevice END(%s)", info.Hash)
|
||||
logrus.Debugf("[devmapper] deactivateDevice(%s)", info.Hash)
|
||||
defer logrus.Debugf("[devmapper] deactivateDevice END(%s)", info.Hash)
|
||||
|
||||
// Wait for the unmount to be effective,
|
||||
// by watching the value of Info.OpenCount for the device
|
||||
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())
|
||||
@@ -1271,8 +1271,8 @@ func (devices *DeviceSet) removeDeviceAndWait(devname string) error {
|
||||
// a) the device registered at <device_set_prefix>-<hash> is removed,
|
||||
// or b) the 10 second timeout expires.
|
||||
func (devices *DeviceSet) waitRemove(devname string) error {
|
||||
log.Debugf("[deviceset %s] waitRemove(%s)", devices.devicePrefix, devname)
|
||||
defer log.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
|
||||
logrus.Debugf("[deviceset %s] waitRemove(%s)", devices.devicePrefix, devname)
|
||||
defer logrus.Debugf("[deviceset %s] waitRemove(%s) END", devices.devicePrefix, devname)
|
||||
i := 0
|
||||
for ; i < 1000; i++ {
|
||||
devinfo, err := devicemapper.GetInfo(devname)
|
||||
@@ -1282,7 +1282,7 @@ func (devices *DeviceSet) waitRemove(devname string) error {
|
||||
return nil
|
||||
}
|
||||
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 {
|
||||
break
|
||||
@@ -1309,7 +1309,7 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
|
||||
return err
|
||||
}
|
||||
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 {
|
||||
break
|
||||
@@ -1325,9 +1325,9 @@ func (devices *DeviceSet) waitClose(info *DevInfo) error {
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) Shutdown() error {
|
||||
log.Debugf("[deviceset %s] Shutdown()", devices.devicePrefix)
|
||||
log.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
|
||||
defer log.Debugf("[deviceset %s] Shutdown() END", devices.devicePrefix)
|
||||
logrus.Debugf("[deviceset %s] Shutdown()", devices.devicePrefix)
|
||||
logrus.Debugf("[devmapper] Shutting down DeviceSet: %s", devices.root)
|
||||
defer logrus.Debugf("[deviceset %s] Shutdown() END", devices.devicePrefix)
|
||||
|
||||
var devs []*DevInfo
|
||||
|
||||
@@ -1344,12 +1344,12 @@ func (devices *DeviceSet) Shutdown() error {
|
||||
// container. This means it'll go away from the global scope directly,
|
||||
// and the device will be released when that container dies.
|
||||
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()
|
||||
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()
|
||||
}
|
||||
@@ -1361,7 +1361,7 @@ func (devices *DeviceSet) Shutdown() error {
|
||||
info.lock.Lock()
|
||||
devices.Lock()
|
||||
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()
|
||||
info.lock.Unlock()
|
||||
@@ -1370,7 +1370,7 @@ func (devices *DeviceSet) Shutdown() error {
|
||||
devices.Lock()
|
||||
if devices.thinPoolDevice == "" {
|
||||
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 {
|
||||
log.Debugf("[devmapper] UnmountDevice(hash=%s)", hash)
|
||||
defer log.Debugf("[devmapper] UnmountDevice(hash=%s) END", hash)
|
||||
logrus.Debugf("[devmapper] UnmountDevice(hash=%s)", hash)
|
||||
defer logrus.Debugf("[devmapper] UnmountDevice(hash=%s) END", hash)
|
||||
|
||||
info, err := devices.lookupDevice(hash)
|
||||
if err != nil {
|
||||
@@ -1460,11 +1460,11 @@ func (devices *DeviceSet) UnmountDevice(hash string) error {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
log.Debugf("[devmapper] Unmount done")
|
||||
logrus.Debugf("[devmapper] Unmount done")
|
||||
|
||||
if err := devices.deactivateDevice(info); err != nil {
|
||||
return err
|
||||
@@ -1586,7 +1586,7 @@ func (devices *DeviceSet) getUnderlyingAvailableSpace(loopFile string) (uint64,
|
||||
buf := new(syscall.Statfs_t)
|
||||
err := syscall.Statfs(loopFile, buf)
|
||||
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 buf.Bfree * uint64(buf.Bsize), nil
|
||||
@@ -1596,7 +1596,7 @@ func (devices *DeviceSet) isRealFile(loopFile string) (bool, error) {
|
||||
if loopFile != "" {
|
||||
fi, err := os.Stat(loopFile)
|
||||
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 fi.Mode().IsRegular(), nil
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/devicemapper"
|
||||
"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 {
|
||||
err := d.DeviceSet.UnmountDevice(id)
|
||||
if err != nil {
|
||||
log.Errorf("Error unmounting device %s: %s", id, err)
|
||||
logrus.Errorf("Error unmounting device %s: %s", id, err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
)
|
||||
|
||||
@@ -184,6 +184,6 @@ func checkPriorDriver(name, root string) {
|
||||
}
|
||||
}
|
||||
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, ","))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ package graphdriver
|
||||
import (
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
@@ -120,11 +120,11 @@ func (gdw *naiveDiffDriver) ApplyDiff(id, parent string, diff archive.ArchiveRea
|
||||
defer driver.Put(id)
|
||||
|
||||
start := time.Now().UTC()
|
||||
log.Debugf("Start untar layer")
|
||||
logrus.Debugf("Start untar layer")
|
||||
if size, err = chrootarchive.ApplyLayer(layerFs, diff); err != nil {
|
||||
return
|
||||
}
|
||||
log.Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
|
||||
logrus.Debugf("Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"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
|
||||
switch fsMagic {
|
||||
case graphdriver.FsMagicBtrfs:
|
||||
log.Error("'overlay' is not supported over btrfs.")
|
||||
logrus.Error("'overlay' is not supported over btrfs.")
|
||||
return nil, graphdriver.ErrIncompatibleFS
|
||||
case graphdriver.FsMagicAufs:
|
||||
log.Error("'overlay' is not supported over aufs.")
|
||||
logrus.Error("'overlay' is not supported over aufs.")
|
||||
return nil, graphdriver.ErrIncompatibleFS
|
||||
case graphdriver.FsMagicZfs:
|
||||
log.Error("'overlay' is not supported over zfs.")
|
||||
logrus.Error("'overlay' is not supported over zfs.")
|
||||
return nil, graphdriver.ErrIncompatibleFS
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ func supportsOverlay() error {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ func (d *Driver) Put(id string) error {
|
||||
|
||||
mount := d.active[id]
|
||||
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
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ func (d *Driver) Put(id string) error {
|
||||
if mount.mounted {
|
||||
err := syscall.Unmount(mount.path, 0)
|
||||
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
|
||||
}
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/autogen/dockerversion"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
@@ -33,7 +33,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) error {
|
||||
operatingSystem = s
|
||||
}
|
||||
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)"
|
||||
} else if inContainer {
|
||||
operatingSystem += " (containerized)"
|
||||
@@ -41,7 +41,7 @@ func (daemon *Daemon) CmdInfo(job *engine.Job) error {
|
||||
|
||||
meminfo, err := system.ReadMemInfo()
|
||||
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)
|
||||
|
||||
+10
-10
@@ -9,7 +9,7 @@ import (
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
"github.com/docker/docker/pkg/tailfile"
|
||||
@@ -50,31 +50,31 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
|
||||
cLog, err := container.ReadLog("json")
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
// Legacy logs
|
||||
log.Debugf("Old logs format")
|
||||
logrus.Debugf("Old logs format")
|
||||
if stdout {
|
||||
cLog, err := container.ReadLog("stdout")
|
||||
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 {
|
||||
log.Errorf("Error streaming logs (stdout): %s", err)
|
||||
logrus.Errorf("Error streaming logs (stdout): %s", err)
|
||||
}
|
||||
}
|
||||
if stderr {
|
||||
cLog, err := container.ReadLog("stderr")
|
||||
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 {
|
||||
log.Errorf("Error streaming logs (stderr): %s", err)
|
||||
logrus.Errorf("Error streaming logs (stderr): %s", err)
|
||||
}
|
||||
}
|
||||
} else if err != nil {
|
||||
log.Errorf("Error reading logs (json): %s", err)
|
||||
logrus.Errorf("Error reading logs (json): %s", err)
|
||||
} else {
|
||||
if tail != "all" {
|
||||
var err error
|
||||
lines, err = strconv.Atoi(tail)
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
|
||||
if err := dec.Decode(l); err == io.EOF {
|
||||
break
|
||||
} else if err != nil {
|
||||
log.Errorf("Error streaming logs: %s", err)
|
||||
logrus.Errorf("Error streaming logs: %s", err)
|
||||
break
|
||||
}
|
||||
logLine := l.Log
|
||||
@@ -143,7 +143,7 @@ func (daemon *Daemon) ContainerLogs(job *engine.Job) error {
|
||||
|
||||
for err := range errors {
|
||||
if err != nil {
|
||||
log.Errorf("%s", err)
|
||||
logrus.Errorf("%s", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -6,7 +6,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/stringid"
|
||||
"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
|
||||
// in builder/builder.go
|
||||
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
|
||||
}
|
||||
@@ -145,7 +145,7 @@ func (m *containerMonitor) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Errorf("Error running container: %s", err)
|
||||
logrus.Errorf("Error running container: %s", err)
|
||||
}
|
||||
|
||||
// here container.Lock is already lost
|
||||
@@ -229,7 +229,7 @@ func (m *containerMonitor) shouldRestart(exitCode int) bool {
|
||||
case "on-failure":
|
||||
// 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 {
|
||||
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)
|
||||
return false
|
||||
}
|
||||
@@ -263,7 +263,7 @@ func (m *containerMonitor) callback(processConfig *execdriver.ProcessConfig, pid
|
||||
}
|
||||
|
||||
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 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 {
|
||||
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 {
|
||||
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 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 {
|
||||
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:
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/networkdriver"
|
||||
"github.com/docker/docker/daemon/networkdriver/ipallocator"
|
||||
"github.com/docker/docker/daemon/networkdriver/portmapper"
|
||||
@@ -132,9 +132,9 @@ func InitDriver(job *engine.Job) error {
|
||||
|
||||
if fixedCIDRv6 != "" {
|
||||
// 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 {
|
||||
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 {
|
||||
@@ -207,16 +207,16 @@ func InitDriver(job *engine.Job) error {
|
||||
if ipForward {
|
||||
// Enable IPv4 forwarding
|
||||
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 != "" {
|
||||
// Enable IPv6 forwarding
|
||||
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 {
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
log.Debugf("Subnet: %v", subnet)
|
||||
logrus.Debugf("Subnet: %v", subnet)
|
||||
if err := ipAllocator.RegisterSubnet(bridgeIPv4Network, subnet); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -255,7 +255,7 @@ func InitDriver(job *engine.Job) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("Subnet: %v", subnet)
|
||||
logrus.Debugf("Subnet: %v", subnet)
|
||||
if err := ipAllocator.RegisterSubnet(subnet, subnet); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -307,7 +307,7 @@ func setupIPTables(addr net.Addr, icc, ipmasq bool) error {
|
||||
iptables.Raw(append([]string{"-D", "FORWARD"}, acceptArgs...)...)
|
||||
|
||||
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 {
|
||||
return fmt.Errorf("Unable to prevent intercontainer communication: %s", err)
|
||||
} 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...)...)
|
||||
|
||||
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 {
|
||||
return fmt.Errorf("Unable to allow intercontainer communication: %s", err)
|
||||
} else if len(output) != 0 {
|
||||
@@ -384,7 +384,7 @@ func configureBridge(bridgeIP string, bridgeIPv6 string, enableIPv6 bool) error
|
||||
ifaceAddr = addr
|
||||
break
|
||||
} 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 == "" {
|
||||
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 {
|
||||
// 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
|
||||
// before that it was not supported
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -533,10 +533,10 @@ func Allocate(job *engine.Job) error {
|
||||
|
||||
globalIPv6, err = ipAllocator.RequestIP(globalIPv6Network, requestedIPv6)
|
||||
if err != nil {
|
||||
log.Errorf("Allocator: RequestIP v6: %v", err)
|
||||
logrus.Errorf("Allocator: RequestIP v6: %v", err)
|
||||
return err
|
||||
}
|
||||
log.Infof("Allocated IPv6 %s", globalIPv6)
|
||||
logrus.Infof("Allocated IPv6 %s", globalIPv6)
|
||||
}
|
||||
|
||||
out := engine.Env{}
|
||||
@@ -588,16 +588,16 @@ func Release(job *engine.Job) error {
|
||||
|
||||
for _, nat := range containerInterface.PortMappings {
|
||||
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 {
|
||||
log.Infof("Unable to release IPv4 %s", err)
|
||||
logrus.Infof("Unable to release IPv4 %s", err)
|
||||
}
|
||||
if globalIPv6Network != 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
|
||||
@@ -650,10 +650,10 @@ func AllocatePort(job *engine.Job) error {
|
||||
// There is no point in immediately retrying to map an explicitly
|
||||
// chosen port.
|
||||
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
|
||||
}
|
||||
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 {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/networkdriver"
|
||||
)
|
||||
|
||||
@@ -157,7 +157,7 @@ func ipToBigInt(ip net.IP) *big.Int {
|
||||
return x.SetBytes(ip6)
|
||||
}
|
||||
|
||||
log.Errorf("ipToBigInt: Wrong IP length! %s", ip)
|
||||
logrus.Errorf("ipToBigInt: Wrong IP length! %s", ip)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -87,7 +87,7 @@ func init() {
|
||||
|
||||
file, err := os.Open(portRangeKernelParam)
|
||||
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
|
||||
}
|
||||
var start, end int
|
||||
@@ -96,7 +96,7 @@ func init() {
|
||||
if err == nil {
|
||||
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
|
||||
}
|
||||
beginPortRange = start
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/networkdriver/portallocator"
|
||||
"github.com/docker/docker/pkg/iptables"
|
||||
)
|
||||
@@ -156,7 +156,7 @@ func (pm *PortMapper) Unmap(host net.Addr) error {
|
||||
containerIP, containerPort := getIPAndPort(data.container)
|
||||
hostIP, hostPort := getIPAndPort(data.host)
|
||||
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) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/pubsub"
|
||||
"github.com/docker/libcontainer/system"
|
||||
@@ -80,13 +80,13 @@ func (s *statsCollector) run() {
|
||||
for container, publisher := range s.publishers {
|
||||
systemUsage, err := s.getSystemCpuUsage()
|
||||
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
|
||||
}
|
||||
stats, err := container.Stats()
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/chrootarchive"
|
||||
"github.com/docker/docker/pkg/symlink"
|
||||
@@ -133,7 +133,7 @@ func (container *Container) registerVolumes() {
|
||||
}
|
||||
v, err := container.daemon.volumes.FindOrCreateVolume(path, writable)
|
||||
if err != nil {
|
||||
log.Debugf("error registering volume %s: %v", path, err)
|
||||
logrus.Debugf("error registering volume %s: %v", path, err)
|
||||
continue
|
||||
}
|
||||
v.AddContainer(container.ID)
|
||||
@@ -144,7 +144,7 @@ func (container *Container) derefVolumes() {
|
||||
for path := range container.VolumePaths() {
|
||||
vol := container.daemon.volumes.Get(path)
|
||||
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
|
||||
}
|
||||
vol.RemoveContainer(container.ID)
|
||||
|
||||
Reference in New Issue
Block a user