This repository was archived by the owner on Feb 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -101,14 +101,19 @@ func (p *XPod) Name() string {
101101 return p .name
102102}
103103
104- // SandboxName() returns the id of the sandbox, the detail of sandbox should be wrapped inside XPod, this method is
105- // used for list/display only.
106- func (p * XPod ) SandboxName () string {
104+ func (p * XPod ) SandboxNameLocked () string {
107105 var sbn = ""
108- p .statusLock .RLock ()
109106 if p .sandbox != nil {
110107 sbn = p .sandbox .Id
111108 }
109+ return sbn
110+ }
111+
112+ // SandboxName() returns the id of the sandbox, the detail of sandbox should be wrapped inside XPod, this method is
113+ // used for list/display only.
114+ func (p * XPod ) SandboxName () string {
115+ p .statusLock .RLock ()
116+ sbn := p .SandboxNameLocked ()
112117 p .statusLock .RUnlock ()
113118 return sbn
114119}
@@ -171,7 +176,7 @@ func (p *XPod) BriefStatus() (s *apitypes.PodListResult) {
171176 s = & apitypes.PodListResult {
172177 PodID : p .Id (),
173178 PodName : p .Name (),
174- VmID : p .SandboxName (),
179+ VmID : p .SandboxNameLocked (),
175180 CreatedAt : p .info .CreatedAt ,
176181 Labels : p .labels ,
177182 }
@@ -207,7 +212,7 @@ func (p *XPod) SandboxBriefStatus() (s *apitypes.VMListResult) {
207212 p .statusLock .RLock ()
208213 if p .sandbox != nil {
209214 s = & apitypes.VMListResult {
210- VmID : p .SandboxName (),
215+ VmID : p .SandboxNameLocked (),
211216 PodID : p .Id (),
212217 }
213218 if p .status == S_POD_PAUSED {
You can’t perform that action at this time.
0 commit comments