Skip to content

Commit 443b7be

Browse files
author
Santhosh Manohar
authored
Merge pull request #1359 from mavenugo/sbs
Better error handling in restoring sandbox states
2 parents c7dc6dc + aa0d390 commit 443b7be

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

sandbox.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,12 @@ func (sb *sandbox) restoreOslSandbox() error {
726726
joinInfo := ep.joinInfo
727727
i := ep.iface
728728
ep.Unlock()
729+
730+
if i == nil {
731+
log.Errorf("error restoring endpoint %s for container %s", ep.Name(), sb.ContainerID())
732+
continue
733+
}
734+
729735
ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().Address(i.addr), sb.osSbox.InterfaceOptions().Routes(i.routes))
730736
if i.addrv6 != nil && i.addrv6.IP.To16() != nil {
731737
ifaceOptions = append(ifaceOptions, sb.osSbox.InterfaceOptions().AddressIPv6(i.addrv6))

sandbox_store.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ func (c *controller) sandboxCleanup(activeSandboxes map[string]interface{}) {
245245
ep = &endpoint{id: eps.Eid, network: n, sandboxID: sbs.ID}
246246
}
247247
}
248+
if _, ok := activeSandboxes[sb.ID()]; ok && err != nil {
249+
logrus.Errorf("failed to restore endpoint %s in %s for container %s due to %v", eps.Eid, eps.Nid, sb.ContainerID(), err)
250+
continue
251+
}
248252
heap.Push(&sb.endpoints, ep)
249253
}
250254

0 commit comments

Comments
 (0)