Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2223 from tedyu/sandbox-anno
Browse files Browse the repository at this point in the history
vc: Sandbox#Annotations should use annotationsLock read lock
  • Loading branch information
amshinde authored Nov 20, 2019
2 parents 48c8d66 + 1afad1c commit 1f71114
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ func (s *Sandbox) Logger() *logrus.Entry {

// Annotations returns any annotation that a user could have stored through the sandbox.
func (s *Sandbox) Annotations(key string) (string, error) {
s.annotationsLock.RLock()
defer s.annotationsLock.RUnlock()

value, exist := s.config.Annotations[key]
if !exist {
return "", fmt.Errorf("Annotations key %s does not exist", key)
Expand Down

0 comments on commit 1f71114

Please sign in to comment.