server: restore sandbox created time from disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
59e3f98b6d
commit
3bd4811b3b
2 changed files with 8 additions and 1 deletions
|
@ -271,7 +271,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
g.AddAnnotation("crio/kube_name", kubeName)
|
g.AddAnnotation("crio/kube_name", kubeName)
|
||||||
|
|
||||||
created := time.Now()
|
created := time.Now()
|
||||||
g.AddAnnotation("ocid/created", created.Format(time.RFC3339Nano))
|
g.AddAnnotation("crio/created", created.Format(time.RFC3339Nano))
|
||||||
|
|
||||||
sb := &sandbox{
|
sb := &sandbox{
|
||||||
id: id,
|
id: id,
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/image/types"
|
"github.com/containers/image/types"
|
||||||
|
@ -200,6 +201,11 @@ func (s *Server) loadSandbox(id string) error {
|
||||||
|
|
||||||
privileged := m.Annotations["crio/privileged_runtime"] == "true"
|
privileged := m.Annotations["crio/privileged_runtime"] == "true"
|
||||||
|
|
||||||
|
created, err := time.Parse(time.RFC3339Nano, m.Annotations["crio/created"])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
sb := &sandbox{
|
sb := &sandbox{
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
|
@ -214,6 +220,7 @@ func (s *Server) loadSandbox(id string) error {
|
||||||
shmPath: m.Annotations["crio/shm_path"],
|
shmPath: m.Annotations["crio/shm_path"],
|
||||||
privileged: privileged,
|
privileged: privileged,
|
||||||
resolvPath: m.Annotations["crio/resolv_path"],
|
resolvPath: m.Annotations["crio/resolv_path"],
|
||||||
|
created: created,
|
||||||
}
|
}
|
||||||
|
|
||||||
// We add a netNS only if we can load a permanent one.
|
// We add a netNS only if we can load a permanent one.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue