Skip to content

Commit

Permalink
Add logging for host query soft failures
Browse files Browse the repository at this point in the history
  • Loading branch information
ofiliz committed Aug 17, 2017
1 parent b9a2193 commit 5efa19b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 9 additions & 4 deletions ipam/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/Azure/azure-container-networking/common"
"github.com/Azure/azure-container-networking/log"
)

const (
Expand Down Expand Up @@ -143,19 +144,22 @@ func (s *azureSource) refresh() error {

// Skip if interface is not found.
if ifName == "" {
log.Printf("[ipam] Failed to find interface with MAC address:%v.", i.MacAddress)
continue
}

// For each subnet on the interface...
for _, s := range i.IPSubnet {
_, subnet, err := net.ParseCIDR(s.Prefix)
if err != nil {
return err
log.Printf("[ipam] Failed to parse subnet:%v err:%v.", s.Prefix, err)
continue
}

ap, err := local.newAddressPool(ifName, priority, subnet)
if err != nil && err != errAddressExists {
return err
if err != nil {
log.Printf("[ipam] Failed to create pool:%v ifName:%v err:%v.", subnet, ifName, err)
continue
}

// For each address in the subnet...
Expand All @@ -169,7 +173,8 @@ func (s *azureSource) refresh() error {

_, err = ap.newAddressRecord(&address)
if err != nil {
return err
log.Printf("[ipam] Failed to create address:%v err:%v.", address, err)
continue
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions ipam/mas.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/Azure/azure-container-networking/common"
"github.com/Azure/azure-container-networking/log"
)

const (
Expand Down Expand Up @@ -113,13 +114,15 @@ func (s *masSource) refresh() error {
}

ap, err := local.newAddressPool("eth0", 0, &subnet)
if err != nil && err != errAddressExists {
return err
if err != nil {
log.Printf("[ipam] Failed to create pool:%v err:%v.", subnet, err)
continue
}

_, err = ap.newAddressRecord(&address)
if err != nil {
return err
log.Printf("[ipam] Failed to create address:%v err:%v.", address, err)
continue
}
}

Expand Down

0 comments on commit 5efa19b

Please sign in to comment.