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 @@ -105,14 +105,19 @@ func (p *XPod) Name() string {
105105 return p .name
106106}
107107
108- // SandboxName() returns the id of the sandbox, the detail of sandbox should be wrapped inside XPod, this method is
109- // used for list/display only.
110- func (p * XPod ) SandboxName () string {
108+ func (p * XPod ) SandboxNameLocked () string {
111109 var sbn = ""
112- p .statusLock .RLock ()
113110 if p .sandbox != nil {
114111 sbn = p .sandbox .Id
115112 }
113+ return sbn
114+ }
115+
116+ // SandboxName() returns the id of the sandbox, the detail of sandbox should be wrapped inside XPod, this method is
117+ // used for list/display only.
118+ func (p * XPod ) SandboxName () string {
119+ p .statusLock .RLock ()
120+ sbn := p .SandboxNameLocked ()
116121 p .statusLock .RUnlock ()
117122 return sbn
118123}
@@ -175,7 +180,7 @@ func (p *XPod) BriefStatus() (s *apitypes.PodListResult) {
175180 s = & apitypes.PodListResult {
176181 PodID : p .Id (),
177182 PodName : p .Name (),
178- VmID : p .SandboxName (),
183+ VmID : p .SandboxNameLocked (),
179184 CreatedAt : p .info .CreatedAt ,
180185 Labels : p .labels ,
181186 }
@@ -211,7 +216,7 @@ func (p *XPod) SandboxBriefStatus() (s *apitypes.VMListResult) {
211216 p .statusLock .RLock ()
212217 if p .sandbox != nil {
213218 s = & apitypes.VMListResult {
214- VmID : p .SandboxName (),
219+ VmID : p .SandboxNameLocked (),
215220 PodID : p .Id (),
216221 }
217222 if p .status == S_POD_PAUSED {
You can’t perform that action at this time.
0 commit comments