-
Notifications
You must be signed in to change notification settings - Fork 375
sandbox: change container slice to a map #503
Conversation
PSS Measurement: Memory inside container: |
PSS Measurement: Memory inside container: |
Build succeeded (third-party-check pipeline).
|
Build succeeded (third-party-check pipeline).
|
virtcontainers/sandbox.go
Outdated
s.containers = append(s.containers[:idx], s.containers[idx+1:]...) | ||
return nil | ||
} | ||
if s.containers[containerID] == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way to write this in Golang is:
if _, exist := s.containers[containerID]; !exist {
return fmt.Errorf("Could not remove the container %q from the sandbox %q containers list", containerID, s.id)
}
virtcontainers/sandbox.go
Outdated
@@ -978,7 +980,10 @@ func (s *Sandbox) startVM() error { | |||
} | |||
|
|||
func (s *Sandbox) addContainer(c *Container) error { | |||
s.containers = append(s.containers, c) | |||
if s.containers[c.id] != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here to check a container entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Fixed both. Thanks!
Codecov Report
@@ Coverage Diff @@
## master #503 +/- ##
==========================================
- Coverage 65.98% 65.96% -0.02%
==========================================
Files 93 93
Lines 9484 9488 +4
==========================================
+ Hits 6258 6259 +1
- Misses 2554 2555 +1
- Partials 672 674 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bergwolf !
PSS Measurement: Memory inside container: |
Build succeeded (third-party-check pipeline).
|
ContainerID is supposed to be unique within a sandbox. It is better to use a map to describe containers of a sandbox. Fixes: kata-containers#502 Signed-off-by: Peng Tao <bergwolf@gmail.com>
Build failed (third-party-check pipeline) integration testing with
|
PSS Measurement: Memory inside container: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice patch!
Revert vendor: Update libcontainer vendoring
ContainerID is supposed to be unique within a sandbox. It is better to use
a map to describe containers of a sandbox.
Fixes: #502