Merge pull request #271 from Random-Liu/register-name-after-recover
Should register container/sandbox name after restart.
This commit is contained in:
commit
2ac9262091
@ -65,6 +65,9 @@ func (c *criContainerdService) recover(ctx context.Context) error {
|
||||
if err := c.sandboxStore.Add(sb); err != nil {
|
||||
return fmt.Errorf("failed to add sandbox %q to store: %v", sandbox.ID(), err)
|
||||
}
|
||||
if err := c.sandboxNameIndex.Reserve(sb.Name, sb.ID); err != nil {
|
||||
return fmt.Errorf("failed to reserve sandbox name %q: %v", sb.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Recover all containers.
|
||||
@ -83,6 +86,9 @@ func (c *criContainerdService) recover(ctx context.Context) error {
|
||||
if err := c.containerStore.Add(cntr); err != nil {
|
||||
return fmt.Errorf("failed to add container %q to store: %v", container.ID(), err)
|
||||
}
|
||||
if err := c.containerNameIndex.Reserve(cntr.Name, cntr.ID); err != nil {
|
||||
return fmt.Errorf("failed to reserve container name %q: %v", cntr.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// Recover all images.
|
||||
|
Loading…
Reference in New Issue
Block a user