| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"fmt" |
| 10 | 10 |
"sync" |
| 11 | 11 |
|
| 12 |
- log "github.com/Sirupsen/logrus" |
|
| 12 |
+ "github.com/Sirupsen/logrus" |
|
| 13 | 13 |
"github.com/docker/libnetwork/datastore" |
| 14 | 14 |
"github.com/docker/libnetwork/types" |
| 15 | 15 |
) |
| ... | ... |
@@ -286,7 +286,7 @@ func (h *Handle) CheckConsistency() error {
|
| 286 | 286 |
continue |
| 287 | 287 |
} |
| 288 | 288 |
|
| 289 |
- log.Infof("Fixed inconsistent bit sequence in datastore:\n%s\n%s", h, nh)
|
|
| 289 |
+ logrus.Infof("Fixed inconsistent bit sequence in datastore:\n%s\n%s", h, nh)
|
|
| 290 | 290 |
|
| 291 | 291 |
h.Lock() |
| 292 | 292 |
h.head = nh.head |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"strings" |
| 7 | 7 |
|
| 8 | 8 |
"github.com/BurntSushi/toml" |
| 9 |
- log "github.com/Sirupsen/logrus" |
|
| 9 |
+ "github.com/Sirupsen/logrus" |
|
| 10 | 10 |
"github.com/docker/docker/pkg/discovery" |
| 11 | 11 |
"github.com/docker/docker/pkg/plugingetter" |
| 12 | 12 |
"github.com/docker/go-connections/tlsconfig" |
| ... | ... |
@@ -100,7 +100,7 @@ type Option func(c *Config) |
| 100 | 100 |
// OptionDefaultNetwork function returns an option setter for a default network |
| 101 | 101 |
func OptionDefaultNetwork(dn string) Option {
|
| 102 | 102 |
return func(c *Config) {
|
| 103 |
- log.Debugf("Option DefaultNetwork: %s", dn)
|
|
| 103 |
+ logrus.Debugf("Option DefaultNetwork: %s", dn)
|
|
| 104 | 104 |
c.Daemon.DefaultNetwork = strings.TrimSpace(dn) |
| 105 | 105 |
} |
| 106 | 106 |
} |
| ... | ... |
@@ -108,7 +108,7 @@ func OptionDefaultNetwork(dn string) Option {
|
| 108 | 108 |
// OptionDefaultDriver function returns an option setter for default driver |
| 109 | 109 |
func OptionDefaultDriver(dd string) Option {
|
| 110 | 110 |
return func(c *Config) {
|
| 111 |
- log.Debugf("Option DefaultDriver: %s", dd)
|
|
| 111 |
+ logrus.Debugf("Option DefaultDriver: %s", dd)
|
|
| 112 | 112 |
c.Daemon.DefaultDriver = strings.TrimSpace(dd) |
| 113 | 113 |
} |
| 114 | 114 |
} |
| ... | ... |
@@ -134,7 +134,7 @@ func OptionLabels(labels []string) Option {
|
| 134 | 134 |
// OptionKVProvider function returns an option setter for kvstore provider |
| 135 | 135 |
func OptionKVProvider(provider string) Option {
|
| 136 | 136 |
return func(c *Config) {
|
| 137 |
- log.Debugf("Option OptionKVProvider: %s", provider)
|
|
| 137 |
+ logrus.Debugf("Option OptionKVProvider: %s", provider)
|
|
| 138 | 138 |
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
|
| 139 | 139 |
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
|
| 140 | 140 |
} |
| ... | ... |
@@ -145,7 +145,7 @@ func OptionKVProvider(provider string) Option {
|
| 145 | 145 |
// OptionKVProviderURL function returns an option setter for kvstore url |
| 146 | 146 |
func OptionKVProviderURL(url string) Option {
|
| 147 | 147 |
return func(c *Config) {
|
| 148 |
- log.Debugf("Option OptionKVProviderURL: %s", url)
|
|
| 148 |
+ logrus.Debugf("Option OptionKVProviderURL: %s", url)
|
|
| 149 | 149 |
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
|
| 150 | 150 |
c.Scopes[datastore.GlobalScope] = &datastore.ScopeCfg{}
|
| 151 | 151 |
} |
| ... | ... |
@@ -157,14 +157,14 @@ func OptionKVProviderURL(url string) Option {
|
| 157 | 157 |
func OptionKVOpts(opts map[string]string) Option {
|
| 158 | 158 |
return func(c *Config) {
|
| 159 | 159 |
if opts["kv.cacertfile"] != "" && opts["kv.certfile"] != "" && opts["kv.keyfile"] != "" {
|
| 160 |
- log.Info("Option Initializing KV with TLS")
|
|
| 160 |
+ logrus.Info("Option Initializing KV with TLS")
|
|
| 161 | 161 |
tlsConfig, err := tlsconfig.Client(tlsconfig.Options{
|
| 162 | 162 |
CAFile: opts["kv.cacertfile"], |
| 163 | 163 |
CertFile: opts["kv.certfile"], |
| 164 | 164 |
KeyFile: opts["kv.keyfile"], |
| 165 | 165 |
}) |
| 166 | 166 |
if err != nil {
|
| 167 |
- log.Errorf("Unable to set up TLS: %s", err)
|
|
| 167 |
+ logrus.Errorf("Unable to set up TLS: %s", err)
|
|
| 168 | 168 |
return |
| 169 | 169 |
} |
| 170 | 170 |
if _, ok := c.Scopes[datastore.GlobalScope]; !ok {
|
| ... | ... |
@@ -182,7 +182,7 @@ func OptionKVOpts(opts map[string]string) Option {
|
| 182 | 182 |
KeyFile: opts["kv.keyfile"], |
| 183 | 183 |
} |
| 184 | 184 |
} else {
|
| 185 |
- log.Info("Option Initializing KV without TLS")
|
|
| 185 |
+ logrus.Info("Option Initializing KV without TLS")
|
|
| 186 | 186 |
} |
| 187 | 187 |
} |
| 188 | 188 |
} |
| ... | ... |
@@ -242,7 +242,7 @@ func ValidateName(name string) error {
|
| 242 | 242 |
// OptionLocalKVProvider function returns an option setter for kvstore provider |
| 243 | 243 |
func OptionLocalKVProvider(provider string) Option {
|
| 244 | 244 |
return func(c *Config) {
|
| 245 |
- log.Debugf("Option OptionLocalKVProvider: %s", provider)
|
|
| 245 |
+ logrus.Debugf("Option OptionLocalKVProvider: %s", provider)
|
|
| 246 | 246 |
if _, ok := c.Scopes[datastore.LocalScope]; !ok {
|
| 247 | 247 |
c.Scopes[datastore.LocalScope] = &datastore.ScopeCfg{}
|
| 248 | 248 |
} |
| ... | ... |
@@ -253,7 +253,7 @@ func OptionLocalKVProvider(provider string) Option {
|
| 253 | 253 |
// OptionLocalKVProviderURL function returns an option setter for kvstore url |
| 254 | 254 |
func OptionLocalKVProviderURL(url string) Option {
|
| 255 | 255 |
return func(c *Config) {
|
| 256 |
- log.Debugf("Option OptionLocalKVProviderURL: %s", url)
|
|
| 256 |
+ logrus.Debugf("Option OptionLocalKVProviderURL: %s", url)
|
|
| 257 | 257 |
if _, ok := c.Scopes[datastore.LocalScope]; !ok {
|
| 258 | 258 |
c.Scopes[datastore.LocalScope] = &datastore.ScopeCfg{}
|
| 259 | 259 |
} |
| ... | ... |
@@ -264,7 +264,7 @@ func OptionLocalKVProviderURL(url string) Option {
|
| 264 | 264 |
// OptionLocalKVProviderConfig function returns an option setter for kvstore config |
| 265 | 265 |
func OptionLocalKVProviderConfig(config *store.Config) Option {
|
| 266 | 266 |
return func(c *Config) {
|
| 267 |
- log.Debugf("Option OptionLocalKVProviderConfig: %v", config)
|
|
| 267 |
+ logrus.Debugf("Option OptionLocalKVProviderConfig: %v", config)
|
|
| 268 | 268 |
if _, ok := c.Scopes[datastore.LocalScope]; !ok {
|
| 269 | 269 |
c.Scopes[datastore.LocalScope] = &datastore.ScopeCfg{}
|
| 270 | 270 |
} |
| ... | ... |
@@ -51,7 +51,7 @@ import ( |
| 51 | 51 |
"sync" |
| 52 | 52 |
"time" |
| 53 | 53 |
|
| 54 |
- log "github.com/Sirupsen/logrus" |
|
| 54 |
+ "github.com/Sirupsen/logrus" |
|
| 55 | 55 |
"github.com/docker/docker/pkg/discovery" |
| 56 | 56 |
"github.com/docker/docker/pkg/locker" |
| 57 | 57 |
"github.com/docker/docker/pkg/plugingetter" |
| ... | ... |
@@ -212,7 +212,7 @@ func New(cfgOptions ...config.Option) (NetworkController, error) {
|
| 212 | 212 |
if err := c.initDiscovery(c.cfg.Cluster.Watcher); err != nil {
|
| 213 | 213 |
// Failing to initialize discovery is a bad situation to be in. |
| 214 | 214 |
// But it cannot fail creating the Controller |
| 215 |
- log.Errorf("Failed to Initialize Discovery : %v", err)
|
|
| 215 |
+ logrus.Errorf("Failed to Initialize Discovery : %v", err)
|
|
| 216 | 216 |
} |
| 217 | 217 |
} |
| 218 | 218 |
|
| ... | ... |
@@ -283,7 +283,7 @@ func (c *controller) SetKeys(keys []*types.EncryptionKey) error {
|
| 283 | 283 |
if clusterConfigAvailable {
|
| 284 | 284 |
return c.agentSetup() |
| 285 | 285 |
} |
| 286 |
- log.Debugf("received encryption keys before cluster config")
|
|
| 286 |
+ logrus.Debug("received encryption keys before cluster config")
|
|
| 287 | 287 |
return nil |
| 288 | 288 |
} |
| 289 | 289 |
if agent == nil {
|
| ... | ... |
@@ -441,7 +441,7 @@ func (c *controller) ReloadConfiguration(cfgOptions ...config.Option) error {
|
| 441 | 441 |
c.drvRegistry.WalkIPAMs(func(name string, driver ipamapi.Ipam, cap *ipamapi.Capability) bool {
|
| 442 | 442 |
err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig) |
| 443 | 443 |
if err != nil {
|
| 444 |
- log.Errorf("Failed to set datastore in driver %s: %v", name, err)
|
|
| 444 |
+ logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
|
|
| 445 | 445 |
} |
| 446 | 446 |
return false |
| 447 | 447 |
}) |
| ... | ... |
@@ -449,14 +449,14 @@ func (c *controller) ReloadConfiguration(cfgOptions ...config.Option) error {
|
| 449 | 449 |
c.drvRegistry.WalkDrivers(func(name string, driver driverapi.Driver, capability driverapi.Capability) bool {
|
| 450 | 450 |
err := driver.DiscoverNew(discoverapi.DatastoreConfig, *dsConfig) |
| 451 | 451 |
if err != nil {
|
| 452 |
- log.Errorf("Failed to set datastore in driver %s: %v", name, err)
|
|
| 452 |
+ logrus.Errorf("Failed to set datastore in driver %s: %v", name, err)
|
|
| 453 | 453 |
} |
| 454 | 454 |
return false |
| 455 | 455 |
}) |
| 456 | 456 |
|
| 457 | 457 |
if c.discovery == nil && c.cfg.Cluster.Watcher != nil {
|
| 458 | 458 |
if err := c.initDiscovery(c.cfg.Cluster.Watcher); err != nil {
|
| 459 |
- log.Errorf("Failed to Initialize Discovery after configuration update: %v", err)
|
|
| 459 |
+ logrus.Errorf("Failed to Initialize Discovery after configuration update: %v", err)
|
|
| 460 | 460 |
} |
| 461 | 461 |
} |
| 462 | 462 |
|
| ... | ... |
@@ -561,7 +561,7 @@ func (c *controller) pushNodeDiscovery(d driverapi.Driver, cap driverapi.Capabil |
| 561 | 561 |
err = d.DiscoverDelete(discoverapi.NodeDiscovery, nodeData) |
| 562 | 562 |
} |
| 563 | 563 |
if err != nil {
|
| 564 |
- log.Debugf("discovery notification error : %v", err)
|
|
| 564 |
+ logrus.Debugf("discovery notification error : %v", err)
|
|
| 565 | 565 |
} |
| 566 | 566 |
} |
| 567 | 567 |
} |
| ... | ... |
@@ -687,7 +687,7 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ... |
| 687 | 687 |
defer func() {
|
| 688 | 688 |
if err != nil {
|
| 689 | 689 |
if e := network.deleteNetwork(); e != nil {
|
| 690 |
- log.Warnf("couldn't roll back driver network on network %s creation failure: %v", network.name, err)
|
|
| 690 |
+ logrus.Warnf("couldn't roll back driver network on network %s creation failure: %v", network.name, err)
|
|
| 691 | 691 |
} |
| 692 | 692 |
} |
| 693 | 693 |
}() |
| ... | ... |
@@ -702,7 +702,7 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ... |
| 702 | 702 |
defer func() {
|
| 703 | 703 |
if err != nil {
|
| 704 | 704 |
if e := c.deleteFromStore(epCnt); e != nil {
|
| 705 |
- log.Warnf("could not rollback from store, epCnt %v on failure (%v): %v", epCnt, err, e)
|
|
| 705 |
+ logrus.Warnf("could not rollback from store, epCnt %v on failure (%v): %v", epCnt, err, e)
|
|
| 706 | 706 |
} |
| 707 | 707 |
} |
| 708 | 708 |
}() |
| ... | ... |
@@ -723,7 +723,7 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ... |
| 723 | 723 |
var joinCluster NetworkWalker = func(nw Network) bool {
|
| 724 | 724 |
n := nw.(*network) |
| 725 | 725 |
if err := n.joinCluster(); err != nil {
|
| 726 |
- log.Errorf("Failed to join network %s (%s) into agent cluster: %v", n.Name(), n.ID(), err)
|
|
| 726 |
+ logrus.Errorf("Failed to join network %s (%s) into agent cluster: %v", n.Name(), n.ID(), err)
|
|
| 727 | 727 |
} |
| 728 | 728 |
n.addDriverWatches() |
| 729 | 729 |
return false |
| ... | ... |
@@ -732,7 +732,7 @@ var joinCluster NetworkWalker = func(nw Network) bool {
|
| 732 | 732 |
func (c *controller) reservePools() {
|
| 733 | 733 |
networks, err := c.getNetworksForScope(datastore.LocalScope) |
| 734 | 734 |
if err != nil {
|
| 735 |
- log.Warnf("Could not retrieve networks from local store during ipam allocation for existing networks: %v", err)
|
|
| 735 |
+ logrus.Warnf("Could not retrieve networks from local store during ipam allocation for existing networks: %v", err)
|
|
| 736 | 736 |
return |
| 737 | 737 |
} |
| 738 | 738 |
|
| ... | ... |
@@ -764,22 +764,22 @@ func (c *controller) reservePools() {
|
| 764 | 764 |
} |
| 765 | 765 |
// Reserve pools |
| 766 | 766 |
if err := n.ipamAllocate(); err != nil {
|
| 767 |
- log.Warnf("Failed to allocate ipam pool(s) for network %q (%s): %v", n.Name(), n.ID(), err)
|
|
| 767 |
+ logrus.Warnf("Failed to allocate ipam pool(s) for network %q (%s): %v", n.Name(), n.ID(), err)
|
|
| 768 | 768 |
} |
| 769 | 769 |
// Reserve existing endpoints' addresses |
| 770 | 770 |
ipam, _, err := n.getController().getIPAMDriver(n.ipamType) |
| 771 | 771 |
if err != nil {
|
| 772 |
- log.Warnf("Failed to retrieve ipam driver for network %q (%s) during address reservation", n.Name(), n.ID())
|
|
| 772 |
+ logrus.Warnf("Failed to retrieve ipam driver for network %q (%s) during address reservation", n.Name(), n.ID())
|
|
| 773 | 773 |
continue |
| 774 | 774 |
} |
| 775 | 775 |
epl, err := n.getEndpointsFromStore() |
| 776 | 776 |
if err != nil {
|
| 777 |
- log.Warnf("Failed to retrieve list of current endpoints on network %q (%s)", n.Name(), n.ID())
|
|
| 777 |
+ logrus.Warnf("Failed to retrieve list of current endpoints on network %q (%s)", n.Name(), n.ID())
|
|
| 778 | 778 |
continue |
| 779 | 779 |
} |
| 780 | 780 |
for _, ep := range epl {
|
| 781 | 781 |
if err := ep.assignAddress(ipam, true, ep.Iface().AddressIPv6() != nil); err != nil {
|
| 782 |
- log.Warnf("Failed to reserve current adress for endpoint %q (%s) on network %q (%s)",
|
|
| 782 |
+ logrus.Warnf("Failed to reserve current adress for endpoint %q (%s) on network %q (%s)",
|
|
| 783 | 783 |
ep.Name(), ep.ID(), n.Name(), n.ID()) |
| 784 | 784 |
} |
| 785 | 785 |
} |
| ... | ... |
@@ -789,7 +789,7 @@ func (c *controller) reservePools() {
|
| 789 | 789 |
func doReplayPoolReserve(n *network) bool {
|
| 790 | 790 |
_, caps, err := n.getController().getIPAMDriver(n.ipamType) |
| 791 | 791 |
if err != nil {
|
| 792 |
- log.Warnf("Failed to retrieve ipam driver for network %q (%s): %v", n.Name(), n.ID(), err)
|
|
| 792 |
+ logrus.Warnf("Failed to retrieve ipam driver for network %q (%s): %v", n.Name(), n.ID(), err)
|
|
| 793 | 793 |
return false |
| 794 | 794 |
} |
| 795 | 795 |
return caps.RequiresRequestReplay |
| ... | ... |
@@ -816,7 +816,7 @@ func (c *controller) Networks() []Network {
|
| 816 | 816 |
|
| 817 | 817 |
networks, err := c.getNetworksFromStore() |
| 818 | 818 |
if err != nil {
|
| 819 |
- log.Error(err) |
|
| 819 |
+ logrus.Error(err) |
|
| 820 | 820 |
} |
| 821 | 821 |
|
| 822 | 822 |
for _, n := range networks {
|
| ... | ... |
@@ -1133,18 +1133,18 @@ func (c *controller) clearIngress(clusterLeave bool) {
|
| 1133 | 1133 |
|
| 1134 | 1134 |
if ingressSandbox != nil {
|
| 1135 | 1135 |
if err := ingressSandbox.Delete(); err != nil {
|
| 1136 |
- log.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
|
| 1136 |
+ logrus.Warnf("Could not delete ingress sandbox while leaving: %v", err)
|
|
| 1137 | 1137 |
} |
| 1138 | 1138 |
} |
| 1139 | 1139 |
|
| 1140 | 1140 |
n, err := c.NetworkByName("ingress")
|
| 1141 | 1141 |
if err != nil && clusterLeave {
|
| 1142 |
- log.Warnf("Could not find ingress network while leaving: %v", err)
|
|
| 1142 |
+ logrus.Warnf("Could not find ingress network while leaving: %v", err)
|
|
| 1143 | 1143 |
} |
| 1144 | 1144 |
|
| 1145 | 1145 |
if n != nil {
|
| 1146 | 1146 |
if err := n.Delete(); err != nil {
|
| 1147 |
- log.Warnf("Could not delete ingress network while leaving: %v", err)
|
|
| 1147 |
+ logrus.Warnf("Could not delete ingress network while leaving: %v", err)
|
|
| 1148 | 1148 |
} |
| 1149 | 1149 |
} |
| 1150 | 1150 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
"github.com/docker/libnetwork/iptables" |
| 9 | 9 |
"github.com/docker/libnetwork/types" |
| 10 | 10 |
) |
| ... | ... |
@@ -44,7 +44,7 @@ func (l *link) Disable() {
|
| 44 | 44 |
// -D == iptables delete flag |
| 45 | 45 |
err := linkContainers("-D", l.parentIP, l.childIP, l.ports, l.bridge, true)
|
| 46 | 46 |
if err != nil {
|
| 47 |
- log.Errorf("Error removing IPTables rules for a link %s due to %s", l.String(), err.Error())
|
|
| 47 |
+ logrus.Errorf("Error removing IPTables rules for a link %s due to %s", l.String(), err.Error())
|
|
| 48 | 48 |
} |
| 49 | 49 |
// Return proper error once we move to use a proper iptables package |
| 50 | 50 |
// that returns typed errors |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"net" |
| 7 | 7 |
"path/filepath" |
| 8 | 8 |
|
| 9 |
- log "github.com/Sirupsen/logrus" |
|
| 9 |
+ "github.com/Sirupsen/logrus" |
|
| 10 | 10 |
"github.com/docker/libnetwork/types" |
| 11 | 11 |
"github.com/vishvananda/netlink" |
| 12 | 12 |
) |
| ... | ... |
@@ -39,7 +39,7 @@ func setupBridgeIPv4(config *networkConfiguration, i *bridgeInterface) error {
|
| 39 | 39 |
return fmt.Errorf("failed to remove current ip address from bridge: %v", err)
|
| 40 | 40 |
} |
| 41 | 41 |
} |
| 42 |
- log.Debugf("Assigning address to bridge interface %s: %s", config.BridgeName, config.AddressIPv4)
|
|
| 42 |
+ logrus.Debugf("Assigning address to bridge interface %s: %s", config.BridgeName, config.AddressIPv4)
|
|
| 43 | 43 |
if err := i.nlh.AddrAdd(i.Link, &netlink.Addr{IPNet: config.AddressIPv4}); err != nil {
|
| 44 | 44 |
return &IPv4AddrAddError{IP: config.AddressIPv4, Err: err}
|
| 45 | 45 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"strings" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
"github.com/docker/libnetwork/ns" |
| 9 | 9 |
"github.com/docker/libnetwork/types" |
| 10 | 10 |
"github.com/vishvananda/netlink" |
| ... | ... |
@@ -39,7 +39,7 @@ func setupVerifyAndReconcile(config *networkConfiguration, i *bridgeInterface) e |
| 39 | 39 |
for _, addrv6 := range addrsv6 {
|
| 40 | 40 |
if addrv6.IP.IsGlobalUnicast() && !types.CompareIPNet(addrv6.IPNet, i.bridgeIPv6) {
|
| 41 | 41 |
if err := i.nlh.AddrDel(i.Link, &addrv6); err != nil {
|
| 42 |
- log.Warnf("Failed to remove residual IPv6 address %s from bridge: %v", addrv6.IPNet, err)
|
|
| 42 |
+ logrus.Warnf("Failed to remove residual IPv6 address %s from bridge: %v", addrv6.IPNet, err)
|
|
| 43 | 43 |
} |
| 44 | 44 |
} |
| 45 | 45 |
} |
| ... | ... |
@@ -12,7 +12,7 @@ import ( |
| 12 | 12 |
|
| 13 | 13 |
"strconv" |
| 14 | 14 |
|
| 15 |
- log "github.com/Sirupsen/logrus" |
|
| 15 |
+ "github.com/Sirupsen/logrus" |
|
| 16 | 16 |
"github.com/docker/libnetwork/iptables" |
| 17 | 17 |
"github.com/docker/libnetwork/ns" |
| 18 | 18 |
"github.com/docker/libnetwork/types" |
| ... | ... |
@@ -77,7 +77,7 @@ func (e *encrMap) String() string {
|
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 | 79 |
func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal, add bool) error {
|
| 80 |
- log.Debugf("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
|
|
| 80 |
+ logrus.Debugf("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
|
|
| 81 | 81 |
|
| 82 | 82 |
n := d.network(nid) |
| 83 | 83 |
if n == nil || !n.secure {
|
| ... | ... |
@@ -100,7 +100,7 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 100 | 100 |
} |
| 101 | 101 |
return false |
| 102 | 102 |
}); err != nil {
|
| 103 |
- log.Warnf("Failed to retrieve list of participating nodes in overlay network %s: %v", nid[0:5], err)
|
|
| 103 |
+ logrus.Warnf("Failed to retrieve list of participating nodes in overlay network %s: %v", nid[0:5], err)
|
|
| 104 | 104 |
} |
| 105 | 105 |
default: |
| 106 | 106 |
if len(d.network(nid).endpoints) > 0 {
|
| ... | ... |
@@ -108,18 +108,18 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 108 | 108 |
} |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 |
- log.Debugf("List of nodes: %s", nodes)
|
|
| 111 |
+ logrus.Debugf("List of nodes: %s", nodes)
|
|
| 112 | 112 |
|
| 113 | 113 |
if add {
|
| 114 | 114 |
for _, rIP := range nodes {
|
| 115 | 115 |
if err := setupEncryption(lIP, aIP, rIP, vxlanID, d.secMap, d.keys); err != nil {
|
| 116 |
- log.Warnf("Failed to program network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 116 |
+ logrus.Warnf("Failed to program network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 117 | 117 |
} |
| 118 | 118 |
} |
| 119 | 119 |
} else {
|
| 120 | 120 |
if len(nodes) == 0 {
|
| 121 | 121 |
if err := removeEncryption(lIP, rIP, d.secMap); err != nil {
|
| 122 |
- log.Warnf("Failed to remove network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 122 |
+ logrus.Warnf("Failed to remove network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 123 | 123 |
} |
| 124 | 124 |
} |
| 125 | 125 |
} |
| ... | ... |
@@ -128,14 +128,14 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
func setupEncryption(localIP, advIP, remoteIP net.IP, vni uint32, em *encrMap, keys []*key) error {
|
| 131 |
- log.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
|
|
| 131 |
+ logrus.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
|
|
| 132 | 132 |
rIPs := remoteIP.String() |
| 133 | 133 |
|
| 134 | 134 |
indices := make([]*spi, 0, len(keys)) |
| 135 | 135 |
|
| 136 | 136 |
err := programMangle(vni, true) |
| 137 | 137 |
if err != nil {
|
| 138 |
- log.Warn(err) |
|
| 138 |
+ logrus.Warn(err) |
|
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
for i, k := range keys {
|
| ... | ... |
@@ -146,7 +146,7 @@ func setupEncryption(localIP, advIP, remoteIP net.IP, vni uint32, em *encrMap, k |
| 146 | 146 |
} |
| 147 | 147 |
fSA, rSA, err := programSA(localIP, remoteIP, spis, k, dir, true) |
| 148 | 148 |
if err != nil {
|
| 149 |
- log.Warn(err) |
|
| 149 |
+ logrus.Warn(err) |
|
| 150 | 150 |
} |
| 151 | 151 |
indices = append(indices, spis) |
| 152 | 152 |
if i != 0 {
|
| ... | ... |
@@ -154,7 +154,7 @@ func setupEncryption(localIP, advIP, remoteIP net.IP, vni uint32, em *encrMap, k |
| 154 | 154 |
} |
| 155 | 155 |
err = programSP(fSA, rSA, true) |
| 156 | 156 |
if err != nil {
|
| 157 |
- log.Warn(err) |
|
| 157 |
+ logrus.Warn(err) |
|
| 158 | 158 |
} |
| 159 | 159 |
} |
| 160 | 160 |
|
| ... | ... |
@@ -179,14 +179,14 @@ func removeEncryption(localIP, remoteIP net.IP, em *encrMap) error {
|
| 179 | 179 |
} |
| 180 | 180 |
fSA, rSA, err := programSA(localIP, remoteIP, idxs, nil, dir, false) |
| 181 | 181 |
if err != nil {
|
| 182 |
- log.Warn(err) |
|
| 182 |
+ logrus.Warn(err) |
|
| 183 | 183 |
} |
| 184 | 184 |
if i != 0 {
|
| 185 | 185 |
continue |
| 186 | 186 |
} |
| 187 | 187 |
err = programSP(fSA, rSA, false) |
| 188 | 188 |
if err != nil {
|
| 189 |
- log.Warn(err) |
|
| 189 |
+ logrus.Warn(err) |
|
| 190 | 190 |
} |
| 191 | 191 |
} |
| 192 | 192 |
return nil |
| ... | ... |
@@ -213,7 +213,7 @@ func programMangle(vni uint32, add bool) (err error) {
|
| 213 | 213 |
} |
| 214 | 214 |
|
| 215 | 215 |
if err = iptables.RawCombinedOutput(append([]string{"-t", string(iptables.Mangle), a, chain}, rule...)...); err != nil {
|
| 216 |
- log.Warnf("could not %s mangle rule: %v", action, err)
|
|
| 216 |
+ logrus.Warnf("could not %s mangle rule: %v", action, err)
|
|
| 217 | 217 |
} |
| 218 | 218 |
|
| 219 | 219 |
return |
| ... | ... |
@@ -248,9 +248,9 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f |
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
if add != exists {
|
| 251 |
- log.Debugf("%s: rSA{%s}", action, rSA)
|
|
| 251 |
+ logrus.Debugf("%s: rSA{%s}", action, rSA)
|
|
| 252 | 252 |
if err := xfrmProgram(rSA); err != nil {
|
| 253 |
- log.Warnf("Failed %s rSA{%s}: %v", action, rSA, err)
|
|
| 253 |
+ logrus.Warnf("Failed %s rSA{%s}: %v", action, rSA, err)
|
|
| 254 | 254 |
} |
| 255 | 255 |
} |
| 256 | 256 |
} |
| ... | ... |
@@ -273,9 +273,9 @@ func programSA(localIP, remoteIP net.IP, spi *spi, k *key, dir int, add bool) (f |
| 273 | 273 |
} |
| 274 | 274 |
|
| 275 | 275 |
if add != exists {
|
| 276 |
- log.Debugf("%s fSA{%s}", action, fSA)
|
|
| 276 |
+ logrus.Debugf("%s fSA{%s}", action, fSA)
|
|
| 277 | 277 |
if err := xfrmProgram(fSA); err != nil {
|
| 278 |
- log.Warnf("Failed %s fSA{%s}: %v.", action, fSA, err)
|
|
| 278 |
+ logrus.Warnf("Failed %s fSA{%s}: %v.", action, fSA, err)
|
|
| 279 | 279 |
} |
| 280 | 280 |
} |
| 281 | 281 |
} |
| ... | ... |
@@ -319,9 +319,9 @@ func programSP(fSA *netlink.XfrmState, rSA *netlink.XfrmState, add bool) error {
|
| 319 | 319 |
} |
| 320 | 320 |
|
| 321 | 321 |
if add != exists {
|
| 322 |
- log.Debugf("%s fSP{%s}", action, fPol)
|
|
| 322 |
+ logrus.Debugf("%s fSP{%s}", action, fPol)
|
|
| 323 | 323 |
if err := xfrmProgram(fPol); err != nil {
|
| 324 |
- log.Warnf("%s fSP{%s}: %v", action, fPol, err)
|
|
| 324 |
+ logrus.Warnf("%s fSP{%s}: %v", action, fPol, err)
|
|
| 325 | 325 |
} |
| 326 | 326 |
} |
| 327 | 327 |
|
| ... | ... |
@@ -337,7 +337,7 @@ func saExists(sa *netlink.XfrmState) (bool, error) {
|
| 337 | 337 |
return false, nil |
| 338 | 338 |
default: |
| 339 | 339 |
err = fmt.Errorf("Error while checking for SA existence: %v", err)
|
| 340 |
- log.Warn(err) |
|
| 340 |
+ logrus.Warn(err) |
|
| 341 | 341 |
return false, err |
| 342 | 342 |
} |
| 343 | 343 |
} |
| ... | ... |
@@ -351,7 +351,7 @@ func spExists(sp *netlink.XfrmPolicy) (bool, error) {
|
| 351 | 351 |
return false, nil |
| 352 | 352 |
default: |
| 353 | 353 |
err = fmt.Errorf("Error while checking for SP existence: %v", err)
|
| 354 |
- log.Warn(err) |
|
| 354 |
+ logrus.Warn(err) |
|
| 355 | 355 |
return false, err |
| 356 | 356 |
} |
| 357 | 357 |
} |
| ... | ... |
@@ -397,16 +397,16 @@ func (d *driver) setKeys(keys []*key) error {
|
| 397 | 397 |
d.keys = keys |
| 398 | 398 |
d.secMap = &encrMap{nodes: map[string][]*spi{}}
|
| 399 | 399 |
d.Unlock() |
| 400 |
- log.Debugf("Initial encryption keys: %v", d.keys)
|
|
| 400 |
+ logrus.Debugf("Initial encryption keys: %v", d.keys)
|
|
| 401 | 401 |
return nil |
| 402 | 402 |
} |
| 403 | 403 |
|
| 404 | 404 |
// updateKeys allows to add a new key and/or change the primary key and/or prune an existing key |
| 405 | 405 |
// The primary key is the key used in transmission and will go in first position in the list. |
| 406 | 406 |
func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 407 |
- log.Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
|
|
| 407 |
+ logrus.Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
|
|
| 408 | 408 |
|
| 409 |
- log.Debugf("Current: %v", d.keys)
|
|
| 409 |
+ logrus.Debugf("Current: %v", d.keys)
|
|
| 410 | 410 |
|
| 411 | 411 |
var ( |
| 412 | 412 |
newIdx = -1 |
| ... | ... |
@@ -459,7 +459,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 459 | 459 |
} |
| 460 | 460 |
d.Unlock() |
| 461 | 461 |
|
| 462 |
- log.Debugf("Updated: %v", d.keys)
|
|
| 462 |
+ logrus.Debugf("Updated: %v", d.keys)
|
|
| 463 | 463 |
|
| 464 | 464 |
return nil |
| 465 | 465 |
} |
| ... | ... |
@@ -472,10 +472,10 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 472 | 472 |
|
| 473 | 473 |
// Spis and keys are sorted in such away the one in position 0 is the primary |
| 474 | 474 |
func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx, delIdx int) []*spi {
|
| 475 |
- log.Debugf("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
|
|
| 475 |
+ logrus.Debugf("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
|
|
| 476 | 476 |
|
| 477 | 477 |
spis := idxs |
| 478 |
- log.Debugf("Current: %v", spis)
|
|
| 478 |
+ logrus.Debugf("Current: %v", spis)
|
|
| 479 | 479 |
|
| 480 | 480 |
// add new |
| 481 | 481 |
if newIdx != -1 {
|
| ... | ... |
@@ -520,9 +520,9 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx, |
| 520 | 520 |
}, |
| 521 | 521 |
}, |
| 522 | 522 |
} |
| 523 |
- log.Debugf("Updating fSP{%s}", fSP1)
|
|
| 523 |
+ logrus.Debugf("Updating fSP{%s}", fSP1)
|
|
| 524 | 524 |
if err := ns.NlHandle().XfrmPolicyUpdate(fSP1); err != nil {
|
| 525 |
- log.Warnf("Failed to update fSP{%s}: %v", fSP1, err)
|
|
| 525 |
+ logrus.Warnf("Failed to update fSP{%s}: %v", fSP1, err)
|
|
| 526 | 526 |
} |
| 527 | 527 |
|
| 528 | 528 |
// -fSA1 |
| ... | ... |
@@ -543,7 +543,7 @@ func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx, |
| 543 | 543 |
spis = append(spis[:delIdx], spis[delIdx+1:]...) |
| 544 | 544 |
} |
| 545 | 545 |
|
| 546 |
- log.Debugf("Updated: %v", spis)
|
|
| 546 |
+ logrus.Debugf("Updated: %v", spis)
|
|
| 547 | 547 |
|
| 548 | 548 |
return spis |
| 549 | 549 |
} |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"net" |
| 6 | 6 |
"syscall" |
| 7 | 7 |
|
| 8 |
- log "github.com/Sirupsen/logrus" |
|
| 8 |
+ "github.com/Sirupsen/logrus" |
|
| 9 | 9 |
"github.com/docker/libnetwork/driverapi" |
| 10 | 10 |
"github.com/docker/libnetwork/ns" |
| 11 | 11 |
"github.com/docker/libnetwork/types" |
| ... | ... |
@@ -109,7 +109,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 109 | 109 |
continue |
| 110 | 110 |
} |
| 111 | 111 |
if err := jinfo.AddStaticRoute(sub.subnetIP, types.NEXTHOP, s.gwIP.IP); err != nil {
|
| 112 |
- log.Errorf("Adding subnet %s static route in network %q failed\n", s.subnetIP, n.id)
|
|
| 112 |
+ logrus.Errorf("Adding subnet %s static route in network %q failed\n", s.subnetIP, n.id)
|
|
| 113 | 113 |
} |
| 114 | 114 |
} |
| 115 | 115 |
|
| ... | ... |
@@ -124,7 +124,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 124 | 124 |
net.ParseIP(d.advertiseAddress), true) |
| 125 | 125 |
|
| 126 | 126 |
if err := d.checkEncryption(nid, nil, n.vxlanID(s), true, true); err != nil {
|
| 127 |
- log.Warn(err) |
|
| 127 |
+ logrus.Warn(err) |
|
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
buf, err := proto.Marshal(&PeerRecord{
|
| ... | ... |
@@ -137,7 +137,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 | 139 |
if err := jinfo.AddTableEntry(ovPeerTable, eid, buf); err != nil {
|
| 140 |
- log.Errorf("overlay: Failed adding table entry to joininfo: %v", err)
|
|
| 140 |
+ logrus.Errorf("overlay: Failed adding table entry to joininfo: %v", err)
|
|
| 141 | 141 |
} |
| 142 | 142 |
|
| 143 | 143 |
d.pushLocalEndpointEvent("join", nid, eid)
|
| ... | ... |
@@ -147,7 +147,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 147 | 147 |
|
| 148 | 148 |
func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key string, value []byte) {
|
| 149 | 149 |
if tableName != ovPeerTable {
|
| 150 |
- log.Errorf("Unexpected table notification for table %s received", tableName)
|
|
| 150 |
+ logrus.Errorf("Unexpected table notification for table %s received", tableName)
|
|
| 151 | 151 |
return |
| 152 | 152 |
} |
| 153 | 153 |
|
| ... | ... |
@@ -155,7 +155,7 @@ func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key stri |
| 155 | 155 |
|
| 156 | 156 |
var peer PeerRecord |
| 157 | 157 |
if err := proto.Unmarshal(value, &peer); err != nil {
|
| 158 |
- log.Errorf("Failed to unmarshal peer record: %v", err)
|
|
| 158 |
+ logrus.Errorf("Failed to unmarshal peer record: %v", err)
|
|
| 159 | 159 |
return |
| 160 | 160 |
} |
| 161 | 161 |
|
| ... | ... |
@@ -167,19 +167,19 @@ func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key stri |
| 167 | 167 |
|
| 168 | 168 |
addr, err := types.ParseCIDR(peer.EndpointIP) |
| 169 | 169 |
if err != nil {
|
| 170 |
- log.Errorf("Invalid peer IP %s received in event notify", peer.EndpointIP)
|
|
| 170 |
+ logrus.Errorf("Invalid peer IP %s received in event notify", peer.EndpointIP)
|
|
| 171 | 171 |
return |
| 172 | 172 |
} |
| 173 | 173 |
|
| 174 | 174 |
mac, err := net.ParseMAC(peer.EndpointMAC) |
| 175 | 175 |
if err != nil {
|
| 176 |
- log.Errorf("Invalid mac %s received in event notify", peer.EndpointMAC)
|
|
| 176 |
+ logrus.Errorf("Invalid mac %s received in event notify", peer.EndpointMAC)
|
|
| 177 | 177 |
return |
| 178 | 178 |
} |
| 179 | 179 |
|
| 180 | 180 |
vtep := net.ParseIP(peer.TunnelEndpointIP) |
| 181 | 181 |
if vtep == nil {
|
| 182 |
- log.Errorf("Invalid VTEP %s received in event notify", peer.TunnelEndpointIP)
|
|
| 182 |
+ logrus.Errorf("Invalid VTEP %s received in event notify", peer.TunnelEndpointIP)
|
|
| 183 | 183 |
return |
| 184 | 184 |
} |
| 185 | 185 |
|
| ... | ... |
@@ -219,7 +219,7 @@ func (d *driver) Leave(nid, eid string) error {
|
| 219 | 219 |
n.leaveSandbox() |
| 220 | 220 |
|
| 221 | 221 |
if err := d.checkEncryption(nid, nil, 0, true, false); err != nil {
|
| 222 |
- log.Warn(err) |
|
| 222 |
+ logrus.Warn(err) |
|
| 223 | 223 |
} |
| 224 | 224 |
|
| 225 | 225 |
return nil |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"net" |
| 7 | 7 |
|
| 8 |
- log "github.com/Sirupsen/logrus" |
|
| 8 |
+ "github.com/Sirupsen/logrus" |
|
| 9 | 9 |
"github.com/docker/libnetwork/datastore" |
| 10 | 10 |
"github.com/docker/libnetwork/driverapi" |
| 11 | 11 |
"github.com/docker/libnetwork/netutils" |
| ... | ... |
@@ -116,7 +116,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
|
| 116 | 116 |
n.deleteEndpoint(eid) |
| 117 | 117 |
|
| 118 | 118 |
if err := d.deleteEndpointFromStore(ep); err != nil {
|
| 119 |
- log.Warnf("Failed to delete overlay endpoint %s from local store: %v", ep.id[0:7], err)
|
|
| 119 |
+ logrus.Warnf("Failed to delete overlay endpoint %s from local store: %v", ep.id[0:7], err)
|
|
| 120 | 120 |
} |
| 121 | 121 |
|
| 122 | 122 |
if ep.ifName == "" {
|
| ... | ... |
@@ -125,11 +125,11 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
|
| 125 | 125 |
|
| 126 | 126 |
link, err := nlh.LinkByName(ep.ifName) |
| 127 | 127 |
if err != nil {
|
| 128 |
- log.Debugf("Failed to retrieve interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
|
|
| 128 |
+ logrus.Debugf("Failed to retrieve interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
|
|
| 129 | 129 |
return nil |
| 130 | 130 |
} |
| 131 | 131 |
if err := nlh.LinkDel(link); err != nil {
|
| 132 |
- log.Debugf("Failed to delete interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
|
|
| 132 |
+ logrus.Debugf("Failed to delete interface (%s)'s link on endpoint (%s) delete: %v", ep.ifName, ep.id, err)
|
|
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
return nil |
| ... | ... |
@@ -111,7 +111,7 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
|
| 111 | 111 |
// Endpoints are stored in the local store. Restore them and reconstruct the overlay sandbox |
| 112 | 112 |
func (d *driver) restoreEndpoints() error {
|
| 113 | 113 |
if d.localStore == nil {
|
| 114 |
- logrus.Warnf("Cannot restore overlay endpoints because local datastore is missing")
|
|
| 114 |
+ logrus.Warn("Cannot restore overlay endpoints because local datastore is missing")
|
|
| 115 | 115 |
return nil |
| 116 | 116 |
} |
| 117 | 117 |
kvol, err := d.localStore.List(datastore.Key(overlayEndpointPrefix), &endpoint{})
|
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"sync" |
| 7 | 7 |
"syscall" |
| 8 | 8 |
|
| 9 |
- log "github.com/Sirupsen/logrus" |
|
| 9 |
+ "github.com/Sirupsen/logrus" |
|
| 10 | 10 |
) |
| 11 | 11 |
|
| 12 | 12 |
const ovPeerTable = "overlay_peer_table" |
| ... | ... |
@@ -90,7 +90,7 @@ func (d *driver) peerDbNetworkWalk(nid string, f func(*peerKey, *peerEntry) bool |
| 90 | 90 |
for pKeyStr, pEntry := range pMap.mp {
|
| 91 | 91 |
var pKey peerKey |
| 92 | 92 |
if _, err := fmt.Sscan(pKeyStr, &pKey); err != nil {
|
| 93 |
- log.Warnf("Peer key scan on network %s failed: %v", nid, err)
|
|
| 93 |
+ logrus.Warnf("Peer key scan on network %s failed: %v", nid, err)
|
|
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 | 96 |
if f(&pKey, &pEntry) {
|
| ... | ... |
@@ -289,7 +289,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 289 | 289 |
} |
| 290 | 290 |
|
| 291 | 291 |
if err := d.checkEncryption(nid, vtep, n.vxlanID(s), false, true); err != nil {
|
| 292 |
- log.Warn(err) |
|
| 292 |
+ logrus.Warn(err) |
|
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
// Add neighbor entry for the peer IP |
| ... | ... |
@@ -349,7 +349,7 @@ func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMas |
| 349 | 349 |
} |
| 350 | 350 |
|
| 351 | 351 |
if err := d.checkEncryption(nid, vtep, 0, false, false); err != nil {
|
| 352 |
- log.Warn(err) |
|
| 352 |
+ logrus.Warn(err) |
|
| 353 | 353 |
} |
| 354 | 354 |
|
| 355 | 355 |
return nil |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
"github.com/docker/docker/pkg/plugins" |
| 9 | 9 |
"github.com/docker/libnetwork/datastore" |
| 10 | 10 |
"github.com/docker/libnetwork/discoverapi" |
| ... | ... |
@@ -39,11 +39,11 @@ func Init(dc driverapi.DriverCallback, config map[string]interface{}) error {
|
| 39 | 39 |
d := newDriver(name, client) |
| 40 | 40 |
c, err := d.(*driver).getCapabilities() |
| 41 | 41 |
if err != nil {
|
| 42 |
- log.Errorf("error getting capability for %s due to %v", name, err)
|
|
| 42 |
+ logrus.Errorf("error getting capability for %s due to %v", name, err)
|
|
| 43 | 43 |
return |
| 44 | 44 |
} |
| 45 | 45 |
if err = dc.RegisterDriver(name, d, *c); err != nil {
|
| 46 |
- log.Errorf("error registering driver for %s due to %v", name, err)
|
|
| 46 |
+ logrus.Errorf("error registering driver for %s due to %v", name, err)
|
|
| 47 | 47 |
} |
| 48 | 48 |
}) |
| 49 | 49 |
return nil |
| ... | ... |
@@ -390,7 +390,7 @@ func bridgeSetup(config *networkConfiguration) error {
|
| 390 | 390 |
"/usr/bin/grep " + config.DefaultBindingIP.String() |
| 391 | 391 |
out, err := exec.Command("/usr/bin/bash", "-c", ipadmCmd).Output()
|
| 392 | 392 |
if err != nil {
|
| 393 |
- logrus.Warnf("cannot find binding interface")
|
|
| 393 |
+ logrus.Warn("cannot find binding interface")
|
|
| 394 | 394 |
return err |
| 395 | 395 |
} |
| 396 | 396 |
bindingIntf = strings.SplitN(string(out), "/", 2)[0] |
| ... | ... |
@@ -456,21 +456,21 @@ func bridgeCleanup(config *networkConfiguration, logErr bool) {
|
| 456 | 456 |
|
| 457 | 457 |
err = exec.Command("/usr/sbin/pfctl", "-a", pfAnchor, "-F", "all").Run()
|
| 458 | 458 |
if err != nil && logErr {
|
| 459 |
- logrus.Warnf("cannot flush firewall rules")
|
|
| 459 |
+ logrus.Warn("cannot flush firewall rules")
|
|
| 460 | 460 |
} |
| 461 | 461 |
err = exec.Command("/usr/sbin/ifconfig", gwName, "unplumb").Run()
|
| 462 | 462 |
if err != nil && logErr {
|
| 463 |
- logrus.Warnf("cannot remove gateway interface")
|
|
| 463 |
+ logrus.Warn("cannot remove gateway interface")
|
|
| 464 | 464 |
} |
| 465 | 465 |
err = exec.Command("/usr/sbin/dladm", "delete-vnic",
|
| 466 | 466 |
"-t", gwName).Run() |
| 467 | 467 |
if err != nil && logErr {
|
| 468 |
- logrus.Warnf("cannot delete vnic")
|
|
| 468 |
+ logrus.Warn("cannot delete vnic")
|
|
| 469 | 469 |
} |
| 470 | 470 |
err = exec.Command("/usr/sbin/dladm", "delete-etherstub",
|
| 471 | 471 |
"-t", config.BridgeNameInternal).Run() |
| 472 | 472 |
if err != nil && logErr {
|
| 473 |
- logrus.Warnf("cannot delete etherstub")
|
|
| 473 |
+ logrus.Warn("cannot delete etherstub")
|
|
| 474 | 474 |
} |
| 475 | 475 |
err = exec.Command("/usr/sbin/pfctl", "-a", tableAnchor, "-t", tableName, "-T", "delete", gwIP).Run()
|
| 476 | 476 |
if err != nil && logErr {
|
| ... | ... |
@@ -36,7 +36,7 @@ func addPFRules(epid, bindIntf string, bs []types.PortBinding) {
|
| 36 | 36 |
f, err := os.OpenFile(fname, |
| 37 | 37 |
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600) |
| 38 | 38 |
if err != nil {
|
| 39 |
- logrus.Warnf("cannot open temp pf file")
|
|
| 39 |
+ logrus.Warn("cannot open temp pf file")
|
|
| 40 | 40 |
return |
| 41 | 41 |
} |
| 42 | 42 |
for _, b := range bs {
|
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"net" |
| 10 | 10 |
"sync" |
| 11 | 11 |
|
| 12 |
- log "github.com/Sirupsen/logrus" |
|
| 12 |
+ "github.com/Sirupsen/logrus" |
|
| 13 | 13 |
"github.com/docker/libnetwork/types" |
| 14 | 14 |
) |
| 15 | 15 |
|
| ... | ... |
@@ -71,7 +71,7 @@ func (e *encrMap) String() string {
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal, add bool) error {
|
| 74 |
- log.Debugf("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
|
|
| 74 |
+ logrus.Debugf("checkEncryption(%s, %v, %d, %t)", nid[0:7], rIP, vxlanID, isLocal)
|
|
| 75 | 75 |
|
| 76 | 76 |
n := d.network(nid) |
| 77 | 77 |
if n == nil || !n.secure {
|
| ... | ... |
@@ -94,7 +94,7 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 94 | 94 |
} |
| 95 | 95 |
return false |
| 96 | 96 |
}); err != nil {
|
| 97 |
- log.Warnf("Failed to retrieve list of participating nodes in overlay network %s: %v", nid[0:5], err)
|
|
| 97 |
+ logrus.Warnf("Failed to retrieve list of participating nodes in overlay network %s: %v", nid[0:5], err)
|
|
| 98 | 98 |
} |
| 99 | 99 |
default: |
| 100 | 100 |
if len(d.network(nid).endpoints) > 0 {
|
| ... | ... |
@@ -102,18 +102,18 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 102 | 102 |
} |
| 103 | 103 |
} |
| 104 | 104 |
|
| 105 |
- log.Debugf("List of nodes: %s", nodes)
|
|
| 105 |
+ logrus.Debugf("List of nodes: %s", nodes)
|
|
| 106 | 106 |
|
| 107 | 107 |
if add {
|
| 108 | 108 |
for _, rIP := range nodes {
|
| 109 | 109 |
if err := setupEncryption(lIP, aIP, rIP, vxlanID, d.secMap, d.keys); err != nil {
|
| 110 |
- log.Warnf("Failed to program network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 110 |
+ logrus.Warnf("Failed to program network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 111 | 111 |
} |
| 112 | 112 |
} |
| 113 | 113 |
} else {
|
| 114 | 114 |
if len(nodes) == 0 {
|
| 115 | 115 |
if err := removeEncryption(lIP, rIP, d.secMap); err != nil {
|
| 116 |
- log.Warnf("Failed to remove network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 116 |
+ logrus.Warnf("Failed to remove network encryption between %s and %s: %v", lIP, rIP, err)
|
|
| 117 | 117 |
} |
| 118 | 118 |
} |
| 119 | 119 |
} |
| ... | ... |
@@ -122,14 +122,14 @@ func (d *driver) checkEncryption(nid string, rIP net.IP, vxlanID uint32, isLocal |
| 122 | 122 |
} |
| 123 | 123 |
|
| 124 | 124 |
func setupEncryption(localIP, advIP, remoteIP net.IP, vni uint32, em *encrMap, keys []*key) error {
|
| 125 |
- log.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
|
|
| 125 |
+ logrus.Debugf("Programming encryption for vxlan %d between %s and %s", vni, localIP, remoteIP)
|
|
| 126 | 126 |
rIPs := remoteIP.String() |
| 127 | 127 |
|
| 128 | 128 |
indices := make([]*spi, 0, len(keys)) |
| 129 | 129 |
|
| 130 | 130 |
err := programMangle(vni, true) |
| 131 | 131 |
if err != nil {
|
| 132 |
- log.Warn(err) |
|
| 132 |
+ logrus.Warn(err) |
|
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
em.Lock() |
| ... | ... |
@@ -177,16 +177,16 @@ func (d *driver) setKeys(keys []*key) error {
|
| 177 | 177 |
return types.ForbiddenErrorf("initial keys are already present")
|
| 178 | 178 |
} |
| 179 | 179 |
d.keys = keys |
| 180 |
- log.Debugf("Initial encryption keys: %v", d.keys)
|
|
| 180 |
+ logrus.Debugf("Initial encryption keys: %v", d.keys)
|
|
| 181 | 181 |
return nil |
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 | 184 |
// updateKeys allows to add a new key and/or change the primary key and/or prune an existing key |
| 185 | 185 |
// The primary key is the key used in transmission and will go in first position in the list. |
| 186 | 186 |
func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 187 |
- log.Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
|
|
| 187 |
+ logrus.Debugf("Updating Keys. New: %v, Primary: %v, Pruned: %v", newKey, primary, pruneKey)
|
|
| 188 | 188 |
|
| 189 |
- log.Debugf("Current: %v", d.keys)
|
|
| 189 |
+ logrus.Debugf("Current: %v", d.keys)
|
|
| 190 | 190 |
|
| 191 | 191 |
var ( |
| 192 | 192 |
newIdx = -1 |
| ... | ... |
@@ -216,7 +216,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 216 | 216 |
(pruneKey != nil && delIdx == -1) {
|
| 217 | 217 |
err := types.BadRequestErrorf("cannot find proper key indices while processing key update:"+
|
| 218 | 218 |
"(newIdx,priIdx,delIdx):(%d, %d, %d)", newIdx, priIdx, delIdx) |
| 219 |
- log.Warn(err) |
|
| 219 |
+ logrus.Warn(err) |
|
| 220 | 220 |
return err |
| 221 | 221 |
} |
| 222 | 222 |
|
| ... | ... |
@@ -241,7 +241,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 241 | 241 |
} |
| 242 | 242 |
d.Unlock() |
| 243 | 243 |
|
| 244 |
- log.Debugf("Updated: %v", d.keys)
|
|
| 244 |
+ logrus.Debugf("Updated: %v", d.keys)
|
|
| 245 | 245 |
|
| 246 | 246 |
return nil |
| 247 | 247 |
} |
| ... | ... |
@@ -254,7 +254,7 @@ func (d *driver) updateKeys(newKey, primary, pruneKey *key) error {
|
| 254 | 254 |
|
| 255 | 255 |
// Spis and keys are sorted in such away the one in position 0 is the primary |
| 256 | 256 |
func updateNodeKey(lIP, rIP net.IP, idxs []*spi, curKeys []*key, newIdx, priIdx, delIdx int) []*spi {
|
| 257 |
- log.Debugf("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
|
|
| 257 |
+ logrus.Debugf("Updating keys for node: %s (%d,%d,%d)", rIP, newIdx, priIdx, delIdx)
|
|
| 258 | 258 |
return nil |
| 259 | 259 |
} |
| 260 | 260 |
|
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
"github.com/docker/libnetwork/driverapi" |
| 9 | 9 |
"github.com/docker/libnetwork/types" |
| 10 | 10 |
"github.com/gogo/protobuf/proto" |
| ... | ... |
@@ -67,7 +67,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 67 | 67 |
continue |
| 68 | 68 |
} |
| 69 | 69 |
if err := jinfo.AddStaticRoute(sub.subnetIP, types.NEXTHOP, s.gwIP.IP); err != nil {
|
| 70 |
- log.Errorf("Adding subnet %s static route in network %q failed\n", s.subnetIP, n.id)
|
|
| 70 |
+ logrus.Errorf("Adding subnet %s static route in network %q failed\n", s.subnetIP, n.id)
|
|
| 71 | 71 |
} |
| 72 | 72 |
} |
| 73 | 73 |
|
| ... | ... |
@@ -82,7 +82,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 82 | 82 |
net.ParseIP(d.advertiseAddress), true) |
| 83 | 83 |
|
| 84 | 84 |
if err := d.checkEncryption(nid, nil, n.vxlanID(s), true, true); err != nil {
|
| 85 |
- log.Warn(err) |
|
| 85 |
+ logrus.Warn(err) |
|
| 86 | 86 |
} |
| 87 | 87 |
|
| 88 | 88 |
buf, err := proto.Marshal(&PeerRecord{
|
| ... | ... |
@@ -95,7 +95,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
if err := jinfo.AddTableEntry(ovPeerTable, eid, buf); err != nil {
|
| 98 |
- log.Errorf("overlay: Failed adding table entry to joininfo: %v", err)
|
|
| 98 |
+ logrus.Errorf("overlay: Failed adding table entry to joininfo: %v", err)
|
|
| 99 | 99 |
} |
| 100 | 100 |
|
| 101 | 101 |
d.pushLocalEndpointEvent("join", nid, eid)
|
| ... | ... |
@@ -105,7 +105,7 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo, |
| 105 | 105 |
|
| 106 | 106 |
func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key string, value []byte) {
|
| 107 | 107 |
if tableName != ovPeerTable {
|
| 108 |
- log.Errorf("Unexpected table notification for table %s received", tableName)
|
|
| 108 |
+ logrus.Errorf("Unexpected table notification for table %s received", tableName)
|
|
| 109 | 109 |
return |
| 110 | 110 |
} |
| 111 | 111 |
|
| ... | ... |
@@ -113,7 +113,7 @@ func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key stri |
| 113 | 113 |
|
| 114 | 114 |
var peer PeerRecord |
| 115 | 115 |
if err := proto.Unmarshal(value, &peer); err != nil {
|
| 116 |
- log.Errorf("Failed to unmarshal peer record: %v", err)
|
|
| 116 |
+ logrus.Errorf("Failed to unmarshal peer record: %v", err)
|
|
| 117 | 117 |
return |
| 118 | 118 |
} |
| 119 | 119 |
|
| ... | ... |
@@ -125,19 +125,19 @@ func (d *driver) EventNotify(etype driverapi.EventType, nid, tableName, key stri |
| 125 | 125 |
|
| 126 | 126 |
addr, err := types.ParseCIDR(peer.EndpointIP) |
| 127 | 127 |
if err != nil {
|
| 128 |
- log.Errorf("Invalid peer IP %s received in event notify", peer.EndpointIP)
|
|
| 128 |
+ logrus.Errorf("Invalid peer IP %s received in event notify", peer.EndpointIP)
|
|
| 129 | 129 |
return |
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
mac, err := net.ParseMAC(peer.EndpointMAC) |
| 133 | 133 |
if err != nil {
|
| 134 |
- log.Errorf("Invalid mac %s received in event notify", peer.EndpointMAC)
|
|
| 134 |
+ logrus.Errorf("Invalid mac %s received in event notify", peer.EndpointMAC)
|
|
| 135 | 135 |
return |
| 136 | 136 |
} |
| 137 | 137 |
|
| 138 | 138 |
vtep := net.ParseIP(peer.TunnelEndpointIP) |
| 139 | 139 |
if vtep == nil {
|
| 140 |
- log.Errorf("Invalid VTEP %s received in event notify", peer.TunnelEndpointIP)
|
|
| 140 |
+ logrus.Errorf("Invalid VTEP %s received in event notify", peer.TunnelEndpointIP)
|
|
| 141 | 141 |
return |
| 142 | 142 |
} |
| 143 | 143 |
|
| ... | ... |
@@ -177,7 +177,7 @@ func (d *driver) Leave(nid, eid string) error {
|
| 177 | 177 |
n.leaveSandbox() |
| 178 | 178 |
|
| 179 | 179 |
if err := d.checkEncryption(nid, nil, 0, true, false); err != nil {
|
| 180 |
- log.Warn(err) |
|
| 180 |
+ logrus.Warn(err) |
|
| 181 | 181 |
} |
| 182 | 182 |
|
| 183 | 183 |
return nil |
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"fmt" |
| 6 | 6 |
"net" |
| 7 | 7 |
|
| 8 |
- log "github.com/Sirupsen/logrus" |
|
| 8 |
+ "github.com/Sirupsen/logrus" |
|
| 9 | 9 |
"github.com/docker/libnetwork/datastore" |
| 10 | 10 |
"github.com/docker/libnetwork/driverapi" |
| 11 | 11 |
"github.com/docker/libnetwork/netutils" |
| ... | ... |
@@ -113,7 +113,7 @@ func (d *driver) DeleteEndpoint(nid, eid string) error {
|
| 113 | 113 |
n.deleteEndpoint(eid) |
| 114 | 114 |
|
| 115 | 115 |
if err := d.deleteEndpointFromStore(ep); err != nil {
|
| 116 |
- log.Warnf("Failed to delete overlay endpoint %s from local store: %v", ep.id[0:7], err)
|
|
| 116 |
+ logrus.Warnf("Failed to delete overlay endpoint %s from local store: %v", ep.id[0:7], err)
|
|
| 117 | 117 |
} |
| 118 | 118 |
|
| 119 | 119 |
if ep.ifName == "" {
|
| ... | ... |
@@ -5,7 +5,7 @@ import ( |
| 5 | 5 |
"net" |
| 6 | 6 |
"sync" |
| 7 | 7 |
|
| 8 |
- log "github.com/Sirupsen/logrus" |
|
| 8 |
+ "github.com/Sirupsen/logrus" |
|
| 9 | 9 |
) |
| 10 | 10 |
|
| 11 | 11 |
const ovPeerTable = "overlay_peer_table" |
| ... | ... |
@@ -89,7 +89,7 @@ func (d *driver) peerDbNetworkWalk(nid string, f func(*peerKey, *peerEntry) bool |
| 89 | 89 |
for pKeyStr, pEntry := range pMap.mp {
|
| 90 | 90 |
var pKey peerKey |
| 91 | 91 |
if _, err := fmt.Sscan(pKeyStr, &pKey); err != nil {
|
| 92 |
- log.Warnf("Peer key scan on network %s failed: %v", nid, err)
|
|
| 92 |
+ logrus.Warnf("Peer key scan on network %s failed: %v", nid, err)
|
|
| 93 | 93 |
} |
| 94 | 94 |
|
| 95 | 95 |
if f(&pKey, &pEntry) {
|
| ... | ... |
@@ -275,7 +275,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 275 | 275 |
} |
| 276 | 276 |
|
| 277 | 277 |
if err := d.checkEncryption(nid, vtep, n.vxlanID(s), false, true); err != nil {
|
| 278 |
- log.Warn(err) |
|
| 278 |
+ logrus.Warn(err) |
|
| 279 | 279 |
} |
| 280 | 280 |
|
| 281 | 281 |
// Add neighbor entry for the peer IP |
| ... | ... |
@@ -320,7 +320,7 @@ func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMas |
| 320 | 320 |
} |
| 321 | 321 |
|
| 322 | 322 |
if err := d.checkEncryption(nid, vtep, 0, false, false); err != nil {
|
| 323 |
- log.Warn(err) |
|
| 323 |
+ logrus.Warn(err) |
|
| 324 | 324 |
} |
| 325 | 325 |
|
| 326 | 326 |
return nil |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
|
| 7 | 7 |
"encoding/json" |
| 8 | 8 |
|
| 9 |
- log "github.com/Sirupsen/logrus" |
|
| 9 |
+ "github.com/Sirupsen/logrus" |
|
| 10 | 10 |
|
| 11 | 11 |
"github.com/Microsoft/hcsshim" |
| 12 | 12 |
"github.com/docker/libnetwork/types" |
| ... | ... |
@@ -44,7 +44,7 @@ func (d *driver) pushLocalDb() {
|
| 44 | 44 |
func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 45 | 45 |
peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
|
| 46 | 46 |
|
| 47 |
- log.Debugf("WINOVERLAY: Enter peerAdd for ca ip %s with ca mac %s", peerIP.String(), peerMac.String())
|
|
| 47 |
+ logrus.Debugf("WINOVERLAY: Enter peerAdd for ca ip %s with ca mac %s", peerIP.String(), peerMac.String())
|
|
| 48 | 48 |
|
| 49 | 49 |
if err := validateID(nid, eid); err != nil {
|
| 50 | 50 |
return err |
| ... | ... |
@@ -56,7 +56,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 | 58 |
if updateDb {
|
| 59 |
- log.Info("WINOVERLAY: peerAdd: notifying HNS of the REMOTE endpoint")
|
|
| 59 |
+ logrus.Info("WINOVERLAY: peerAdd: notifying HNS of the REMOTE endpoint")
|
|
| 60 | 60 |
|
| 61 | 61 |
hnsEndpoint := &hcsshim.HNSEndpoint{
|
| 62 | 62 |
VirtualNetwork: n.hnsId, |
| ... | ... |
@@ -121,7 +121,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 121 | 121 |
func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, |
| 122 | 122 |
peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
|
| 123 | 123 |
|
| 124 |
- log.Infof("WINOVERLAY: Enter peerDelete for endpoint %s and peer ip %s", eid, peerIP.String())
|
|
| 124 |
+ logrus.Infof("WINOVERLAY: Enter peerDelete for endpoint %s and peer ip %s", eid, peerIP.String())
|
|
| 125 | 125 |
|
| 126 | 126 |
if err := validateID(nid, eid); err != nil {
|
| 127 | 127 |
return err |
| ... | ... |
@@ -146,7 +146,7 @@ func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMas |
| 146 | 146 |
n.deleteEndpoint(eid) |
| 147 | 147 |
|
| 148 | 148 |
if err := d.deleteEndpointFromStore(ep); err != nil {
|
| 149 |
- log.Debugf("Failed to delete stale overlay endpoint (%s) from store", ep.id[0:7])
|
|
| 149 |
+ logrus.Debugf("Failed to delete stale overlay endpoint (%s) from store", ep.id[0:7])
|
|
| 150 | 150 |
} |
| 151 | 151 |
} |
| 152 | 152 |
|
| ... | ... |
@@ -20,7 +20,7 @@ import ( |
| 20 | 20 |
"sync" |
| 21 | 21 |
|
| 22 | 22 |
"github.com/Microsoft/hcsshim" |
| 23 |
- log "github.com/Sirupsen/logrus" |
|
| 23 |
+ "github.com/Sirupsen/logrus" |
|
| 24 | 24 |
"github.com/docker/libnetwork/datastore" |
| 25 | 25 |
"github.com/docker/libnetwork/discoverapi" |
| 26 | 26 |
"github.com/docker/libnetwork/driverapi" |
| ... | ... |
@@ -271,7 +271,7 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
|
| 271 | 271 |
} |
| 272 | 272 |
|
| 273 | 273 |
configuration := string(configurationb) |
| 274 |
- log.Debugf("HNSNetwork Request =%v Address Space=%v", configuration, subnets)
|
|
| 274 |
+ logrus.Debugf("HNSNetwork Request =%v Address Space=%v", configuration, subnets)
|
|
| 275 | 275 |
|
| 276 | 276 |
hnsresponse, err := hcsshim.HNSNetworkRequest("POST", "", configuration)
|
| 277 | 277 |
if err != nil {
|
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"strings" |
| 9 | 9 |
"sync" |
| 10 | 10 |
|
| 11 |
- log "github.com/Sirupsen/logrus" |
|
| 11 |
+ "github.com/Sirupsen/logrus" |
|
| 12 | 12 |
"github.com/docker/libnetwork/datastore" |
| 13 | 13 |
"github.com/docker/libnetwork/ipamapi" |
| 14 | 14 |
"github.com/docker/libnetwork/netlabel" |
| ... | ... |
@@ -142,12 +142,12 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
|
| 142 | 142 |
|
| 143 | 143 |
bytes, err := json.Marshal(tmp) |
| 144 | 144 |
if err != nil {
|
| 145 |
- log.Error(err) |
|
| 145 |
+ logrus.Error(err) |
|
| 146 | 146 |
break |
| 147 | 147 |
} |
| 148 | 148 |
err = json.Unmarshal(bytes, &pb) |
| 149 | 149 |
if err != nil {
|
| 150 |
- log.Error(err) |
|
| 150 |
+ logrus.Error(err) |
|
| 151 | 151 |
break |
| 152 | 152 |
} |
| 153 | 153 |
pblist = append(pblist, pb) |
| ... | ... |
@@ -164,12 +164,12 @@ func (ep *endpoint) UnmarshalJSON(b []byte) (err error) {
|
| 164 | 164 |
|
| 165 | 165 |
bytes, err := json.Marshal(tmp) |
| 166 | 166 |
if err != nil {
|
| 167 |
- log.Error(err) |
|
| 167 |
+ logrus.Error(err) |
|
| 168 | 168 |
break |
| 169 | 169 |
} |
| 170 | 170 |
err = json.Unmarshal(bytes, &tp) |
| 171 | 171 |
if err != nil {
|
| 172 |
- log.Error(err) |
|
| 172 |
+ logrus.Error(err) |
|
| 173 | 173 |
break |
| 174 | 174 |
} |
| 175 | 175 |
tplist = append(tplist, tp) |
| ... | ... |
@@ -472,7 +472,7 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
| 472 | 472 |
defer func() {
|
| 473 | 473 |
if err != nil {
|
| 474 | 474 |
if err := d.Leave(nid, epid); err != nil {
|
| 475 |
- log.Warnf("driver leave failed while rolling back join: %v", err)
|
|
| 475 |
+ logrus.Warnf("driver leave failed while rolling back join: %v", err)
|
|
| 476 | 476 |
} |
| 477 | 477 |
} |
| 478 | 478 |
}() |
| ... | ... |
@@ -523,7 +523,7 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
| 523 | 523 |
|
| 524 | 524 |
if moveExtConn {
|
| 525 | 525 |
if extEp != nil {
|
| 526 |
- log.Debugf("Revoking external connectivity on endpoint %s (%s)", extEp.Name(), extEp.ID())
|
|
| 526 |
+ logrus.Debugf("Revoking external connectivity on endpoint %s (%s)", extEp.Name(), extEp.ID())
|
|
| 527 | 527 |
extN, err := extEp.getNetworkFromStore() |
| 528 | 528 |
if err != nil {
|
| 529 | 529 |
return fmt.Errorf("failed to get network from store during join: %v", err)
|
| ... | ... |
@@ -540,14 +540,14 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
| 540 | 540 |
defer func() {
|
| 541 | 541 |
if err != nil {
|
| 542 | 542 |
if e := extD.ProgramExternalConnectivity(extEp.network.ID(), extEp.ID(), sb.Labels()); e != nil {
|
| 543 |
- log.Warnf("Failed to roll-back external connectivity on endpoint %s (%s): %v",
|
|
| 543 |
+ logrus.Warnf("Failed to roll-back external connectivity on endpoint %s (%s): %v",
|
|
| 544 | 544 |
extEp.Name(), extEp.ID(), e) |
| 545 | 545 |
} |
| 546 | 546 |
} |
| 547 | 547 |
}() |
| 548 | 548 |
} |
| 549 | 549 |
if !n.internal {
|
| 550 |
- log.Debugf("Programming external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
|
| 550 |
+ logrus.Debugf("Programming external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
|
| 551 | 551 |
if err = d.ProgramExternalConnectivity(n.ID(), ep.ID(), sb.Labels()); err != nil {
|
| 552 | 552 |
return types.InternalErrorf( |
| 553 | 553 |
"driver failed programming external connectivity on endpoint %s (%s): %v", |
| ... | ... |
@@ -559,7 +559,7 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
| 559 | 559 |
|
| 560 | 560 |
if !sb.needDefaultGW() {
|
| 561 | 561 |
if err := sb.clearDefaultGW(); err != nil {
|
| 562 |
- log.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
|
| 562 |
+ logrus.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
|
| 563 | 563 |
sb.ID(), sb.ContainerID(), err) |
| 564 | 564 |
} |
| 565 | 565 |
} |
| ... | ... |
@@ -682,22 +682,22 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption) |
| 682 | 682 |
|
| 683 | 683 |
if d != nil {
|
| 684 | 684 |
if moveExtConn {
|
| 685 |
- log.Debugf("Revoking external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
|
| 685 |
+ logrus.Debugf("Revoking external connectivity on endpoint %s (%s)", ep.Name(), ep.ID())
|
|
| 686 | 686 |
if err := d.RevokeExternalConnectivity(n.id, ep.id); err != nil {
|
| 687 |
- log.Warnf("driver failed revoking external connectivity on endpoint %s (%s): %v",
|
|
| 687 |
+ logrus.Warnf("driver failed revoking external connectivity on endpoint %s (%s): %v",
|
|
| 688 | 688 |
ep.Name(), ep.ID(), err) |
| 689 | 689 |
} |
| 690 | 690 |
} |
| 691 | 691 |
|
| 692 | 692 |
if err := d.Leave(n.id, ep.id); err != nil {
|
| 693 | 693 |
if _, ok := err.(types.MaskableError); !ok {
|
| 694 |
- log.Warnf("driver error disconnecting container %s : %v", ep.name, err)
|
|
| 694 |
+ logrus.Warnf("driver error disconnecting container %s : %v", ep.name, err)
|
|
| 695 | 695 |
} |
| 696 | 696 |
} |
| 697 | 697 |
} |
| 698 | 698 |
|
| 699 | 699 |
if err := sb.clearNetworkResources(ep); err != nil {
|
| 700 |
- log.Warnf("Could not cleanup network resources on container %s disconnect: %v", ep.name, err)
|
|
| 700 |
+ logrus.Warnf("Could not cleanup network resources on container %s disconnect: %v", ep.name, err)
|
|
| 701 | 701 |
} |
| 702 | 702 |
|
| 703 | 703 |
// Update the store about the sandbox detach only after we |
| ... | ... |
@@ -710,7 +710,7 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption) |
| 710 | 710 |
} |
| 711 | 711 |
|
| 712 | 712 |
if e := ep.deleteFromCluster(); e != nil {
|
| 713 |
- log.Errorf("Could not delete state for endpoint %s from cluster: %v", ep.Name(), e)
|
|
| 713 |
+ logrus.Errorf("Could not delete state for endpoint %s from cluster: %v", ep.Name(), e)
|
|
| 714 | 714 |
} |
| 715 | 715 |
|
| 716 | 716 |
sb.deleteHostsEntries(n.getSvcRecords(ep)) |
| ... | ... |
@@ -721,7 +721,7 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption) |
| 721 | 721 |
// New endpoint providing external connectivity for the sandbox |
| 722 | 722 |
extEp = sb.getGatewayEndpoint() |
| 723 | 723 |
if moveExtConn && extEp != nil {
|
| 724 |
- log.Debugf("Programming external connectivity on endpoint %s (%s)", extEp.Name(), extEp.ID())
|
|
| 724 |
+ logrus.Debugf("Programming external connectivity on endpoint %s (%s)", extEp.Name(), extEp.ID())
|
|
| 725 | 725 |
extN, err := extEp.getNetworkFromStore() |
| 726 | 726 |
if err != nil {
|
| 727 | 727 |
return fmt.Errorf("failed to get network from store during leave: %v", err)
|
| ... | ... |
@@ -731,14 +731,14 @@ func (ep *endpoint) sbLeave(sb *sandbox, force bool, options ...EndpointOption) |
| 731 | 731 |
return fmt.Errorf("failed to leave endpoint: %v", err)
|
| 732 | 732 |
} |
| 733 | 733 |
if err := extD.ProgramExternalConnectivity(extEp.network.ID(), extEp.ID(), sb.Labels()); err != nil {
|
| 734 |
- log.Warnf("driver failed programming external connectivity on endpoint %s: (%s) %v",
|
|
| 734 |
+ logrus.Warnf("driver failed programming external connectivity on endpoint %s: (%s) %v",
|
|
| 735 | 735 |
extEp.Name(), extEp.ID(), err) |
| 736 | 736 |
} |
| 737 | 737 |
} |
| 738 | 738 |
|
| 739 | 739 |
if !sb.needDefaultGW() {
|
| 740 | 740 |
if err := sb.clearDefaultGW(); err != nil {
|
| 741 |
- log.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
|
| 741 |
+ logrus.Warnf("Failure while disconnecting sandbox %s (%s) from gateway network: %v",
|
|
| 742 | 742 |
sb.ID(), sb.ContainerID(), err) |
| 743 | 743 |
} |
| 744 | 744 |
} |
| ... | ... |
@@ -771,7 +771,7 @@ func (ep *endpoint) Delete(force bool) error {
|
| 771 | 771 |
|
| 772 | 772 |
if sb != nil {
|
| 773 | 773 |
if e := ep.sbLeave(sb.(*sandbox), force); e != nil {
|
| 774 |
- log.Warnf("failed to leave sandbox for endpoint %s : %v", name, e)
|
|
| 774 |
+ logrus.Warnf("failed to leave sandbox for endpoint %s : %v", name, e)
|
|
| 775 | 775 |
} |
| 776 | 776 |
} |
| 777 | 777 |
|
| ... | ... |
@@ -783,7 +783,7 @@ func (ep *endpoint) Delete(force bool) error {
|
| 783 | 783 |
if err != nil && !force {
|
| 784 | 784 |
ep.dbExists = false |
| 785 | 785 |
if e := n.getController().updateToStore(ep); e != nil {
|
| 786 |
- log.Warnf("failed to recreate endpoint in store %s : %v", name, e)
|
|
| 786 |
+ logrus.Warnf("failed to recreate endpoint in store %s : %v", name, e)
|
|
| 787 | 787 |
} |
| 788 | 788 |
} |
| 789 | 789 |
}() |
| ... | ... |
@@ -798,7 +798,7 @@ func (ep *endpoint) Delete(force bool) error {
|
| 798 | 798 |
ep.releaseAddress() |
| 799 | 799 |
|
| 800 | 800 |
if err := n.getEpCnt().DecEndpointCnt(); err != nil {
|
| 801 |
- log.Warnf("failed to decrement endpoint count for ep %s: %v", ep.ID(), err)
|
|
| 801 |
+ logrus.Warnf("failed to decrement endpoint count for ep %s: %v", ep.ID(), err)
|
|
| 802 | 802 |
} |
| 803 | 803 |
|
| 804 | 804 |
return nil |
| ... | ... |
@@ -826,7 +826,7 @@ func (ep *endpoint) deleteEndpoint(force bool) error {
|
| 826 | 826 |
} |
| 827 | 827 |
|
| 828 | 828 |
if _, ok := err.(types.MaskableError); !ok {
|
| 829 |
- log.Warnf("driver error deleting endpoint %s : %v", name, err)
|
|
| 829 |
+ logrus.Warnf("driver error deleting endpoint %s : %v", name, err)
|
|
| 830 | 830 |
} |
| 831 | 831 |
} |
| 832 | 832 |
|
| ... | ... |
@@ -976,7 +976,7 @@ func JoinOptionPriority(ep Endpoint, prio int) EndpointOption {
|
| 976 | 976 |
sb, ok := c.sandboxes[ep.sandboxID] |
| 977 | 977 |
c.Unlock() |
| 978 | 978 |
if !ok {
|
| 979 |
- log.Errorf("Could not set endpoint priority value during Join to endpoint %s: No sandbox id present in endpoint", ep.id)
|
|
| 979 |
+ logrus.Errorf("Could not set endpoint priority value during Join to endpoint %s: No sandbox id present in endpoint", ep.id)
|
|
| 980 | 980 |
return |
| 981 | 981 |
} |
| 982 | 982 |
sb.epPriority[ep.id] = prio |
| ... | ... |
@@ -995,7 +995,7 @@ func (ep *endpoint) assignAddress(ipam ipamapi.Ipam, assignIPv4, assignIPv6 bool |
| 995 | 995 |
return nil |
| 996 | 996 |
} |
| 997 | 997 |
|
| 998 |
- log.Debugf("Assigning addresses for endpoint %s's interface on network %s", ep.Name(), n.Name())
|
|
| 998 |
+ logrus.Debugf("Assigning addresses for endpoint %s's interface on network %s", ep.Name(), n.Name())
|
|
| 999 | 999 |
|
| 1000 | 1000 |
if assignIPv4 {
|
| 1001 | 1001 |
if err = ep.assignAddressVersion(4, ipam); err != nil {
|
| ... | ... |
@@ -1075,23 +1075,23 @@ func (ep *endpoint) releaseAddress() {
|
| 1075 | 1075 |
return |
| 1076 | 1076 |
} |
| 1077 | 1077 |
|
| 1078 |
- log.Debugf("Releasing addresses for endpoint %s's interface on network %s", ep.Name(), n.Name())
|
|
| 1078 |
+ logrus.Debugf("Releasing addresses for endpoint %s's interface on network %s", ep.Name(), n.Name())
|
|
| 1079 | 1079 |
|
| 1080 | 1080 |
ipam, _, err := n.getController().getIPAMDriver(n.ipamType) |
| 1081 | 1081 |
if err != nil {
|
| 1082 |
- log.Warnf("Failed to retrieve ipam driver to release interface address on delete of endpoint %s (%s): %v", ep.Name(), ep.ID(), err)
|
|
| 1082 |
+ logrus.Warnf("Failed to retrieve ipam driver to release interface address on delete of endpoint %s (%s): %v", ep.Name(), ep.ID(), err)
|
|
| 1083 | 1083 |
return |
| 1084 | 1084 |
} |
| 1085 | 1085 |
|
| 1086 | 1086 |
if ep.iface.addr != nil {
|
| 1087 | 1087 |
if err := ipam.ReleaseAddress(ep.iface.v4PoolID, ep.iface.addr.IP); err != nil {
|
| 1088 |
- log.Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addr.IP, ep.Name(), ep.ID(), err)
|
|
| 1088 |
+ logrus.Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addr.IP, ep.Name(), ep.ID(), err)
|
|
| 1089 | 1089 |
} |
| 1090 | 1090 |
} |
| 1091 | 1091 |
|
| 1092 | 1092 |
if ep.iface.addrv6 != nil && ep.iface.addrv6.IP.IsGlobalUnicast() {
|
| 1093 | 1093 |
if err := ipam.ReleaseAddress(ep.iface.v6PoolID, ep.iface.addrv6.IP); err != nil {
|
| 1094 |
- log.Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addrv6.IP, ep.Name(), ep.ID(), err)
|
|
| 1094 |
+ logrus.Warnf("Failed to release ip address %s on delete of endpoint %s (%s): %v", ep.iface.addrv6.IP, ep.Name(), ep.ID(), err)
|
|
| 1095 | 1095 |
} |
| 1096 | 1096 |
} |
| 1097 | 1097 |
} |
| ... | ... |
@@ -1106,14 +1106,14 @@ func (c *controller) cleanupLocalEndpoints() {
|
| 1106 | 1106 |
} |
| 1107 | 1107 |
nl, err := c.getNetworksForScope(datastore.LocalScope) |
| 1108 | 1108 |
if err != nil {
|
| 1109 |
- log.Warnf("Could not get list of networks during endpoint cleanup: %v", err)
|
|
| 1109 |
+ logrus.Warnf("Could not get list of networks during endpoint cleanup: %v", err)
|
|
| 1110 | 1110 |
return |
| 1111 | 1111 |
} |
| 1112 | 1112 |
|
| 1113 | 1113 |
for _, n := range nl {
|
| 1114 | 1114 |
epl, err := n.getEndpointsFromStore() |
| 1115 | 1115 |
if err != nil {
|
| 1116 |
- log.Warnf("Could not get list of endpoints in network %s during endpoint cleanup: %v", n.name, err)
|
|
| 1116 |
+ logrus.Warnf("Could not get list of endpoints in network %s during endpoint cleanup: %v", n.name, err)
|
|
| 1117 | 1117 |
continue |
| 1118 | 1118 |
} |
| 1119 | 1119 |
|
| ... | ... |
@@ -1121,21 +1121,21 @@ func (c *controller) cleanupLocalEndpoints() {
|
| 1121 | 1121 |
if _, ok := eps[ep.id]; ok {
|
| 1122 | 1122 |
continue |
| 1123 | 1123 |
} |
| 1124 |
- log.Infof("Removing stale endpoint %s (%s)", ep.name, ep.id)
|
|
| 1124 |
+ logrus.Infof("Removing stale endpoint %s (%s)", ep.name, ep.id)
|
|
| 1125 | 1125 |
if err := ep.Delete(true); err != nil {
|
| 1126 |
- log.Warnf("Could not delete local endpoint %s during endpoint cleanup: %v", ep.name, err)
|
|
| 1126 |
+ logrus.Warnf("Could not delete local endpoint %s during endpoint cleanup: %v", ep.name, err)
|
|
| 1127 | 1127 |
} |
| 1128 | 1128 |
} |
| 1129 | 1129 |
|
| 1130 | 1130 |
epl, err = n.getEndpointsFromStore() |
| 1131 | 1131 |
if err != nil {
|
| 1132 |
- log.Warnf("Could not get list of endpoints in network %s for count update: %v", n.name, err)
|
|
| 1132 |
+ logrus.Warnf("Could not get list of endpoints in network %s for count update: %v", n.name, err)
|
|
| 1133 | 1133 |
continue |
| 1134 | 1134 |
} |
| 1135 | 1135 |
|
| 1136 | 1136 |
epCnt := n.getEpCnt().EndpointCnt() |
| 1137 | 1137 |
if epCnt != uint64(len(epl)) {
|
| 1138 |
- log.Infof("Fixing inconsistent endpoint_cnt for network %s. Expected=%d, Actual=%d", n.name, len(epl), epCnt)
|
|
| 1138 |
+ logrus.Infof("Fixing inconsistent endpoint_cnt for network %s. Expected=%d, Actual=%d", n.name, len(epl), epCnt)
|
|
| 1139 | 1139 |
n.getEpCnt().setCnt(uint64(len(epl))) |
| 1140 | 1140 |
} |
| 1141 | 1141 |
} |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"net" |
| 5 | 5 |
"sync" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
|
| 9 | 9 |
mapset "github.com/deckarep/golang-set" |
| 10 | 10 |
"github.com/docker/docker/pkg/discovery" |
| ... | ... |
@@ -54,7 +54,7 @@ func (h *hostDiscovery) monitorDiscovery(ch <-chan discovery.Entries, errCh <-ch |
| 54 | 54 |
h.processCallback(entries, activeCallback, joinCallback, leaveCallback) |
| 55 | 55 |
case err := <-errCh: |
| 56 | 56 |
if err != nil {
|
| 57 |
- log.Errorf("discovery error: %v", err)
|
|
| 57 |
+ logrus.Errorf("discovery error: %v", err)
|
|
| 58 | 58 |
} |
| 59 | 59 |
case <-h.stopChan: |
| 60 | 60 |
return |
| ... | ... |
@@ -6,7 +6,7 @@ import ( |
| 6 | 6 |
"sort" |
| 7 | 7 |
"sync" |
| 8 | 8 |
|
| 9 |
- log "github.com/Sirupsen/logrus" |
|
| 9 |
+ "github.com/Sirupsen/logrus" |
|
| 10 | 10 |
"github.com/docker/libnetwork/bitseq" |
| 11 | 11 |
"github.com/docker/libnetwork/datastore" |
| 12 | 12 |
"github.com/docker/libnetwork/discoverapi" |
| ... | ... |
@@ -135,7 +135,7 @@ func (a *Allocator) checkConsistency(as string) {
|
| 135 | 135 |
bm := a.addresses[sk] |
| 136 | 136 |
a.Unlock() |
| 137 | 137 |
if err := bm.CheckConsistency(); err != nil {
|
| 138 |
- log.Warnf("Error while running consistency check for %s: %v", sk, err)
|
|
| 138 |
+ logrus.Warnf("Error while running consistency check for %s: %v", sk, err)
|
|
| 139 | 139 |
} |
| 140 | 140 |
} |
| 141 | 141 |
} |
| ... | ... |
@@ -198,7 +198,7 @@ func (a *Allocator) GetDefaultAddressSpaces() (string, string, error) {
|
| 198 | 198 |
|
| 199 | 199 |
// RequestPool returns an address pool along with its unique id. |
| 200 | 200 |
func (a *Allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
|
| 201 |
- log.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
|
|
| 201 |
+ logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
|
|
| 202 | 202 |
|
| 203 | 203 |
k, nw, ipr, err := a.parsePoolRequest(addressSpace, pool, subPool, v6) |
| 204 | 204 |
if err != nil {
|
| ... | ... |
@@ -227,7 +227,7 @@ retry: |
| 227 | 227 |
insert, err := aSpace.updatePoolDBOnAdd(*k, nw, ipr, pdf) |
| 228 | 228 |
if err != nil {
|
| 229 | 229 |
if _, ok := err.(types.MaskableError); ok {
|
| 230 |
- log.Debugf("Retrying predefined pool search: %v", err)
|
|
| 230 |
+ logrus.Debugf("Retrying predefined pool search: %v", err)
|
|
| 231 | 231 |
goto retry |
| 232 | 232 |
} |
| 233 | 233 |
return "", nil, nil, err |
| ... | ... |
@@ -246,7 +246,7 @@ retry: |
| 246 | 246 |
|
| 247 | 247 |
// ReleasePool releases the address pool identified by the passed id |
| 248 | 248 |
func (a *Allocator) ReleasePool(poolID string) error {
|
| 249 |
- log.Debugf("ReleasePool(%s)", poolID)
|
|
| 249 |
+ logrus.Debugf("ReleasePool(%s)", poolID)
|
|
| 250 | 250 |
k := SubnetKey{}
|
| 251 | 251 |
if err := k.FromString(poolID); err != nil {
|
| 252 | 252 |
return types.BadRequestErrorf("invalid pool id: %s", poolID)
|
| ... | ... |
@@ -322,7 +322,7 @@ func (a *Allocator) parsePoolRequest(addressSpace, pool, subPool string, v6 bool |
| 322 | 322 |
} |
| 323 | 323 |
|
| 324 | 324 |
func (a *Allocator) insertBitMask(key SubnetKey, pool *net.IPNet) error {
|
| 325 |
- //log.Debugf("Inserting bitmask (%s, %s)", key.String(), pool.String())
|
|
| 325 |
+ //logrus.Debugf("Inserting bitmask (%s, %s)", key.String(), pool.String())
|
|
| 326 | 326 |
|
| 327 | 327 |
store := a.getStore(key.AddressSpace) |
| 328 | 328 |
ipVer := getAddressVersion(pool.IP) |
| ... | ... |
@@ -360,7 +360,7 @@ func (a *Allocator) retrieveBitmask(k SubnetKey, n *net.IPNet) (*bitseq.Handle, |
| 360 | 360 |
bm, ok := a.addresses[k] |
| 361 | 361 |
a.Unlock() |
| 362 | 362 |
if !ok {
|
| 363 |
- log.Debugf("Retrieving bitmask (%s, %s)", k.String(), n.String())
|
|
| 363 |
+ logrus.Debugf("Retrieving bitmask (%s, %s)", k.String(), n.String())
|
|
| 364 | 364 |
if err := a.insertBitMask(k, n); err != nil {
|
| 365 | 365 |
return nil, types.InternalErrorf("could not find bitmask in datastore for %s", k.String())
|
| 366 | 366 |
} |
| ... | ... |
@@ -418,7 +418,7 @@ func (a *Allocator) getPredefinedPool(as string, ipV6 bool) (*net.IPNet, error) |
| 418 | 418 |
|
| 419 | 419 |
// RequestAddress returns an address from the specified pool ID |
| 420 | 420 |
func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
|
| 421 |
- log.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
|
|
| 421 |
+ logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
|
|
| 422 | 422 |
k := SubnetKey{}
|
| 423 | 423 |
if err := k.FromString(poolID); err != nil {
|
| 424 | 424 |
return nil, nil, types.BadRequestErrorf("invalid pool id: %s", poolID)
|
| ... | ... |
@@ -467,7 +467,7 @@ func (a *Allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[s |
| 467 | 467 |
|
| 468 | 468 |
// ReleaseAddress releases the address from the specified pool ID |
| 469 | 469 |
func (a *Allocator) ReleaseAddress(poolID string, address net.IP) error {
|
| 470 |
- log.Debugf("ReleaseAddress(%s, %v)", poolID, address)
|
|
| 470 |
+ logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
|
|
| 471 | 471 |
k := SubnetKey{}
|
| 472 | 472 |
if err := k.FromString(poolID); err != nil {
|
| 473 | 473 |
return types.BadRequestErrorf("invalid pool id: %s", poolID)
|
| ... | ... |
@@ -3,7 +3,7 @@ package ipam |
| 3 | 3 |
import ( |
| 4 | 4 |
"encoding/json" |
| 5 | 5 |
|
| 6 |
- log "github.com/Sirupsen/logrus" |
|
| 6 |
+ "github.com/Sirupsen/logrus" |
|
| 7 | 7 |
"github.com/docker/libnetwork/datastore" |
| 8 | 8 |
"github.com/docker/libnetwork/types" |
| 9 | 9 |
) |
| ... | ... |
@@ -26,7 +26,7 @@ func (aSpace *addrSpace) KeyPrefix() []string {
|
| 26 | 26 |
func (aSpace *addrSpace) Value() []byte {
|
| 27 | 27 |
b, err := json.Marshal(aSpace) |
| 28 | 28 |
if err != nil {
|
| 29 |
- log.Warnf("Failed to marshal ipam configured pools: %v", err)
|
|
| 29 |
+ logrus.Warnf("Failed to marshal ipam configured pools: %v", err)
|
|
| 30 | 30 |
return nil |
| 31 | 31 |
} |
| 32 | 32 |
return b |
| ... | ... |
@@ -4,7 +4,7 @@ import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
"net" |
| 6 | 6 |
|
| 7 |
- log "github.com/Sirupsen/logrus" |
|
| 7 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 8 |
"github.com/docker/docker/pkg/plugins" |
| 9 | 9 |
"github.com/docker/libnetwork/discoverapi" |
| 10 | 10 |
"github.com/docker/libnetwork/ipamapi" |
| ... | ... |
@@ -40,13 +40,13 @@ func Init(cb ipamapi.Callback, l, g interface{}) error {
|
| 40 | 40 |
a := newAllocator(name, client) |
| 41 | 41 |
if cps, err := a.(*allocator).getCapabilities(); err == nil {
|
| 42 | 42 |
if err := cb.RegisterIpamDriverWithCapabilities(name, a, cps); err != nil {
|
| 43 |
- log.Errorf("error registering remote ipam driver %s due to %v", name, err)
|
|
| 43 |
+ logrus.Errorf("error registering remote ipam driver %s due to %v", name, err)
|
|
| 44 | 44 |
} |
| 45 | 45 |
} else {
|
| 46 |
- log.Infof("remote ipam driver %s does not support capabilities", name)
|
|
| 47 |
- log.Debug(err) |
|
| 46 |
+ logrus.Infof("remote ipam driver %s does not support capabilities", name)
|
|
| 47 |
+ logrus.Debug(err) |
|
| 48 | 48 |
if err := cb.RegisterIpamDriver(name, a); err != nil {
|
| 49 |
- log.Errorf("error registering remote ipam driver %s due to %v", name, err)
|
|
| 49 |
+ logrus.Errorf("error registering remote ipam driver %s due to %v", name, err)
|
|
| 50 | 50 |
} |
| 51 | 51 |
} |
| 52 | 52 |
}) |
| ... | ... |
@@ -3,7 +3,7 @@ package windowsipam |
| 3 | 3 |
import ( |
| 4 | 4 |
"net" |
| 5 | 5 |
|
| 6 |
- log "github.com/Sirupsen/logrus" |
|
| 6 |
+ "github.com/Sirupsen/logrus" |
|
| 7 | 7 |
"github.com/docker/libnetwork/discoverapi" |
| 8 | 8 |
"github.com/docker/libnetwork/ipamapi" |
| 9 | 9 |
"github.com/docker/libnetwork/netlabel" |
| ... | ... |
@@ -39,7 +39,7 @@ func (a *allocator) GetDefaultAddressSpaces() (string, string, error) {
|
| 39 | 39 |
// RequestPool returns an address pool along with its unique id. This is a null ipam driver. It allocates the |
| 40 | 40 |
// subnet user asked and does not validate anything. Doesn't support subpool allocation |
| 41 | 41 |
func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[string]string, v6 bool) (string, *net.IPNet, map[string]string, error) {
|
| 42 |
- log.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
|
|
| 42 |
+ logrus.Debugf("RequestPool(%s, %s, %s, %v, %t)", addressSpace, pool, subPool, options, v6)
|
|
| 43 | 43 |
if subPool != "" || v6 {
|
| 44 | 44 |
return "", nil, nil, types.InternalErrorf("This request is not supported by null ipam driver")
|
| 45 | 45 |
} |
| ... | ... |
@@ -61,14 +61,14 @@ func (a *allocator) RequestPool(addressSpace, pool, subPool string, options map[ |
| 61 | 61 |
|
| 62 | 62 |
// ReleasePool releases the address pool - always succeeds |
| 63 | 63 |
func (a *allocator) ReleasePool(poolID string) error {
|
| 64 |
- log.Debugf("ReleasePool(%s)", poolID)
|
|
| 64 |
+ logrus.Debugf("ReleasePool(%s)", poolID)
|
|
| 65 | 65 |
return nil |
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
// RequestAddress returns an address from the specified pool ID. |
| 69 | 69 |
// Always allocate the 0.0.0.0/32 ip if no preferred address was specified |
| 70 | 70 |
func (a *allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[string]string) (*net.IPNet, map[string]string, error) {
|
| 71 |
- log.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
|
|
| 71 |
+ logrus.Debugf("RequestAddress(%s, %v, %v)", poolID, prefAddress, opts)
|
|
| 72 | 72 |
_, ipNet, err := net.ParseCIDR(poolID) |
| 73 | 73 |
|
| 74 | 74 |
if err != nil {
|
| ... | ... |
@@ -88,7 +88,7 @@ func (a *allocator) RequestAddress(poolID string, prefAddress net.IP, opts map[s |
| 88 | 88 |
|
| 89 | 89 |
// ReleaseAddress releases the address - always succeeds |
| 90 | 90 |
func (a *allocator) ReleaseAddress(poolID string, address net.IP) error {
|
| 91 |
- log.Debugf("ReleaseAddress(%s, %v)", poolID, address)
|
|
| 91 |
+ logrus.Debugf("ReleaseAddress(%s, %v)", poolID, address)
|
|
| 92 | 92 |
return nil |
| 93 | 93 |
} |
| 94 | 94 |
|
| ... | ... |
@@ -64,7 +64,7 @@ func setup() {
|
| 64 | 64 |
|
| 65 | 65 |
ipvsFamily, err = getIPVSFamily() |
| 66 | 66 |
if err != nil {
|
| 67 |
- logrus.Errorf("Could not get ipvs family information from the kernel. It is possible that ipvs is not enabled in your kernel. Native loadbalancing will not work until this is fixed.")
|
|
| 67 |
+ logrus.Error("Could not get ipvs family information from the kernel. It is possible that ipvs is not enabled in your kernel. Native loadbalancing will not work until this is fixed.")
|
|
| 68 | 68 |
} |
| 69 | 69 |
}) |
| 70 | 70 |
} |
| ... | ... |
@@ -14,7 +14,7 @@ import ( |
| 14 | 14 |
"strings" |
| 15 | 15 |
"testing" |
| 16 | 16 |
|
| 17 |
- log "github.com/Sirupsen/logrus" |
|
| 17 |
+ "github.com/Sirupsen/logrus" |
|
| 18 | 18 |
"github.com/docker/docker/pkg/reexec" |
| 19 | 19 |
"github.com/docker/libnetwork" |
| 20 | 20 |
"github.com/docker/libnetwork/ipamapi" |
| ... | ... |
@@ -485,7 +485,7 @@ func externalKeyTest(t *testing.T, reexec bool) {
|
| 485 | 485 |
} else {
|
| 486 | 486 |
defer func() {
|
| 487 | 487 |
if err := extOsBox.Destroy(); err != nil {
|
| 488 |
- log.Warnf("Failed to remove os sandbox: %v", err)
|
|
| 488 |
+ logrus.Warnf("Failed to remove os sandbox: %v", err)
|
|
| 489 | 489 |
} |
| 490 | 490 |
}() |
| 491 | 491 |
} |
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
"sync" |
| 11 | 11 |
"testing" |
| 12 | 12 |
|
| 13 |
- log "github.com/Sirupsen/logrus" |
|
| 13 |
+ "github.com/Sirupsen/logrus" |
|
| 14 | 14 |
"github.com/docker/docker/pkg/plugins" |
| 15 | 15 |
"github.com/docker/docker/pkg/reexec" |
| 16 | 16 |
"github.com/docker/libnetwork" |
| ... | ... |
@@ -37,7 +37,7 @@ func TestMain(m *testing.M) {
|
| 37 | 37 |
} |
| 38 | 38 |
|
| 39 | 39 |
if err := createController(); err != nil {
|
| 40 |
- log.Errorf("Error creating controller: %v", err)
|
|
| 40 |
+ logrus.Errorf("Error creating controller: %v", err)
|
|
| 41 | 41 |
os.Exit(1) |
| 42 | 42 |
} |
| 43 | 43 |
|
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"sync" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
- log "github.com/Sirupsen/logrus" |
|
| 11 |
+ "github.com/Sirupsen/logrus" |
|
| 12 | 12 |
"github.com/docker/docker/pkg/stringid" |
| 13 | 13 |
"github.com/docker/libnetwork/config" |
| 14 | 14 |
"github.com/docker/libnetwork/datastore" |
| ... | ... |
@@ -473,7 +473,7 @@ func (n *network) UnmarshalJSON(b []byte) (err error) {
|
| 473 | 473 |
if v, ok := netMap["created"]; ok {
|
| 474 | 474 |
// n.created is time.Time but marshalled as string |
| 475 | 475 |
if err = n.created.UnmarshalText([]byte(v.(string))); err != nil {
|
| 476 |
- log.Warnf("failed to unmarshal creation time %v: %v", v, err)
|
|
| 476 |
+ logrus.Warnf("failed to unmarshal creation time %v: %v", v, err)
|
|
| 477 | 477 |
n.created = time.Time{}
|
| 478 | 478 |
} |
| 479 | 479 |
} |
| ... | ... |
@@ -779,12 +779,12 @@ func (n *network) delete(force bool) error {
|
| 779 | 779 |
if !force {
|
| 780 | 780 |
return err |
| 781 | 781 |
} |
| 782 |
- log.Debugf("driver failed to delete stale network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 782 |
+ logrus.Debugf("driver failed to delete stale network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 783 | 783 |
} |
| 784 | 784 |
|
| 785 | 785 |
n.ipamRelease() |
| 786 | 786 |
if err = c.updateToStore(n); err != nil {
|
| 787 |
- log.Warnf("Failed to update store after ipam release for network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 787 |
+ logrus.Warnf("Failed to update store after ipam release for network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 788 | 788 |
} |
| 789 | 789 |
|
| 790 | 790 |
// We are about to delete the network. Leave the gossip |
| ... | ... |
@@ -795,7 +795,7 @@ func (n *network) delete(force bool) error {
|
| 795 | 795 |
// bindings cleanup requires the network in the store. |
| 796 | 796 |
n.cancelDriverWatches() |
| 797 | 797 |
if err = n.leaveCluster(); err != nil {
|
| 798 |
- log.Errorf("Failed leaving network %s from the agent cluster: %v", n.Name(), err)
|
|
| 798 |
+ logrus.Errorf("Failed leaving network %s from the agent cluster: %v", n.Name(), err)
|
|
| 799 | 799 |
} |
| 800 | 800 |
|
| 801 | 801 |
c.cleanupServiceBindings(n.ID()) |
| ... | ... |
@@ -807,7 +807,7 @@ func (n *network) delete(force bool) error {
|
| 807 | 807 |
if !force {
|
| 808 | 808 |
return fmt.Errorf("error deleting network endpoint count from store: %v", err)
|
| 809 | 809 |
} |
| 810 |
- log.Debugf("Error deleting endpoint count from store for stale network %s (%s) for deletion: %v", n.Name(), n.ID(), err)
|
|
| 810 |
+ logrus.Debugf("Error deleting endpoint count from store for stale network %s (%s) for deletion: %v", n.Name(), n.ID(), err)
|
|
| 811 | 811 |
} |
| 812 | 812 |
|
| 813 | 813 |
if err = c.deleteFromStore(n); err != nil {
|
| ... | ... |
@@ -830,7 +830,7 @@ func (n *network) deleteNetwork() error {
|
| 830 | 830 |
} |
| 831 | 831 |
|
| 832 | 832 |
if _, ok := err.(types.MaskableError); !ok {
|
| 833 |
- log.Warnf("driver error deleting network %s : %v", n.name, err)
|
|
| 833 |
+ logrus.Warnf("driver error deleting network %s : %v", n.name, err)
|
|
| 834 | 834 |
} |
| 835 | 835 |
} |
| 836 | 836 |
|
| ... | ... |
@@ -923,7 +923,7 @@ func (n *network) CreateEndpoint(name string, options ...EndpointOption) (Endpoi |
| 923 | 923 |
defer func() {
|
| 924 | 924 |
if err != nil {
|
| 925 | 925 |
if e := ep.deleteEndpoint(false); e != nil {
|
| 926 |
- log.Warnf("cleaning up endpoint failed %s : %v", name, e)
|
|
| 926 |
+ logrus.Warnf("cleaning up endpoint failed %s : %v", name, e)
|
|
| 927 | 927 |
} |
| 928 | 928 |
} |
| 929 | 929 |
}() |
| ... | ... |
@@ -938,7 +938,7 @@ func (n *network) CreateEndpoint(name string, options ...EndpointOption) (Endpoi |
| 938 | 938 |
defer func() {
|
| 939 | 939 |
if err != nil {
|
| 940 | 940 |
if e := n.getController().deleteFromStore(ep); e != nil {
|
| 941 |
- log.Warnf("error rolling back endpoint %s from store: %v", name, e)
|
|
| 941 |
+ logrus.Warnf("error rolling back endpoint %s from store: %v", name, e)
|
|
| 942 | 942 |
} |
| 943 | 943 |
} |
| 944 | 944 |
}() |
| ... | ... |
@@ -964,7 +964,7 @@ func (n *network) Endpoints() []Endpoint {
|
| 964 | 964 |
|
| 965 | 965 |
endpoints, err := n.getEndpointsFromStore() |
| 966 | 966 |
if err != nil {
|
| 967 |
- log.Error(err) |
|
| 967 |
+ logrus.Error(err) |
|
| 968 | 968 |
} |
| 969 | 969 |
|
| 970 | 970 |
for _, ep := range endpoints {
|
| ... | ... |
@@ -1172,7 +1172,7 @@ func (n *network) getSvcRecords(ep *endpoint) []etchosts.Record {
|
| 1172 | 1172 |
continue |
| 1173 | 1173 |
} |
| 1174 | 1174 |
if len(ip) == 0 {
|
| 1175 |
- log.Warnf("Found empty list of IP addresses for service %s on network %s (%s)", h, n.name, n.id)
|
|
| 1175 |
+ logrus.Warnf("Found empty list of IP addresses for service %s on network %s (%s)", h, n.name, n.id)
|
|
| 1176 | 1176 |
continue |
| 1177 | 1177 |
} |
| 1178 | 1178 |
recs = append(recs, etchosts.Record{
|
| ... | ... |
@@ -1256,7 +1256,7 @@ func (n *network) requestPoolHelper(ipam ipamapi.Ipam, addressSpace, preferredPo |
| 1256 | 1256 |
// pools. |
| 1257 | 1257 |
defer func() {
|
| 1258 | 1258 |
if err := ipam.ReleasePool(poolID); err != nil {
|
| 1259 |
- log.Warnf("Failed to release overlapping pool %s while returning from pool request helper for network %s", pool, n.Name())
|
|
| 1259 |
+ logrus.Warnf("Failed to release overlapping pool %s while returning from pool request helper for network %s", pool, n.Name())
|
|
| 1260 | 1260 |
} |
| 1261 | 1261 |
}() |
| 1262 | 1262 |
|
| ... | ... |
@@ -1297,7 +1297,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
|
| 1297 | 1297 |
|
| 1298 | 1298 |
*infoList = make([]*IpamInfo, len(*cfgList)) |
| 1299 | 1299 |
|
| 1300 |
- log.Debugf("Allocating IPv%d pools for network %s (%s)", ipVer, n.Name(), n.ID())
|
|
| 1300 |
+ logrus.Debugf("Allocating IPv%d pools for network %s (%s)", ipVer, n.Name(), n.ID())
|
|
| 1301 | 1301 |
|
| 1302 | 1302 |
for i, cfg := range *cfgList {
|
| 1303 | 1303 |
if err = cfg.Validate(); err != nil {
|
| ... | ... |
@@ -1315,7 +1315,7 @@ func (n *network) ipamAllocateVersion(ipVer int, ipam ipamapi.Ipam) error {
|
| 1315 | 1315 |
defer func() {
|
| 1316 | 1316 |
if err != nil {
|
| 1317 | 1317 |
if err := ipam.ReleasePool(d.PoolID); err != nil {
|
| 1318 |
- log.Warnf("Failed to release address pool %s after failure to create network %s (%s)", d.PoolID, n.Name(), n.ID())
|
|
| 1318 |
+ logrus.Warnf("Failed to release address pool %s after failure to create network %s (%s)", d.PoolID, n.Name(), n.ID())
|
|
| 1319 | 1319 |
} |
| 1320 | 1320 |
} |
| 1321 | 1321 |
}() |
| ... | ... |
@@ -1367,7 +1367,7 @@ func (n *network) ipamRelease() {
|
| 1367 | 1367 |
} |
| 1368 | 1368 |
ipam, _, err := n.getController().getIPAMDriver(n.ipamType) |
| 1369 | 1369 |
if err != nil {
|
| 1370 |
- log.Warnf("Failed to retrieve ipam driver to release address pool(s) on delete of network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 1370 |
+ logrus.Warnf("Failed to retrieve ipam driver to release address pool(s) on delete of network %s (%s): %v", n.Name(), n.ID(), err)
|
|
| 1371 | 1371 |
return |
| 1372 | 1372 |
} |
| 1373 | 1373 |
n.ipamReleaseVersion(4, ipam) |
| ... | ... |
@@ -1383,7 +1383,7 @@ func (n *network) ipamReleaseVersion(ipVer int, ipam ipamapi.Ipam) {
|
| 1383 | 1383 |
case 6: |
| 1384 | 1384 |
infoList = &n.ipamV6Info |
| 1385 | 1385 |
default: |
| 1386 |
- log.Warnf("incorrect ip version passed to ipam release: %d", ipVer)
|
|
| 1386 |
+ logrus.Warnf("incorrect ip version passed to ipam release: %d", ipVer)
|
|
| 1387 | 1387 |
return |
| 1388 | 1388 |
} |
| 1389 | 1389 |
|
| ... | ... |
@@ -1391,25 +1391,25 @@ func (n *network) ipamReleaseVersion(ipVer int, ipam ipamapi.Ipam) {
|
| 1391 | 1391 |
return |
| 1392 | 1392 |
} |
| 1393 | 1393 |
|
| 1394 |
- log.Debugf("releasing IPv%d pools from network %s (%s)", ipVer, n.Name(), n.ID())
|
|
| 1394 |
+ logrus.Debugf("releasing IPv%d pools from network %s (%s)", ipVer, n.Name(), n.ID())
|
|
| 1395 | 1395 |
|
| 1396 | 1396 |
for _, d := range *infoList {
|
| 1397 | 1397 |
if d.Gateway != nil {
|
| 1398 | 1398 |
if err := ipam.ReleaseAddress(d.PoolID, d.Gateway.IP); err != nil {
|
| 1399 |
- log.Warnf("Failed to release gateway ip address %s on delete of network %s (%s): %v", d.Gateway.IP, n.Name(), n.ID(), err)
|
|
| 1399 |
+ logrus.Warnf("Failed to release gateway ip address %s on delete of network %s (%s): %v", d.Gateway.IP, n.Name(), n.ID(), err)
|
|
| 1400 | 1400 |
} |
| 1401 | 1401 |
} |
| 1402 | 1402 |
if d.IPAMData.AuxAddresses != nil {
|
| 1403 | 1403 |
for k, nw := range d.IPAMData.AuxAddresses {
|
| 1404 | 1404 |
if d.Pool.Contains(nw.IP) {
|
| 1405 | 1405 |
if err := ipam.ReleaseAddress(d.PoolID, nw.IP); err != nil && err != ipamapi.ErrIPOutOfRange {
|
| 1406 |
- log.Warnf("Failed to release secondary ip address %s (%v) on delete of network %s (%s): %v", k, nw.IP, n.Name(), n.ID(), err)
|
|
| 1406 |
+ logrus.Warnf("Failed to release secondary ip address %s (%v) on delete of network %s (%s): %v", k, nw.IP, n.Name(), n.ID(), err)
|
|
| 1407 | 1407 |
} |
| 1408 | 1408 |
} |
| 1409 | 1409 |
} |
| 1410 | 1410 |
} |
| 1411 | 1411 |
if err := ipam.ReleasePool(d.PoolID); err != nil {
|
| 1412 |
- log.Warnf("Failed to release address pool %s on delete of network %s (%s): %v", d.PoolID, n.Name(), n.ID(), err)
|
|
| 1412 |
+ logrus.Warnf("Failed to release address pool %s on delete of network %s (%s): %v", d.PoolID, n.Name(), n.ID(), err)
|
|
| 1413 | 1413 |
} |
| 1414 | 1414 |
} |
| 1415 | 1415 |
|
| ... | ... |
@@ -1661,7 +1661,7 @@ func (n *network) ResolveService(name string) ([]*net.SRV, []net.IP) {
|
| 1661 | 1661 |
srv := []*net.SRV{}
|
| 1662 | 1662 |
ip := []net.IP{}
|
| 1663 | 1663 |
|
| 1664 |
- log.Debugf("Service name To resolve: %v", name)
|
|
| 1664 |
+ logrus.Debugf("Service name To resolve: %v", name)
|
|
| 1665 | 1665 |
|
| 1666 | 1666 |
// There are DNS implementaions that allow SRV queries for names not in |
| 1667 | 1667 |
// the format defined by RFC 2782. Hence specific validations checks are |
| ... | ... |
@@ -7,7 +7,7 @@ import ( |
| 7 | 7 |
"time" |
| 8 | 8 |
|
| 9 | 9 |
"github.com/Microsoft/hcsshim" |
| 10 |
- log "github.com/Sirupsen/logrus" |
|
| 10 |
+ "github.com/Sirupsen/logrus" |
|
| 11 | 11 |
"github.com/docker/libnetwork/drivers/windows" |
| 12 | 12 |
"github.com/docker/libnetwork/ipamapi" |
| 13 | 13 |
"github.com/docker/libnetwork/ipams/windowsipam" |
| ... | ... |
@@ -17,7 +17,7 @@ func executeInCompartment(compartmentID uint32, x func()) {
|
| 17 | 17 |
runtime.LockOSThread() |
| 18 | 18 |
|
| 19 | 19 |
if err := hcsshim.SetCurrentThreadCompartmentId(compartmentID); err != nil {
|
| 20 |
- log.Error(err) |
|
| 20 |
+ logrus.Error(err) |
|
| 21 | 21 |
} |
| 22 | 22 |
defer func() {
|
| 23 | 23 |
hcsshim.SetCurrentThreadCompartmentId(0) |
| ... | ... |
@@ -29,7 +29,7 @@ func executeInCompartment(compartmentID uint32, x func()) {
|
| 29 | 29 |
|
| 30 | 30 |
func (n *network) startResolver() {
|
| 31 | 31 |
n.resolverOnce.Do(func() {
|
| 32 |
- log.Debugf("Launching DNS server for network", n.Name())
|
|
| 32 |
+ logrus.Debugf("Launching DNS server for network", n.Name())
|
|
| 33 | 33 |
options := n.Info().DriverOptions() |
| 34 | 34 |
hnsid := options[windows.HNSID] |
| 35 | 35 |
|
| ... | ... |
@@ -39,7 +39,7 @@ func (n *network) startResolver() {
|
| 39 | 39 |
|
| 40 | 40 |
hnsresponse, err := hcsshim.HNSNetworkRequest("GET", hnsid, "")
|
| 41 | 41 |
if err != nil {
|
| 42 |
- log.Errorf("Resolver Setup/Start failed for container %s, %q", n.Name(), err)
|
|
| 42 |
+ logrus.Errorf("Resolver Setup/Start failed for container %s, %q", n.Name(), err)
|
|
| 43 | 43 |
return |
| 44 | 44 |
} |
| 45 | 45 |
|
| ... | ... |
@@ -47,14 +47,14 @@ func (n *network) startResolver() {
|
| 47 | 47 |
if subnet.GatewayAddress != "" {
|
| 48 | 48 |
for i := 0; i < 3; i++ {
|
| 49 | 49 |
resolver := NewResolver(subnet.GatewayAddress, false, "", n) |
| 50 |
- log.Debugf("Binding a resolver on network %s gateway %s", n.Name(), subnet.GatewayAddress)
|
|
| 50 |
+ logrus.Debugf("Binding a resolver on network %s gateway %s", n.Name(), subnet.GatewayAddress)
|
|
| 51 | 51 |
executeInCompartment(hnsresponse.DNSServerCompartment, resolver.SetupFunc(53)) |
| 52 | 52 |
|
| 53 | 53 |
if err = resolver.Start(); err != nil {
|
| 54 |
- log.Errorf("Resolver Setup/Start failed for container %s, %q", n.Name(), err)
|
|
| 54 |
+ logrus.Errorf("Resolver Setup/Start failed for container %s, %q", n.Name(), err)
|
|
| 55 | 55 |
time.Sleep(1 * time.Second) |
| 56 | 56 |
} else {
|
| 57 |
- log.Debugf("Resolver bound successfuly for network %s", n.Name())
|
|
| 57 |
+ logrus.Debugf("Resolver bound successfuly for network %s", n.Name())
|
|
| 58 | 58 |
n.resolver = append(n.resolver, resolver) |
| 59 | 59 |
break |
| 60 | 60 |
} |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"sync" |
| 9 | 9 |
"syscall" |
| 10 | 10 |
|
| 11 |
- log "github.com/Sirupsen/logrus" |
|
| 11 |
+ "github.com/Sirupsen/logrus" |
|
| 12 | 12 |
"github.com/vishvananda/netlink" |
| 13 | 13 |
"github.com/vishvananda/netns" |
| 14 | 14 |
) |
| ... | ... |
@@ -24,11 +24,11 @@ func Init() {
|
| 24 | 24 |
var err error |
| 25 | 25 |
initNs, err = netns.Get() |
| 26 | 26 |
if err != nil {
|
| 27 |
- log.Errorf("could not get initial namespace: %v", err)
|
|
| 27 |
+ logrus.Errorf("could not get initial namespace: %v", err)
|
|
| 28 | 28 |
} |
| 29 | 29 |
initNl, err = netlink.NewHandle(getSupportedNlFamilies()...) |
| 30 | 30 |
if err != nil {
|
| 31 |
- log.Errorf("could not create netlink handle on initial namespace: %v", err)
|
|
| 31 |
+ logrus.Errorf("could not create netlink handle on initial namespace: %v", err)
|
|
| 32 | 32 |
} |
| 33 | 33 |
} |
| 34 | 34 |
|
| ... | ... |
@@ -70,7 +70,7 @@ func getSupportedNlFamilies() []int {
|
| 70 | 70 |
fams := []int{syscall.NETLINK_ROUTE}
|
| 71 | 71 |
if err := loadXfrmModules(); err != nil {
|
| 72 | 72 |
if checkXfrmSocket() != nil {
|
| 73 |
- log.Warnf("Could not load necessary modules for IPSEC rules: %v", err)
|
|
| 73 |
+ logrus.Warnf("Could not load necessary modules for IPSEC rules: %v", err)
|
|
| 74 | 74 |
return fams |
| 75 | 75 |
} |
| 76 | 76 |
} |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"syscall" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
- log "github.com/Sirupsen/logrus" |
|
| 11 |
+ "github.com/Sirupsen/logrus" |
|
| 12 | 12 |
"github.com/docker/libnetwork/ns" |
| 13 | 13 |
"github.com/docker/libnetwork/types" |
| 14 | 14 |
"github.com/vishvananda/netlink" |
| ... | ... |
@@ -167,7 +167,7 @@ func (i *nwIface) Remove() error {
|
| 167 | 167 |
|
| 168 | 168 |
err = nlh.LinkSetName(iface, i.SrcName()) |
| 169 | 169 |
if err != nil {
|
| 170 |
- log.Debugf("LinkSetName failed for interface %s: %v", i.SrcName(), err)
|
|
| 170 |
+ logrus.Debugf("LinkSetName failed for interface %s: %v", i.SrcName(), err)
|
|
| 171 | 171 |
return err |
| 172 | 172 |
} |
| 173 | 173 |
|
| ... | ... |
@@ -179,7 +179,7 @@ func (i *nwIface) Remove() error {
|
| 179 | 179 |
} else if !isDefault {
|
| 180 | 180 |
// Move the network interface to caller namespace. |
| 181 | 181 |
if err := nlh.LinkSetNsFd(iface, ns.ParseHandlerInt()); err != nil {
|
| 182 |
- log.Debugf("LinkSetNsPid failed for interface %s: %v", i.SrcName(), err)
|
|
| 182 |
+ logrus.Debugf("LinkSetNsPid failed for interface %s: %v", i.SrcName(), err)
|
|
| 183 | 183 |
return err |
| 184 | 184 |
} |
| 185 | 185 |
} |
| ... | ... |
@@ -315,7 +315,7 @@ func (n *networkNamespace) AddInterface(srcName, dstPrefix string, options ...If |
| 315 | 315 |
// Up the interface. |
| 316 | 316 |
cnt := 0 |
| 317 | 317 |
for err = nlh.LinkSetUp(iface); err != nil && cnt < 3; cnt++ {
|
| 318 |
- log.Debugf("retrying link setup because of: %v", err)
|
|
| 318 |
+ logrus.Debugf("retrying link setup because of: %v", err)
|
|
| 319 | 319 |
time.Sleep(10 * time.Millisecond) |
| 320 | 320 |
err = nlh.LinkSetUp(iface) |
| 321 | 321 |
} |
| ... | ... |
@@ -14,7 +14,7 @@ import ( |
| 14 | 14 |
"syscall" |
| 15 | 15 |
"time" |
| 16 | 16 |
|
| 17 |
- log "github.com/Sirupsen/logrus" |
|
| 17 |
+ "github.com/Sirupsen/logrus" |
|
| 18 | 18 |
"github.com/docker/docker/pkg/reexec" |
| 19 | 19 |
"github.com/docker/libnetwork/ns" |
| 20 | 20 |
"github.com/docker/libnetwork/types" |
| ... | ... |
@@ -263,10 +263,10 @@ func GetSandboxForExternalKey(basePath string, key string) (Sandbox, error) {
|
| 263 | 263 |
|
| 264 | 264 |
func reexecCreateNamespace() {
|
| 265 | 265 |
if len(os.Args) < 2 {
|
| 266 |
- log.Fatal("no namespace path provided")
|
|
| 266 |
+ logrus.Fatal("no namespace path provided")
|
|
| 267 | 267 |
} |
| 268 | 268 |
if err := mountNetworkNamespace("/proc/self/ns/net", os.Args[1]); err != nil {
|
| 269 |
- log.Fatal(err) |
|
| 269 |
+ logrus.Fatal(err) |
|
| 270 | 270 |
} |
| 271 | 271 |
} |
| 272 | 272 |
|
| ... | ... |
@@ -338,7 +338,7 @@ func (n *networkNamespace) InvokeFunc(f func()) error {
|
| 338 | 338 |
func InitOSContext() func() {
|
| 339 | 339 |
runtime.LockOSThread() |
| 340 | 340 |
if err := ns.SetNamespace(); err != nil {
|
| 341 |
- log.Error(err) |
|
| 341 |
+ logrus.Error(err) |
|
| 342 | 342 |
} |
| 343 | 343 |
return runtime.UnlockOSThread |
| 344 | 344 |
} |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
"sync" |
| 9 | 9 |
"time" |
| 10 | 10 |
|
| 11 |
- log "github.com/Sirupsen/logrus" |
|
| 11 |
+ "github.com/Sirupsen/logrus" |
|
| 12 | 12 |
"github.com/docker/libnetwork/types" |
| 13 | 13 |
"github.com/miekg/dns" |
| 14 | 14 |
) |
| ... | ... |
@@ -219,7 +219,7 @@ func (r *resolver) handleIPQuery(name string, query *dns.Msg, ipType int) (*dns. |
| 219 | 219 |
|
| 220 | 220 |
if addr == nil && ipv6Miss {
|
| 221 | 221 |
// Send a reply without any Answer sections |
| 222 |
- log.Debugf("Lookup name %s present without IPv6 address", name)
|
|
| 222 |
+ logrus.Debugf("Lookup name %s present without IPv6 address", name)
|
|
| 223 | 223 |
resp := createRespMsg(query) |
| 224 | 224 |
return resp, nil |
| 225 | 225 |
} |
| ... | ... |
@@ -227,7 +227,7 @@ func (r *resolver) handleIPQuery(name string, query *dns.Msg, ipType int) (*dns. |
| 227 | 227 |
return nil, nil |
| 228 | 228 |
} |
| 229 | 229 |
|
| 230 |
- log.Debugf("Lookup for %s: IP %v", name, addr)
|
|
| 230 |
+ logrus.Debugf("Lookup for %s: IP %v", name, addr)
|
|
| 231 | 231 |
|
| 232 | 232 |
resp := createRespMsg(query) |
| 233 | 233 |
if len(addr) > 1 {
|
| ... | ... |
@@ -268,7 +268,7 @@ func (r *resolver) handlePTRQuery(ptr string, query *dns.Msg) (*dns.Msg, error) |
| 268 | 268 |
return nil, nil |
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 |
- log.Debugf("Lookup for IP %s: name %s", parts[0], host)
|
|
| 271 |
+ logrus.Debugf("Lookup for IP %s: name %s", parts[0], host)
|
|
| 272 | 272 |
fqdn := dns.Fqdn(host) |
| 273 | 273 |
|
| 274 | 274 |
resp := new(dns.Msg) |
| ... | ... |
@@ -352,7 +352,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 352 | 352 |
} |
| 353 | 353 |
|
| 354 | 354 |
if err != nil {
|
| 355 |
- log.Error(err) |
|
| 355 |
+ logrus.Error(err) |
|
| 356 | 356 |
return |
| 357 | 357 |
} |
| 358 | 358 |
|
| ... | ... |
@@ -411,10 +411,10 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 411 | 411 |
|
| 412 | 412 |
execErr := r.backend.ExecFunc(extConnect) |
| 413 | 413 |
if execErr != nil || err != nil {
|
| 414 |
- log.Debugf("Connect failed, %s", err)
|
|
| 414 |
+ logrus.Debugf("Connect failed, %s", err)
|
|
| 415 | 415 |
continue |
| 416 | 416 |
} |
| 417 |
- log.Debugf("Query %s[%d] from %s, forwarding to %s:%s", name, query.Question[0].Qtype,
|
|
| 417 |
+ logrus.Debugf("Query %s[%d] from %s, forwarding to %s:%s", name, query.Question[0].Qtype,
|
|
| 418 | 418 |
extConn.LocalAddr().String(), proto, extDNS.ipStr) |
| 419 | 419 |
|
| 420 | 420 |
// Timeout has to be set for every IO operation. |
| ... | ... |
@@ -430,7 +430,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 430 | 430 |
old := r.tStamp |
| 431 | 431 |
r.tStamp = time.Now() |
| 432 | 432 |
if r.tStamp.Sub(old) > logInterval {
|
| 433 |
- log.Errorf("More than %v concurrent queries from %s", maxConcurrent, extConn.LocalAddr().String())
|
|
| 433 |
+ logrus.Errorf("More than %v concurrent queries from %s", maxConcurrent, extConn.LocalAddr().String())
|
|
| 434 | 434 |
} |
| 435 | 435 |
continue |
| 436 | 436 |
} |
| ... | ... |
@@ -438,7 +438,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 438 | 438 |
err = co.WriteMsg(query) |
| 439 | 439 |
if err != nil {
|
| 440 | 440 |
r.forwardQueryEnd() |
| 441 |
- log.Debugf("Send to DNS server failed, %s", err)
|
|
| 441 |
+ logrus.Debugf("Send to DNS server failed, %s", err)
|
|
| 442 | 442 |
continue |
| 443 | 443 |
} |
| 444 | 444 |
|
| ... | ... |
@@ -447,7 +447,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 447 | 447 |
// client can retry over TCP |
| 448 | 448 |
if err != nil && err != dns.ErrTruncated {
|
| 449 | 449 |
r.forwardQueryEnd() |
| 450 |
- log.Debugf("Read from DNS server failed, %s", err)
|
|
| 450 |
+ logrus.Debugf("Read from DNS server failed, %s", err)
|
|
| 451 | 451 |
continue |
| 452 | 452 |
} |
| 453 | 453 |
|
| ... | ... |
@@ -462,7 +462,7 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
|
| 462 | 462 |
} |
| 463 | 463 |
|
| 464 | 464 |
if err = w.WriteMsg(resp); err != nil {
|
| 465 |
- log.Errorf("error writing resolver resp, %s", err)
|
|
| 465 |
+ logrus.Errorf("error writing resolver resp, %s", err)
|
|
| 466 | 466 |
} |
| 467 | 467 |
} |
| 468 | 468 |
|
| ... | ... |
@@ -483,7 +483,7 @@ func (r *resolver) forwardQueryEnd() {
|
| 483 | 483 |
defer r.queryLock.Unlock() |
| 484 | 484 |
|
| 485 | 485 |
if r.count == 0 {
|
| 486 |
- log.Errorf("Invalid concurrent query count")
|
|
| 486 |
+ logrus.Error("Invalid concurrent query count")
|
|
| 487 | 487 |
} else {
|
| 488 | 488 |
r.count-- |
| 489 | 489 |
} |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"os/exec" |
| 10 | 10 |
"runtime" |
| 11 | 11 |
|
| 12 |
- log "github.com/Sirupsen/logrus" |
|
| 12 |
+ "github.com/Sirupsen/logrus" |
|
| 13 | 13 |
"github.com/docker/docker/pkg/reexec" |
| 14 | 14 |
"github.com/docker/libnetwork/iptables" |
| 15 | 15 |
"github.com/vishvananda/netns" |
| ... | ... |
@@ -31,7 +31,7 @@ func reexecSetupResolver() {
|
| 31 | 31 |
defer runtime.UnlockOSThread() |
| 32 | 32 |
|
| 33 | 33 |
if len(os.Args) < 4 {
|
| 34 |
- log.Error("invalid number of arguments..")
|
|
| 34 |
+ logrus.Error("invalid number of arguments..")
|
|
| 35 | 35 |
os.Exit(1) |
| 36 | 36 |
} |
| 37 | 37 |
|
| ... | ... |
@@ -46,14 +46,14 @@ func reexecSetupResolver() {
|
| 46 | 46 |
|
| 47 | 47 |
f, err := os.OpenFile(os.Args[1], os.O_RDONLY, 0) |
| 48 | 48 |
if err != nil {
|
| 49 |
- log.Errorf("failed get network namespace %q: %v", os.Args[1], err)
|
|
| 49 |
+ logrus.Errorf("failed get network namespace %q: %v", os.Args[1], err)
|
|
| 50 | 50 |
os.Exit(2) |
| 51 | 51 |
} |
| 52 | 52 |
defer f.Close() |
| 53 | 53 |
|
| 54 | 54 |
nsFD := f.Fd() |
| 55 | 55 |
if err = netns.Set(netns.NsHandle(nsFD)); err != nil {
|
| 56 |
- log.Errorf("setting into container net ns %v failed, %v", os.Args[1], err)
|
|
| 56 |
+ logrus.Errorf("setting into container net ns %v failed, %v", os.Args[1], err)
|
|
| 57 | 57 |
os.Exit(3) |
| 58 | 58 |
} |
| 59 | 59 |
|
| ... | ... |
@@ -76,7 +76,7 @@ func reexecSetupResolver() {
|
| 76 | 76 |
|
| 77 | 77 |
for _, rule := range rules {
|
| 78 | 78 |
if iptables.RawCombinedOutputNative(rule...) != nil {
|
| 79 |
- log.Errorf("setting up rule failed, %v", rule)
|
|
| 79 |
+ logrus.Errorf("setting up rule failed, %v", rule)
|
|
| 80 | 80 |
} |
| 81 | 81 |
} |
| 82 | 82 |
} |
| ... | ... |
@@ -9,7 +9,7 @@ import ( |
| 9 | 9 |
"sync" |
| 10 | 10 |
"time" |
| 11 | 11 |
|
| 12 |
- log "github.com/Sirupsen/logrus" |
|
| 12 |
+ "github.com/Sirupsen/logrus" |
|
| 13 | 13 |
"github.com/docker/libnetwork/etchosts" |
| 14 | 14 |
"github.com/docker/libnetwork/netlabel" |
| 15 | 15 |
"github.com/docker/libnetwork/osl" |
| ... | ... |
@@ -213,18 +213,18 @@ func (sb *sandbox) delete(force bool) error {
|
| 213 | 213 |
if c.isDistributedControl() {
|
| 214 | 214 |
retain = true |
| 215 | 215 |
} |
| 216 |
- log.Warnf("Failed getting network for ep %s during sandbox %s delete: %v", ep.ID(), sb.ID(), err)
|
|
| 216 |
+ logrus.Warnf("Failed getting network for ep %s during sandbox %s delete: %v", ep.ID(), sb.ID(), err)
|
|
| 217 | 217 |
continue |
| 218 | 218 |
} |
| 219 | 219 |
|
| 220 | 220 |
if !force {
|
| 221 | 221 |
if err := ep.Leave(sb); err != nil {
|
| 222 |
- log.Warnf("Failed detaching sandbox %s from endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 222 |
+ logrus.Warnf("Failed detaching sandbox %s from endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 223 | 223 |
} |
| 224 | 224 |
} |
| 225 | 225 |
|
| 226 | 226 |
if err := ep.Delete(force); err != nil {
|
| 227 |
- log.Warnf("Failed deleting endpoint %s: %v\n", ep.ID(), err)
|
|
| 227 |
+ logrus.Warnf("Failed deleting endpoint %s: %v\n", ep.ID(), err)
|
|
| 228 | 228 |
} |
| 229 | 229 |
} |
| 230 | 230 |
|
| ... | ... |
@@ -247,7 +247,7 @@ func (sb *sandbox) delete(force bool) error {
|
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
if err := sb.storeDelete(); err != nil {
|
| 250 |
- log.Warnf("Failed to delete sandbox %s from store: %v", sb.ID(), err)
|
|
| 250 |
+ logrus.Warnf("Failed to delete sandbox %s from store: %v", sb.ID(), err)
|
|
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 | 253 |
c.Lock() |
| ... | ... |
@@ -291,7 +291,7 @@ func (sb *sandbox) Refresh(options ...SandboxOption) error {
|
| 291 | 291 |
// Detach from all endpoints |
| 292 | 292 |
for _, ep := range epList {
|
| 293 | 293 |
if err := ep.Leave(sb); err != nil {
|
| 294 |
- log.Warnf("Failed detaching sandbox %s from endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 294 |
+ logrus.Warnf("Failed detaching sandbox %s from endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 295 | 295 |
} |
| 296 | 296 |
} |
| 297 | 297 |
|
| ... | ... |
@@ -307,7 +307,7 @@ func (sb *sandbox) Refresh(options ...SandboxOption) error {
|
| 307 | 307 |
// Re-connect to all endpoints |
| 308 | 308 |
for _, ep := range epList {
|
| 309 | 309 |
if err := ep.Join(sb); err != nil {
|
| 310 |
- log.Warnf("Failed attach sandbox %s to endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 310 |
+ logrus.Warnf("Failed attach sandbox %s to endpoint %s: %v\n", sb.ID(), ep.ID(), err)
|
|
| 311 | 311 |
} |
| 312 | 312 |
} |
| 313 | 313 |
|
| ... | ... |
@@ -413,7 +413,7 @@ func (sb *sandbox) updateGateway(ep *endpoint) error {
|
| 413 | 413 |
|
| 414 | 414 |
func (sb *sandbox) ResolveIP(ip string) string {
|
| 415 | 415 |
var svc string |
| 416 |
- log.Debugf("IP To resolve %v", ip)
|
|
| 416 |
+ logrus.Debugf("IP To resolve %v", ip)
|
|
| 417 | 417 |
|
| 418 | 418 |
for _, ep := range sb.getConnectedEndpoints() {
|
| 419 | 419 |
n := ep.getNetwork() |
| ... | ... |
@@ -434,7 +434,7 @@ func (sb *sandbox) ResolveService(name string) ([]*net.SRV, []net.IP) {
|
| 434 | 434 |
srv := []*net.SRV{}
|
| 435 | 435 |
ip := []net.IP{}
|
| 436 | 436 |
|
| 437 |
- log.Debugf("Service name To resolve: %v", name)
|
|
| 437 |
+ logrus.Debugf("Service name To resolve: %v", name)
|
|
| 438 | 438 |
|
| 439 | 439 |
// There are DNS implementaions that allow SRV queries for names not in |
| 440 | 440 |
// the format defined by RFC 2782. Hence specific validations checks are |
| ... | ... |
@@ -497,7 +497,7 @@ func (sb *sandbox) ResolveName(name string, ipType int) ([]net.IP, bool) {
|
| 497 | 497 |
// {a.b in network c.d},
|
| 498 | 498 |
// {a in network b.c.d},
|
| 499 | 499 |
|
| 500 |
- log.Debugf("Name To resolve: %v", name)
|
|
| 500 |
+ logrus.Debugf("Name To resolve: %v", name)
|
|
| 501 | 501 |
name = strings.TrimSuffix(name, ".") |
| 502 | 502 |
reqName := []string{name}
|
| 503 | 503 |
networkName := []string{""}
|
| ... | ... |
@@ -605,7 +605,7 @@ func (sb *sandbox) resolveName(req string, networkName string, epList []*endpoin |
| 605 | 605 |
func (sb *sandbox) SetKey(basePath string) error {
|
| 606 | 606 |
start := time.Now() |
| 607 | 607 |
defer func() {
|
| 608 |
- log.Debugf("sandbox set key processing took %s for container %s", time.Now().Sub(start), sb.ContainerID())
|
|
| 608 |
+ logrus.Debugf("sandbox set key processing took %s for container %s", time.Now().Sub(start), sb.ContainerID())
|
|
| 609 | 609 |
}() |
| 610 | 610 |
|
| 611 | 611 |
if basePath == "" {
|
| ... | ... |
@@ -646,10 +646,10 @@ func (sb *sandbox) SetKey(basePath string) error {
|
| 646 | 646 |
|
| 647 | 647 |
if err := sb.osSbox.InvokeFunc(sb.resolver.SetupFunc(0)); err == nil {
|
| 648 | 648 |
if err := sb.resolver.Start(); err != nil {
|
| 649 |
- log.Errorf("Resolver Start failed for container %s, %q", sb.ContainerID(), err)
|
|
| 649 |
+ logrus.Errorf("Resolver Start failed for container %s, %q", sb.ContainerID(), err)
|
|
| 650 | 650 |
} |
| 651 | 651 |
} else {
|
| 652 |
- log.Errorf("Resolver Setup Function failed for container %s, %q", sb.ContainerID(), err)
|
|
| 652 |
+ logrus.Errorf("Resolver Setup Function failed for container %s, %q", sb.ContainerID(), err)
|
|
| 653 | 653 |
} |
| 654 | 654 |
} |
| 655 | 655 |
|
| ... | ... |
@@ -690,7 +690,7 @@ func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
|
| 690 | 690 |
// Only remove the interfaces owned by this endpoint from the sandbox. |
| 691 | 691 |
if ep.hasInterface(i.SrcName()) {
|
| 692 | 692 |
if err := i.Remove(); err != nil {
|
| 693 |
- log.Debugf("Remove interface %s failed: %v", i.SrcName(), err)
|
|
| 693 |
+ logrus.Debugf("Remove interface %s failed: %v", i.SrcName(), err)
|
|
| 694 | 694 |
} |
| 695 | 695 |
} |
| 696 | 696 |
} |
| ... | ... |
@@ -706,7 +706,7 @@ func releaseOSSboxResources(osSbox osl.Sandbox, ep *endpoint) {
|
| 706 | 706 |
// Remove non-interface routes. |
| 707 | 707 |
for _, r := range joinInfo.StaticRoutes {
|
| 708 | 708 |
if err := osSbox.RemoveStaticRoute(r); err != nil {
|
| 709 |
- log.Debugf("Remove route failed: %v", err)
|
|
| 709 |
+ logrus.Debugf("Remove route failed: %v", err)
|
|
| 710 | 710 |
} |
| 711 | 711 |
} |
| 712 | 712 |
} |
| ... | ... |
@@ -741,7 +741,7 @@ func (sb *sandbox) restoreOslSandbox() error {
|
| 741 | 741 |
ep.Unlock() |
| 742 | 742 |
|
| 743 | 743 |
if i == nil {
|
| 744 |
- log.Errorf("error restoring endpoint %s for container %s", ep.Name(), sb.ContainerID())
|
|
| 744 |
+ logrus.Errorf("error restoring endpoint %s for container %s", ep.Name(), sb.ContainerID())
|
|
| 745 | 745 |
continue |
| 746 | 746 |
} |
| 747 | 747 |
|
| ... | ... |
@@ -876,7 +876,7 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error {
|
| 876 | 876 |
if len(sb.endpoints) == 0 {
|
| 877 | 877 |
// sb.endpoints should never be empty and this is unexpected error condition |
| 878 | 878 |
// We log an error message to note this down for debugging purposes. |
| 879 |
- log.Errorf("No endpoints in sandbox while trying to remove endpoint %s", ep.Name())
|
|
| 879 |
+ logrus.Errorf("No endpoints in sandbox while trying to remove endpoint %s", ep.Name())
|
|
| 880 | 880 |
sb.Unlock() |
| 881 | 881 |
return nil |
| 882 | 882 |
} |
| ... | ... |
@@ -11,7 +11,7 @@ import ( |
| 11 | 11 |
"strconv" |
| 12 | 12 |
"strings" |
| 13 | 13 |
|
| 14 |
- log "github.com/Sirupsen/logrus" |
|
| 14 |
+ "github.com/Sirupsen/logrus" |
|
| 15 | 15 |
"github.com/docker/libnetwork/etchosts" |
| 16 | 16 |
"github.com/docker/libnetwork/resolvconf" |
| 17 | 17 |
"github.com/docker/libnetwork/types" |
| ... | ... |
@@ -40,19 +40,19 @@ func (sb *sandbox) startResolver(restore bool) {
|
| 40 | 40 |
if !restore {
|
| 41 | 41 |
err = sb.rebuildDNS() |
| 42 | 42 |
if err != nil {
|
| 43 |
- log.Errorf("Updating resolv.conf failed for container %s, %q", sb.ContainerID(), err)
|
|
| 43 |
+ logrus.Errorf("Updating resolv.conf failed for container %s, %q", sb.ContainerID(), err)
|
|
| 44 | 44 |
return |
| 45 | 45 |
} |
| 46 | 46 |
} |
| 47 | 47 |
sb.resolver.SetExtServers(sb.extDNS) |
| 48 | 48 |
|
| 49 | 49 |
if err = sb.osSbox.InvokeFunc(sb.resolver.SetupFunc(0)); err != nil {
|
| 50 |
- log.Errorf("Resolver Setup function failed for container %s, %q", sb.ContainerID(), err)
|
|
| 50 |
+ logrus.Errorf("Resolver Setup function failed for container %s, %q", sb.ContainerID(), err)
|
|
| 51 | 51 |
return |
| 52 | 52 |
} |
| 53 | 53 |
|
| 54 | 54 |
if err = sb.resolver.Start(); err != nil {
|
| 55 |
- log.Errorf("Resolver Start failed for container %s, %q", sb.ContainerID(), err)
|
|
| 55 |
+ logrus.Errorf("Resolver Start failed for container %s, %q", sb.ContainerID(), err)
|
|
| 56 | 56 |
} |
| 57 | 57 |
}) |
| 58 | 58 |
} |
| ... | ... |
@@ -125,13 +125,13 @@ func (sb *sandbox) updateHostsFile(ifaceIP string) error {
|
| 125 | 125 |
|
| 126 | 126 |
func (sb *sandbox) addHostsEntries(recs []etchosts.Record) {
|
| 127 | 127 |
if err := etchosts.Add(sb.config.hostsPath, recs); err != nil {
|
| 128 |
- log.Warnf("Failed adding service host entries to the running container: %v", err)
|
|
| 128 |
+ logrus.Warnf("Failed adding service host entries to the running container: %v", err)
|
|
| 129 | 129 |
} |
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
func (sb *sandbox) deleteHostsEntries(recs []etchosts.Record) {
|
| 133 | 133 |
if err := etchosts.Delete(sb.config.hostsPath, recs); err != nil {
|
| 134 |
- log.Warnf("Failed deleting service host entries to the running container: %v", err)
|
|
| 134 |
+ logrus.Warnf("Failed deleting service host entries to the running container: %v", err)
|
|
| 135 | 135 |
} |
| 136 | 136 |
} |
| 137 | 137 |
|
| ... | ... |
@@ -261,7 +261,7 @@ func (sb *sandbox) updateDNS(ipv6Enabled bool) error {
|
| 261 | 261 |
if currHash != "" && currHash != currRC.Hash {
|
| 262 | 262 |
// Seems the user has changed the container resolv.conf since the last time |
| 263 | 263 |
// we checked so return without doing anything. |
| 264 |
- //log.Infof("Skipping update of resolv.conf file with ipv6Enabled: %t because file was touched by user", ipv6Enabled)
|
|
| 264 |
+ //logrus.Infof("Skipping update of resolv.conf file with ipv6Enabled: %t because file was touched by user", ipv6Enabled)
|
|
| 265 | 265 |
return nil |
| 266 | 266 |
} |
| 267 | 267 |
|
| ... | ... |
@@ -178,7 +178,7 @@ func (sb *sandbox) storeDelete() error {
|
| 178 | 178 |
func (c *controller) sandboxCleanup(activeSandboxes map[string]interface{}) {
|
| 179 | 179 |
store := c.getStore(datastore.LocalScope) |
| 180 | 180 |
if store == nil {
|
| 181 |
- logrus.Errorf("Could not find local scope store while trying to cleanup sandboxes")
|
|
| 181 |
+ logrus.Error("Could not find local scope store while trying to cleanup sandboxes")
|
|
| 182 | 182 |
return |
| 183 | 183 |
} |
| 184 | 184 |
|
| ... | ... |
@@ -3,7 +3,7 @@ package libnetwork |
| 3 | 3 |
import ( |
| 4 | 4 |
"fmt" |
| 5 | 5 |
|
| 6 |
- log "github.com/Sirupsen/logrus" |
|
| 6 |
+ "github.com/Sirupsen/logrus" |
|
| 7 | 7 |
"github.com/docker/libkv/store/boltdb" |
| 8 | 8 |
"github.com/docker/libkv/store/consul" |
| 9 | 9 |
"github.com/docker/libkv/store/etcd" |
| ... | ... |
@@ -85,7 +85,7 @@ func (c *controller) getNetworkFromStore(nid string) (*network, error) {
|
| 85 | 85 |
// Continue searching in the next store if the key is not found in this store |
| 86 | 86 |
if err != nil {
|
| 87 | 87 |
if err != datastore.ErrKeyNotFound {
|
| 88 |
- log.Debugf("could not find network %s: %v", nid, err)
|
|
| 88 |
+ logrus.Debugf("could not find network %s: %v", nid, err)
|
|
| 89 | 89 |
} |
| 90 | 90 |
continue |
| 91 | 91 |
} |
| ... | ... |
@@ -126,7 +126,7 @@ func (c *controller) getNetworksForScope(scope string) ([]*network, error) {
|
| 126 | 126 |
ec := &endpointCnt{n: n}
|
| 127 | 127 |
err = store.GetObject(datastore.Key(ec.Key()...), ec) |
| 128 | 128 |
if err != nil && !n.inDelete {
|
| 129 |
- log.Warnf("Could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
|
| 129 |
+ logrus.Warnf("Could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
|
| 130 | 130 |
continue |
| 131 | 131 |
} |
| 132 | 132 |
|
| ... | ... |
@@ -147,7 +147,7 @@ func (c *controller) getNetworksFromStore() ([]*network, error) {
|
| 147 | 147 |
// Continue searching in the next store if no keys found in this store |
| 148 | 148 |
if err != nil {
|
| 149 | 149 |
if err != datastore.ErrKeyNotFound {
|
| 150 |
- log.Debugf("failed to get networks for scope %s: %v", store.Scope(), err)
|
|
| 150 |
+ logrus.Debugf("failed to get networks for scope %s: %v", store.Scope(), err)
|
|
| 151 | 151 |
} |
| 152 | 152 |
continue |
| 153 | 153 |
} |
| ... | ... |
@@ -161,7 +161,7 @@ func (c *controller) getNetworksFromStore() ([]*network, error) {
|
| 161 | 161 |
ec := &endpointCnt{n: n}
|
| 162 | 162 |
err = store.GetObject(datastore.Key(ec.Key()...), ec) |
| 163 | 163 |
if err != nil && !n.inDelete {
|
| 164 |
- log.Warnf("could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
|
| 164 |
+ logrus.Warnf("could not find endpoint count key %s for network %s while listing: %v", datastore.Key(ec.Key()...), n.Name(), err)
|
|
| 165 | 165 |
continue |
| 166 | 166 |
} |
| 167 | 167 |
|
| ... | ... |
@@ -185,7 +185,7 @@ func (n *network) getEndpointFromStore(eid string) (*endpoint, error) {
|
| 185 | 185 |
if err != nil {
|
| 186 | 186 |
if err != datastore.ErrKeyNotFound {
|
| 187 | 187 |
errors = append(errors, fmt.Sprintf("{%s:%v}, ", store.Scope(), err))
|
| 188 |
- log.Debugf("could not find endpoint %s in %s: %v", eid, store.Scope(), err)
|
|
| 188 |
+ logrus.Debugf("could not find endpoint %s in %s: %v", eid, store.Scope(), err)
|
|
| 189 | 189 |
} |
| 190 | 190 |
continue |
| 191 | 191 |
} |
| ... | ... |
@@ -203,7 +203,7 @@ func (n *network) getEndpointsFromStore() ([]*endpoint, error) {
|
| 203 | 203 |
// Continue searching in the next store if no keys found in this store |
| 204 | 204 |
if err != nil {
|
| 205 | 205 |
if err != datastore.ErrKeyNotFound {
|
| 206 |
- log.Debugf("failed to get endpoints for network %s scope %s: %v",
|
|
| 206 |
+ logrus.Debugf("failed to get endpoints for network %s scope %s: %v",
|
|
| 207 | 207 |
n.Name(), store.Scope(), err) |
| 208 | 208 |
} |
| 209 | 209 |
continue |
| ... | ... |
@@ -396,7 +396,7 @@ func (c *controller) processEndpointCreate(nmap map[string]*netWatch, ep *endpoi |
| 396 | 396 |
|
| 397 | 397 |
ch, err := store.Watch(ep.getNetwork().getEpCnt(), nw.stopCh) |
| 398 | 398 |
if err != nil {
|
| 399 |
- log.Warnf("Error creating watch for network: %v", err)
|
|
| 399 |
+ logrus.Warnf("Error creating watch for network: %v", err)
|
|
| 400 | 400 |
return |
| 401 | 401 |
} |
| 402 | 402 |
|
| ... | ... |
@@ -459,15 +459,15 @@ func (c *controller) startWatch() {
|
| 459 | 459 |
func (c *controller) networkCleanup() {
|
| 460 | 460 |
networks, err := c.getNetworksFromStore() |
| 461 | 461 |
if err != nil {
|
| 462 |
- log.Warnf("Could not retrieve networks from store(s) during network cleanup: %v", err)
|
|
| 462 |
+ logrus.Warnf("Could not retrieve networks from store(s) during network cleanup: %v", err)
|
|
| 463 | 463 |
return |
| 464 | 464 |
} |
| 465 | 465 |
|
| 466 | 466 |
for _, n := range networks {
|
| 467 | 467 |
if n.inDelete {
|
| 468 |
- log.Infof("Removing stale network %s (%s)", n.Name(), n.ID())
|
|
| 468 |
+ logrus.Infof("Removing stale network %s (%s)", n.Name(), n.ID())
|
|
| 469 | 469 |
if err := n.delete(true); err != nil {
|
| 470 |
- log.Debugf("Error while removing stale network: %v", err)
|
|
| 470 |
+ logrus.Debugf("Error while removing stale network: %v", err)
|
|
| 471 | 471 |
} |
| 472 | 472 |
} |
| 473 | 473 |
} |
| ... | ... |
@@ -476,7 +476,7 @@ func (c *controller) networkCleanup() {
|
| 476 | 476 |
var populateSpecial NetworkWalker = func(nw Network) bool {
|
| 477 | 477 |
if n := nw.(*network); n.hasSpecialDriver() {
|
| 478 | 478 |
if err := n.getController().addNetwork(n); err != nil {
|
| 479 |
- log.Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
|
|
| 479 |
+ logrus.Warnf("Failed to populate network %q with driver %q", nw.Name(), nw.Type())
|
|
| 480 | 480 |
} |
| 481 | 481 |
} |
| 482 | 482 |
return false |