mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-29 04:51:34 +00:00
vc: Sandbox#Annotations should use annotationsLock read lock
Fixes #2222 Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
parent
66f0ec526e
commit
1afad1c0ad
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user