server: restore sandbox created time from disk

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-05-11 11:04:43 +02:00
parent 59e3f98b6d
commit 3bd4811b3b
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 8 additions and 1 deletions

View file

@ -271,7 +271,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
g.AddAnnotation("crio/kube_name", kubeName)
created := time.Now()
g.AddAnnotation("ocid/created", created.Format(time.RFC3339Nano))
g.AddAnnotation("crio/created", created.Format(time.RFC3339Nano))
sb := &sandbox{
id: id,

View file

@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"sync"
"time"
"github.com/Sirupsen/logrus"
"github.com/containers/image/types"
@ -200,6 +201,11 @@ func (s *Server) loadSandbox(id string) error {
privileged := m.Annotations["crio/privileged_runtime"] == "true"
created, err := time.Parse(time.RFC3339Nano, m.Annotations["crio/created"])
if err != nil {
return err
}
sb := &sandbox{
id: id,
name: name,
@ -214,6 +220,7 @@ func (s *Server) loadSandbox(id string) error {
shmPath: m.Annotations["crio/shm_path"],
privileged: privileged,
resolvPath: m.Annotations["crio/resolv_path"],
created: created,
}
// We add a netNS only if we can load a permanent one.