Should register container/sandbox name after restart.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2017-09-21 21:06:24 +00:00
parent 9015b6ec68
commit e132f9c1ea

View File

@ -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.