@@ -144,16 +144,15 @@ func LoadXPod(factory *PodFactory, layout *types.PersistPodLayout) (*XPod, error
144144 if err != nil {
145145 return nil , err
146146 }
147- /*
148- //associate containers
149- if p.status == S_POD_RUNNING {
150- for _, c := range p.containers {
151- if err = c.associateToSandbox(); err != nil {
152- return nil, err
153- }
147+
148+ //associate containers
149+ if p .status == S_POD_RUNNING {
150+ for _ , c := range p .containers {
151+ if err = c .associateToSandbox (); err != nil {
152+ return nil , err
154153 }
155154 }
156- */
155+ }
157156
158157 // don't need to reserve name again, because this is load
159158 return p , nil
@@ -450,31 +449,31 @@ func (inf *Interface) removeFromDB() error {
450449
451450func (p * XPod ) saveSandbox () error {
452451
453- var (
454- sb types.SandboxPersistInfo
455- err error
456- )
457- stop_status := map [PodState ]bool {
458- S_POD_NONE : true ,
459- S_POD_STOPPED : true ,
460- S_POD_STOPPING : true ,
461- S_POD_ERROR : true ,
452+ var (
453+ sb types.SandboxPersistInfo
454+ err error
455+ )
456+ stop_status := map [PodState ]bool {
457+ S_POD_NONE : true ,
458+ S_POD_STOPPED : true ,
459+ S_POD_STOPPING : true ,
460+ S_POD_ERROR : true ,
461+ }
462+ p .statusLock .RLock ()
463+ defer p .statusLock .RUnlock ()
464+ if ! stop_status [p .status ] {
465+ sb .Id = p .sandbox .ID ()
466+ /*By now the sandbox info had been managed by kata, thus there is no need
467+ *to keep those info here.
468+ */
469+ sb .PersistInfo = nil
470+ if err != nil {
471+ hlog .HLog (ERROR , p , 2 , "failed to dump sandbox %s: %v" , sb .Id , err )
472+ return err
462473 }
463- p .statusLock .RLock ()
464- defer p .statusLock .RUnlock ()
465- if ! stop_status [p .status ] {
466- sb .Id = p .sandbox .ID ()
467- /*By now the sandbox info had been managed by kata, thus there is no need
468- *to keep those info here.
469- */
470- sb .PersistInfo = nil
471- if err != nil {
472- hlog .HLog (ERROR , p , 2 , "failed to dump sandbox %s: %v" , sb .Id , err )
473- return err
474- }
475- return saveMessage (p .factory .db , fmt .Sprintf (SB_KEY_FMT , p .Id ()), & sb , p , "sandbox info" )
474+ return saveMessage (p .factory .db , fmt .Sprintf (SB_KEY_FMT , p .Id ()), & sb , p , "sandbox info" )
476475
477- }
476+ }
478477
479478 return nil
480479}
0 commit comments